/*
 * NASH 2026-11-13 - ticket 33305 follow-up.
 * Category card consistency, filter visibility, product quantity spacing.
 * Scoped to tenant storefront surfaces. Remove this file reference to roll back.
 */

/* -------------------------------------------------------------------------
 * 1. Category listing cards: match the /shop-all card source of truth.
 *    Category cards are cloned from subcategory pages, so they lose the
 *    #products card layout. This restores one consistent card on every
 *    category page regardless of where the grid is mounted.
 * ---------------------------------------------------------------------- */
/* One grid definition for every category page. Some category pages already
 * contain a legacy #products container whose 2-column rule would otherwise
 * leak through and make the same category look different. */
body.category-page #wrapper .nash-category-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)) !important;
  gap: 1rem !important;
}

body.category-page #wrapper .nash-category-grid > .product-summary {
  display: flex;
  flex-direction: column;
  float: none;
  width: auto;
  min-width: 0;
  height: auto !important;
  margin: 0;
  padding: 22px;
  border: 1px solid rgba(11, 17, 34, 0.14);
  background: #fff;
  color: #151b2b;
  box-shadow: none;
  box-sizing: border-box;
  overflow: hidden;
}

body.category-page #wrapper .nash-category-grid > .product-summary::before,
body.category-page #wrapper .nash-category-grid > .product-summary::after {
  display: none;
  content: none;
}

body.category-page #wrapper .nash-category-grid .product-image {
  display: block;
  float: none;
  width: 100%;
  min-width: 0;
  height: auto !important;
  margin: 0;
  padding: 16px 16px 0;
  box-sizing: border-box;
}

body.category-page #wrapper .nash-category-grid .product-image > a {
  position: relative;
  display: flex;
  width: 100%;
  aspect-ratio: 4 / 3;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fff;
}

body.category-page #wrapper .nash-category-grid .product-image picture {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

body.category-page #wrapper .nash-category-grid .product-image img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  box-sizing: border-box;
  object-fit: contain;
  object-position: center center;
}

body.category-page #wrapper .nash-category-grid .product-details {
  float: none;
  width: 100%;
  height: auto !important;
  min-height: 0;
  margin: 0;
  padding: 18px 18px 14px;
  box-sizing: border-box;
  text-align: left;
}

body.category-page #wrapper .nash-category-grid .product-details h5,
body.category-page #wrapper .nash-category-grid .product-details > div:first-child {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
}

body.category-page #wrapper .nash-category-grid .product-details h5 a,
body.category-page #wrapper .nash-category-grid .product-details-link {
  color: #0b1122;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  text-decoration: none;
}

body.category-page #wrapper .nash-category-grid .product-details h5 a:hover,
body.category-page #wrapper .nash-category-grid .product-details-link:hover {
  color: #e0183d;
  text-decoration: underline;
}

body.category-page #wrapper .nash-category-grid .part-number {
  margin: 0 0 12px;
  color: #5f6980;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.5;
  text-transform: uppercase;
}

body.category-page #wrapper .nash-category-grid .product-description {
  margin: 0 0 18px;
  color: #606878;
  font-size: 0.8125rem;
  line-height: 1.6;
}

body.category-page #wrapper .nash-category-grid .nash-read-more {
  color: #e0183d;
  text-decoration: none;
}

body.category-page #wrapper .nash-category-grid .nash-read-more:hover {
  text-decoration: underline;
}

body.category-page #wrapper .nash-category-grid .product-purchase {
  display: grid;
  float: none;
  width: 100%;
  height: auto !important;
  min-height: 0;
  margin: auto 0 0;
  padding: 14px 18px 18px;
  border: 0;
  background: #fff;
  box-sizing: border-box;
  gap: 12px;
}

body.category-page #wrapper .nash-category-grid .product-purchase .price-regular,
body.category-page #wrapper .nash-category-grid .product-purchase .price-range,
body.category-page #wrapper .nash-category-grid .product-purchase .price-value {
  margin: 0 0 8px;
  color: #151b2b;
  font-size: 1.6875rem;
  font-weight: 700;
  line-height: 1.3;
}

body.category-page #wrapper .nash-category-grid .product-purchase form[action="/cart/add"] {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  align-items: stretch;
  gap: 0.625rem;
  margin: 0;
}

body.category-page #wrapper .nash-category-grid .product-quantity {
  display: block;
  width: 8rem;
  min-width: 8rem;
  height: 2.75rem;
  margin: 0;
  float: none;
}

body.category-page #wrapper .nash-category-grid .product-quantity .arrows {
  display: flex !important;
  width: 8rem !important;
  height: 2.75rem !important;
}

body.category-page #wrapper .nash-category-grid .product-quantity .arrows input {
  position: static !important;
  flex: 0 0 2.5rem;
  width: 2.5rem !important;
  height: 2.75rem !important;
  margin: 0;
  padding: 0 !important;
  border: 1px solid #dce0e7;
  background: #fff;
  color: #151b2b;
  text-align: center;
  box-sizing: border-box;
}

