/* ONLINE PRICE RESPONSIVE CATALOG FIX V1 */

/* Narrow desktop / tablet */
@media (max-width: 850px) {
  #store {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    grid-template-columns: minmax(0, 1fr) !important;
    box-sizing: border-box !important;
  }

  #store > *,
  #store section,
  #store .panel {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  #store table:has(#catalog),
  #store table:has(#catalog) > tbody,
  #store #catalog {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  #store #catalog tr:not(.category) {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
}

/* Phone-sized windows */
@media (max-width: 600px) {
  #store table:has(#catalog) {
    display: block !important;
  }

  #store #catalog {
    display: block !important;
  }

  #store #catalog tr:not(.category) {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  #store #catalog td {
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  #store #catalog .catalog-product-name {
    min-width: 0 !important;
    overflow-wrap: anywhere;
  }
}

/* ONLINE PRICE CATALOG WIDTH V2 */
@media (max-width:850px) {

  /* Hide desktop column headings */
  #store table:has(#catalog) > thead {
    display:none !important;
  }

  /* Make catalog a full-width block */
  #store table:has(#catalog),
  #store table:has(#catalog) > tbody,
  #store #catalog {
    display:block !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    box-sizing:border-box !important;
  }

  /* Warehouse/category heading */
  #store #catalog tr.category {
    display:block !important;
    width:100% !important;
    max-width:100% !important;
  }

  #store #catalog tr.category td {
    display:block !important;
    width:100% !important;
    box-sizing:border-box !important;
  }

  /* Product cards */
  #store #catalog tr:not(.category) {
    display:grid !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    box-sizing:border-box !important;
    grid-template-columns:minmax(0,1fr) auto !important;
    gap:4px 10px !important;
    padding:12px !important;
    margin:0 0 9px !important;
  }

  #store #catalog tr:not(.category) td {
    min-width:0 !important;
    max-width:100% !important;
    box-sizing:border-box !important;
  }

  /* Product name */
  #store #catalog tr:not(.category) td:nth-child(1) {
    grid-column:1 / -1 !important;
    grid-row:1 !important;
    width:100% !important;
  }

  /* Description, dosage: existing mobile details handle these */
  #store #catalog tr:not(.category) td:nth-child(2),
  #store #catalog tr:not(.category) td:nth-child(3) {
    display:none !important;
  }

  /* Price */
  #store #catalog tr:not(.category) td:nth-child(4) {
    grid-column:2 !important;
    grid-row:2 !important;
    width:auto !important;
    justify-self:end !important;
  }

  /* Availability */
  #store #catalog tr:not(.category) td:nth-child(5) {
    grid-column:1 !important;
    grid-row:2 !important;
    width:auto !important;
  }

  /* Quantity controls */
  #store #catalog tr:not(.category) td:nth-child(6) {
    display:flex !important;
    grid-column:1 / -1 !important;
    grid-row:3 !important;
    justify-content:flex-end !important;
    width:100% !important;
  }
}
