/* === TheShopCart — mobile & tablet overrides =========================
   Loaded LAST in header.php so these win over page CSS.
   Breakpoints follow Bootstrap 5:  <576 phone · <768 large phone ·
   <992 tablet · ≥992 desktop.
   ===================================================================== */

/* Never let a stray element create sideways scrolling on phones */
html, body { overflow-x: hidden; }
img, video, iframe { max-width: 100%; }

/* ------------------------------------------------------------------
   HEADER
   ------------------------------------------------------------------ */
.tsc-burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid rgba(255,255,255,.35);
  background: transparent;
  color: #fff;
  font-size: 1.4rem;
  border-radius: 4px;
}
.tsc-burger:hover { background: rgba(255,255,255,.12); }

.tsc-search-mobile { padding-top: .65rem; }
.tsc-search-mobile .input-group { background: #fff; }
.tsc-search-mobile .form-control { border: 0; border-radius: 0; font-size: 16px; /* 16px stops iOS zoom-on-focus */ }

/* Offcanvas menu */
.tsc-mmenu { max-width: 85vw; }
.tsc-mmenu .offcanvas-header { background: #7a0f0f; color: #fff; }
.tsc-mmenu__section {
  padding: .9rem 1rem .35rem;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #6b7280;
}
.tsc-mmenu__link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1rem;
  color: #1f2937;
  text-decoration: none;
  border-bottom: 1px solid #f1f1f1;
}
.tsc-mmenu__link i { color: #7a0f0f; width: 1.1rem; text-align: center; }
.tsc-mmenu__link:hover { background: #fbf6f6; color: #7a0f0f; }

@media (max-width: 767.98px) {
  .tsc-topbar .container { justify-content: center !important; }
  .tsc-topbar__msg { font-size: .75rem; }
}

@media (max-width: 991.98px) {
  .tsc-main-header .container { gap: .6rem !important; }
  .tsc-actions { gap: .5rem !important; }
  /* Tablet: icons only, so the search bar gets the room */
  .tsc-action__body { display: none !important; }
  .tsc-search { margin-left: .25rem; margin-right: .25rem; }
}

@media (max-width: 575.98px) {
  .tsc-topbar .container,
  .tsc-main-header .container { padding-left: .75rem; padding-right: .75rem; }
  .tsc-main-header { padding: .6rem 0 .7rem; }
  .tsc-logo-text { font-size: 1.35rem; }
  .tsc-mode-pill { font-size: .5rem; padding: 1px 5px; }
  .tsc-action__icon { width: 36px; height: 36px; font-size: 1rem; }
}

/* ------------------------------------------------------------------
   HOME
   ------------------------------------------------------------------ */
@media (max-width: 991.98px) {
  /* The desktop 20/80 split must not leak into the stacked layout */
  .tsc-home .row.g-3.align-items-stretch > [class*="col-lg-3"],
  .tsc-home .row.g-3.align-items-stretch > [class*="col-lg-9"] {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
  }
}

/* ------------------------------------------------------------------
   CONDITION RIBBONS — keep the rotated band inside its image
   ------------------------------------------------------------------ */
.product-page .product-main-image-wrapper { position: relative; overflow: hidden; }
:has(> .tsc-cond-badge) { overflow: hidden; }

/* ------------------------------------------------------------------
   PRODUCT PAGE
   ------------------------------------------------------------------ */
@media (max-width: 991.98px) {
  /* Thumbnails: horizontal swipe strip under the main image */
  .product-page .thumbs-vertical {
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
    padding-bottom: .25rem;
    -webkit-overflow-scrolling: touch;
  }
  .product-page .thumbs-vertical > * { flex: 0 0 64px; width: 64px; }
  .product-page .thumbs-vertical img { width: 64px; height: 64px; object-fit: cover; }
  .product-page .thumbs-scroll-btn { display: none; }
  .product-page .tc-gallery { flex-direction: column-reverse !important; align-items: stretch !important; }
  .product-page .tc-gallery > * { width: 100%; max-width: 100%; }
  .product-page .product-main-image-wrapper img { max-height: 520px; width: auto; object-fit: contain; }
}
@media (max-width: 767.98px) {
  /* Fast Delivery / Easy Returns / Secure Checkout: one compact row */
  .product-page .row:has(> div > .service-box) > div { flex: 0 0 33.333%; max-width: 33.333%; }
  .product-page .row:has(> div > .service-box) { --bs-gutter-x: .5rem; }
  .product-page .service-box { padding: .5rem .25rem !important; font-size: .72rem; line-height: 1.2; text-align: center; }
  .details-card th { width: 45%; }
  .details-card td { word-break: break-word; }
}

@media (max-width: 575.98px) {
  .product-page .ribbon { left: -110px; width: 300px; font-size: .85rem; padding: 8px 0; }
}

/* ------------------------------------------------------------------
   HOME PROMO TILES
   ------------------------------------------------------------------ */
@media (max-width: 575.98px) {
  .tsc-tile--promo { height: 150px !important; }
}

/* ------------------------------------------------------------------
   GENERIC CONTENT
   ------------------------------------------------------------------ */
/* Wide tables scroll inside themselves instead of stretching the page */
@media (max-width: 767.98px) {
  .table-responsive-auto { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tsc-main h1, main h1, .container > h1 { font-size: 1.5rem; }
}

/* ------------------------------------------------------------------
   CART — rows become cards on phones
   ------------------------------------------------------------------ */
@media (max-width: 767.98px) {
  .tsc-cart-table thead { display: none; }
  .tsc-cart-table, .tsc-cart-table tbody { display: block; }
  .tsc-cart-table tr {
    display: grid;
    grid-template-columns: 80px 1fr;
    column-gap: .75rem;
    padding: .75rem 0;
    border-bottom: 1px solid #dee2e6;
  }
  .tsc-cart-table td { display: block; border: 0; padding: .15rem 0; width: auto !important; background: transparent; box-shadow: none; }
  .tsc-cart-table td.tsc-ct-img { grid-row: 1 / span 5; }
  .tsc-cart-table td[data-label] { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
  .tsc-cart-table td[data-label]::before {
    content: attr(data-label);
    font-size: .8rem;
    font-weight: 600;
    color: #6b7280;
  }
  .tsc-cart-table td[data-label="Qty"] { flex-wrap: wrap; }
  .tsc-cart-table td[data-label="Qty"] input { width: 90px; }
  .tsc-cart-table td[data-label="Qty"] .small { width: 100%; text-align: right; margin-top: 0 !important; }
  .tsc-cart-table td.tsc-ct-remove { text-align: right; }
}

/* ------------------------------------------------------------------
   ADMIN (header_admin.php also loads this file)
   ------------------------------------------------------------------ */
@media (max-width: 767.98px) {
  .tsc-admin-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