body.category-page #wrapper .nash-category-grid .product-quantity .arrows > span {
  position: static !important;
  display: flex !important;
  width: 5.5rem !important;
  height: 2.75rem !important;
}

body.category-page #wrapper .nash-category-grid .product-quantity .arrows i {
  position: static !important;
  display: grid !important;
  flex: 0 0 2.75rem;
  width: 2.75rem !important;
  height: 2.75rem !important;
  place-items: center;
  border: 1px solid #dce0e7;
  background: #eef1f7;
  cursor: pointer;
  box-sizing: border-box;
}

body.category-page #wrapper .nash-category-grid .product-quantity .arrows .dn {
  order: -1;
}

body.category-page #wrapper .nash-category-grid .product-purchase input[type="submit"],
body.category-page #wrapper .nash-category-grid .product-purchase > a.btn-primary {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  border: 1px solid #c8102e;
  background: #c8102e;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: none;
  text-decoration: none;
  text-transform: uppercase;
  box-shadow: none;
  box-sizing: border-box;
}

body.category-page #wrapper .nash-category-grid .product-purchase input[type="submit"]:hover,
body.category-page #wrapper .nash-category-grid .product-purchase > a.btn-primary:hover {
  border-color: #951333;
  background: #951333;
}

/* Filter buttons: keep the resting state neutral and the selected state red.
 * The platform button rule is !important, so this needs the same weight. */
body.category-page #wrapper .nash-category-filter button {
  border: 1px solid #d7dce6 !important;
  background: #fff !important;
  color: #0b1122 !important;
  box-shadow: none !important;
}

body.category-page #wrapper .nash-category-filter button:hover,
body.category-page #wrapper .nash-category-filter button:focus {
  border-color: #e0183d !important;
  background: #fff !important;
  color: #e0183d !important;
}

body.category-page #wrapper .nash-category-filter button.is-active,
body.category-page #wrapper .nash-category-filter button.is-active:hover,
body.category-page #wrapper .nash-category-filter button.is-active:focus {
  border-color: #e0183d !important;
  background: #e0183d !important;
  color: #fff !important;
}

/* Filters rely on the hidden attribute; the card layout above sets display,
 * so make hidden authoritative. */
body.category-page #wrapper .nash-category-grid > .product-summary[hidden] {
  display: none !important;
}

/* Once the category crawler owns the page, the legacy listing is a duplicate. */
body.nash-category-enhanced #wrapper #product-list {
  display: none !important;
}

/* -------------------------------------------------------------------------
 * 2. Product pages: one purchase panel for SIPP and MIPP.
 *    The MIPP picker now uses the same card, price, divider, inline quantity
 *    row, stepper, and full-width Add to Cart button as a SIPP.
 * ---------------------------------------------------------------------- */
body.product-page #wrapper .product-purchase .control-group.product-quantity {
  margin-bottom: 1rem !important;
}

/* The mockup stylesheet scopes MIPP rules to #product-main with ID weight.
 * Mirror that weight so the purchase panel can be unified. */
body.product-page:not(#structure-repair-floor-supports-power-post-2-0-kit-page) #wrapper #product-main .mipp-picker {
  box-shadow: 0 2px 8px rgba(11, 17, 34, 0.08);
}

