/* ════════════════════════════════════════════════════════════
   SAHA — Mobile & Shop-All Consistency Fixes
   Path: /wp-content/themes/saha-marketplace/assets/saha-mobile-fixes.css
   Load LAST (after saha-wp.css, saha-fixes.css, saha-critical-fixes.css)
════════════════════════════════════════════════════════════ */

/* ───────────────────────────────────────────────────────────
   FIX 1: Announcement bar — force single row, scrollable if tight
   Root cause: no width control on the flex items + no wrap rules
─────────────────────────────────────────────────────────────── */
.announcement-bar .container {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: none !important;
  white-space: nowrap !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
}
.announcement-bar .container::-webkit-scrollbar { display: none !important; }

.announcement-bar .container span,
.announcement-bar .container a,
.announcement-bar .container strong {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

@media (max-width: 640px) {
  .announcement-bar .container {
    font-size: 12px !important;
    min-height: 34px !important;
    justify-content: center !important;
  }
}

/* ───────────────────────────────────────────────────────────
   FIX 2: Logo distortion (header + mobile drawer)
   Root cause: .mobile-nav-drawer__logo has zero CSS rules,
   so the <img> renders at its native pixel size and stretches
   inside the flex header row.
─────────────────────────────────────────────────────────────── */
.site-header__logo img,
.site-header__logo .saha-default-logo {
  height: var(--header-logo-height-desktop, 38px) !important;
  width: auto !important;
  max-width: var(--header-logo-max-width, 180px) !important;
  object-fit: contain !important;
  display: block !important;
}

.mobile-nav-drawer__logo,
.mobile-nav-drawer__header img {
  height: 28px !important;
  width: auto !important;
  max-width: 160px !important;
  object-fit: contain !important;
  display: block !important;
}

@media (max-width: 640px) {
  .site-header__logo img,
  .site-header__logo .saha-default-logo {
    height: var(--header-logo-height-mobile, 32px) !important;
    max-width: 150px !important;
  }
}

/* ───────────────────────────────────────────────────────────
   FIX 3: Shop All filter — kill the overlay/stacking conflict
   Root cause: two competing sidebar systems. We standardize on
   the "card" sidebar style (.sidebar__head / .sidebar__section)
   and force the OLD plain .sidebar__title system to behave the
   same way, so whichever markup is present renders consistently
   as a clean slide-in drawer — matching New Arrivals' "Filters"
   bar trigger.
─────────────────────────────────────────────────────────────── */

/* Always start hidden off-canvas on mobile/tablet, never inline */
@media (max-width: 1024px) {
  .collection-layout {
    display: block !important;
  }

  .collection-layout aside.sidebar,
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    transform: translateX(-100%) !important;
    width: min(320px, 86vw) !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow-y: auto !important;
    background: #fff !important;
    z-index: 100001 !important;
    transition: transform 0.3s cubic-bezier(.4,0,.2,1) !important;
    box-shadow: 6px 0 32px rgba(0,0,0,.18) !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding-top: 56px !important;
  }

  body.saha-filter-open .collection-layout aside.sidebar,
  body.saha-filter-open .sidebar {
    transform: translateX(0) !important;
  }

  /* Backdrop */
  body.saha-filter-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(10,22,40,.5);
    z-index: 100000;
  }

  /* Visible close (X) button injected at top of sidebar via JS,
     but make sure ANY existing close control is visible/clickable */
  .sidebar .saha-mobile-filter-close,
  .sidebar__close {
    display: flex !important;
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 50%;
    border: none;
    font-size: 18px;
    cursor: pointer;
    z-index: 5;
  }

  /* Product grid: always full width, never squeezed by a
     sidebar that's supposed to be off-canvas */
  .collection-layout > div:not(.sidebar),
  .collection-layout .collection-main {
    width: 100% !important;
    margin-left: 0 !important;
  }
}

@media (min-width: 1025px) {
  /* Desktop: normal two-column grid restored */
  .collection-layout {
    display: grid !important;
    grid-template-columns: 280px minmax(0, 1fr) !important;
    gap: 32px !important;
  }
  .collection-layout aside.sidebar,
  .sidebar {
    position: sticky !important;
    top: 86px !important;
    transform: none !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    box-shadow: 0 14px 34px rgba(10,22,40,.06) !important;
    border: 1px solid #e4e7ec !important;
    border-radius: 8px !important;
  }
}

/* Mobile trigger button — reuse the same "Filters / Sort & refine"
   pill that New Arrivals already uses, for ANY archive page */
.saha-mobile-filter-btn {
  display: none;
}
@media (max-width: 1024px) {
  .saha-mobile-filter-btn {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 20px;
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 16px;
    margin-bottom: 16px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    color: var(--c-primary, #0a1628);
    box-shadow: 0 1px 6px rgba(0,0,0,.05);
  }
  .saha-mobile-filter-btn span {
    opacity: .55;
    font-weight: 500;
    font-size: 13px;
  }
}

/* ───────────────────────────────────────────────────────────
   FIX 4: Shop All hero typography — match New Arrivals exactly
   Root cause: .collection-hero h1 had different font rules than
   .saha-archive-hero h1, so Shop All looked visually inconsistent.
─────────────────────────────────────────────────────────────── */
.collection-hero {
  padding: clamp(58px, 8vw, 96px) 0 clamp(34px, 5vw, 56px) !important;
  background:
    radial-gradient(circle at 84% 20%, rgba(27,111,255,.14), transparent 28%),
    linear-gradient(135deg, #f8fbff 0%, #fff 58%, #eef5ff 100%) !important;
}

.collection-hero .section-header__eyebrow {
  margin-bottom: 12px !important;
  color: var(--c-accent, #1b6fff) !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
  letter-spacing: .16em !important;
}

.collection-hero h1,
.collection-hero .section-header__title {
  margin: 0 !important;
  color: var(--c-primary, #0a1628) !important;
  font-family: var(--font-heading, 'Syne', sans-serif) !important;
  font-size: clamp(42px, 7vw, 86px) !important;
  font-weight: 800 !important;
  line-height: .95 !important;
  letter-spacing: -0.5px !important;
}

.collection-hero__desc {
  max-width: 620px !important;
  margin: 16px 0 0 !important;
  color: #64748b !important;
  font-size: 17px !important;
  line-height: 1.65 !important;
}

/* Result count + ordering: match New Arrivals' "Sort & refine" feel */
.filter-bar {
  align-items: center !important;
}

@media (max-width: 1024px) {
  .filter-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
  }
  .filter-bar .hide-mobile {
    display: none !important;
  }
}