body.product-page:not(#structure-repair-floor-supports-power-post-2-0-kit-page) #wrapper #product-main .mipp-picker .mipp-label,
body.product-page:not(#structure-repair-floor-supports-power-post-2-0-kit-page) #wrapper #product-main .mipp-picker .nash-price-eyebrow {
  margin: 0 0 4px;
  color: #6a7182;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1;
}

body.product-page:not(#structure-repair-floor-supports-power-post-2-0-kit-page) #wrapper #product-main .mipp-picker .mipp-select {
  height: 56px;
}

body.product-page:not(#structure-repair-floor-supports-power-post-2-0-kit-page) #wrapper #product-main .mipp-picker .mipp-price {
  margin: 0 0 4px;
}

body.product-page:not(#structure-repair-floor-supports-power-post-2-0-kit-page) #wrapper #product-main .mipp-picker .mipp-purchase {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 16px 10px;
  margin-top: 12px;
  padding-top: 24px;
  border-top: 1px solid rgba(11, 17, 34, 0.1);
}

body.product-page:not(#structure-repair-floor-supports-power-post-2-0-kit-page) #wrapper #product-main .mipp-picker .mipp-qty-label {
  grid-column: 1;
  grid-row: 1;
  color: #101832;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.6;
  text-transform: none;
}

body.product-page:not(#structure-repair-floor-supports-power-post-2-0-kit-page) #wrapper #product-main .mipp-picker .nash-qty {
  grid-column: 2;
  grid-row: 1;
  width: 140px;
  height: 56px;
}

body.product-page:not(#structure-repair-floor-supports-power-post-2-0-kit-page) #wrapper #product-main .mipp-picker .nash-qty .arrows input {
  width: 52px !important;
  height: 56px !important;
  margin: 0 44px !important;
  box-sizing: border-box;
  text-align: center;
}

body.product-page:not(#structure-repair-floor-supports-power-post-2-0-kit-page) #wrapper #product-main .mipp-picker .nash-qty input::-webkit-outer-spin-button,
body.product-page:not(#structure-repair-floor-supports-power-post-2-0-kit-page) #wrapper #product-main .mipp-picker .nash-qty input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

body.product-page:not(#structure-repair-floor-supports-power-post-2-0-kit-page) #wrapper #product-main .mipp-picker .nash-qty input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

body.product-page:not(#structure-repair-floor-supports-power-post-2-0-kit-page) #wrapper #product-main .mipp-picker .mipp-buy {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
  height: 56px;
  padding: 10.4px 16px;
  font-size: 16px;
}

body.product-page:not(#structure-repair-floor-supports-power-post-2-0-kit-page) #wrapper #product-main .mipp-picker .mipp-purchase > .btn-save-to-list {
  margin-top: -4px;
}

/* -------------------------------------------------------------------------
 * 3. Small-screen category cards: stack quantity and action, as on /shop-all.
 * ---------------------------------------------------------------------- */
@media (max-width: 47.99rem) {
  body.category-page #wrapper .nash-category-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.category-page #wrapper .nash-category-grid .product-purchase form[action="/cart/add"] {
    grid-template-columns: minmax(0, 1fr);
  }

  body.category-page #wrapper .nash-category-grid .product-quantity,
  body.category-page #wrapper .nash-category-grid .product-quantity .arrows {
    width: 100%;
    min-width: 0;
  }

  body.category-page #wrapper .nash-category-grid .product-quantity input {
    width: 2.5rem !important;
  }

  body.category-page #wrapper .nash-category-grid .product-purchase input[type="submit"],
  body.category-page #wrapper .nash-category-grid .product-purchase > a.btn-primary {
    min-height: 2.75rem;
  }
}

/* -------------------------------------------------------------------------
 * 4. Shopping Lists (/lists).
 *    The platform emits Bootstrap span classes on table cells. Without
 *    explicit widths the empty action cell takes the whole row and squeezes
 *    the list name / privacy / item-count columns into a few pixels.
 * ---------------------------------------------------------------------- */
body#lists-page #main > table.table {
  width: 100%;
  table-layout: auto;
}

body#lists-page #main > table.table td {
  vertical-align: middle;
}

body#lists-page #main > table.table td.span1 {
  width: 92px;
  min-width: 92px;
  white-space: nowrap;
}

body#lists-page #main > table.table td.span6 {
  width: auto;
  min-width: 200px;
}

body#lists-page #main > table.table td.span2 {
  width: 120px;
  white-space: nowrap;
}

body#lists-page #main > table.table td.span2:last-child {
  width: 110px;
  text-align: right;
}

body#lists-page #main > table.table td.span6 a {
  color: #0b1122;
  font-weight: 600;
  text-decoration: none;
}

body#lists-page #main > table.table td.span6 a:hover {
  color: #e0183d;
  text-decoration: underline;
}

/* -------------------------------------------------------------------------
 * 5. NOPS preview / impersonation bar.
 *    The preview bar injects a light-gray background after site.less, which
 *    leaves the white admin labels unreadable. Restore the intended dark bar
 *    and give the user-search results a readable light surface.
 * ---------------------------------------------------------------------- */
#admin-menu {
  border-bottom: 1px solid rgba(255, 255, 255, 0.18) !important;
  background: linear-gradient(
    105deg,
    var(--sf-color-brand-strong),
    var(--sf-color-brand)
  ) !important;
  color: #fff !important;
  box-shadow: 0 3px 10px rgba(11, 17, 34, 0.24) !important;
}

#admin-menu #admin-menu-page-details,
#admin-menu #admin-menu-page-details strong,
#admin-menu #admin-menu-page-details .label-info {
  color: #fff !important;
}

#admin-menu .typeahead.dropdown-menu {
  border: 1px solid #d7dce6 !important;
  background: #fff !important;
  color: #101832 !important;
}

#admin-menu .typeahead.dropdown-menu a {
  color: #101832 !important;
  font-size: 13px !important;
  line-height: 1.35 !important;
}

#admin-menu .typeahead.dropdown-menu a:hover,
#admin-menu .typeahead.dropdown-menu .active > a {
  background: #eef1f8 !important;
  color: #0b1122 !important;
}

@media (max-width: 47.99rem) {
  body#lists-page #main > table.table td {
    padding: 0.5rem;
  }

  body#lists-page #main > table.table td.span1 {
    width: 86px;
    min-width: 86px;
  }

  body#lists-page #main > table.table td.span6 {
    width: auto;
    min-width: 0;
  }

  body#lists-page #main > table.table td.span2,
  body#lists-page #main > table.table td.span2:last-child {
    width: auto;
    min-width: 56px;
    white-space: normal;
    font-size: 0.8125rem;
  }
}
