/* ============================================================
   APP SHELL — Sky Original Group Store
   ------------------------------------------------------------
   Single source of truth for the "chrome" that surrounds every
   page inside the Android app (Capacitor WebView):

     • the sticky mobile header
     • the modern bottom navigation bar
     • the side drawers / bottom sheets (cart, wishlist, account,
       notifications)
     • the mobile search sheet
     • the z-index ladder
     • the safe-area (status bar / gesture bar) insets

   This file is loaded AFTER styles.css, components.css,
   ecommerce.css and shop.css so it always wins over the legacy
   rules of those files.

   WHY A SEPARATE FILE:
   the old bottom-nav rules were duplicated in three different
   places (styles.css x2 and an inline <style> inside
   layouts/partials/mobile-nav.blade.php) and every copy carried
   `display: flex !important` OUTSIDE a media query, which forced
   the bar to be visible on desktop and broke its dimensions.
   ============================================================ */

:root {
  /* ---------- Bottom navigation bar ---------- */
  /* Height of the bar WITHOUT the system gesture-bar inset. The real
     on-screen height is this value + --sg-safe-bottom. */
  --sg-bottom-nav-height: 60px;
  --sg-bottom-nav-icon-size: 22px;
  --sg-bottom-nav-label-size: 10px;

  /* Height of the sticky mobile header (content + status bar inset) */
  --sg-mobile-header-height: calc(52px + var(--sg-safe-top, 0px));

  /* ---------- Z-index ladder ---------- */
  /* One number per layer. The old code used 1000 / 1100 / 9998 /
     9999 / 10000 in five different files, which is why the bottom
     navigation bar used to float ON TOP of the cart drawer. */
  --sg-z-header: 1000;      /* sticky header */
  --sg-z-subheader: 990;    /* sticky sub bars (account tabs) */
  --sg-z-floating: 8500;     /* floating action buttons */
  --sg-z-bottom-nav: 9000;  /* bottom navigation bar */
  --sg-z-overlay: 10000;    /* dimmed backdrop of a drawer */
  --sg-z-drawer: 10010;     /* cart / wishlist / account drawer */
  --sg-z-drawer-max: 10050; /* upper bound of the dynamic boost */
  --sg-z-sheet: 10060;      /* notification bottom sheet */
  --sg-z-search: 10070;     /* mobile search overlay */
  --sg-z-toast: 10100;      /* toasts */
}

/* ============================================================
   MOBILE HEADER — keep the real status-bar inset OUT of the
   content box so the logo / search row is never squashed.
   ============================================================ */
@media (max-width: 768px) {
  .mobile-header {
    /* ecommerce.css sets `padding-top: calc(8px + var(--sg-safe-top))`
       but keeps `min-height: 52px`. With a 24px status bar the header
       was still only 52px tall while 40px of that was padding, so the
       28px logo overflowed its own box and overlapped the content. */
    min-height: calc(52px + var(--sg-safe-top, 0px)) !important;
  }
}

/* ============================================================
   BODY — reserve the exact space taken by the bottom nav
   ============================================================ */
body {
  padding-bottom: calc(var(--sg-bottom-nav-height, 60px) + var(--sg-safe-bottom, 0px));
}

@media (max-width: 992px) {
  body {
    padding-bottom: calc(var(--sg-bottom-nav-height, 60px) + var(--sg-safe-bottom, 0px) + 20px);
  }
}

/* ============================================================
   BOTTOM NAVIGATION BAR
   Material-3 inspired: 5 equal columns, icon pill + caption,
   hairline separator, blurred surface, safe-area aware.
   ============================================================ */
.mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--sg-z-bottom-nav);
  display: none;                 /* hidden by default — desktop */
  align-items: stretch;
  justify-content: center;
  width: 100%;
  padding: 0;
  /* Clear the Android gesture / navigation bar (edge-to-edge WebView) */
  padding-bottom: var(--sg-safe-bottom, 0px);
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid rgba(15, 23, 42, 0.07);
  box-shadow: 0 -1px 0 rgba(15, 23, 42, 0.04), 0 -10px 28px rgba(15, 23, 42, 0.06);
}

@media (max-width: 992px) {
  .mobile-bottom-nav {
    display: flex !important;
  }
}

@media (min-width: 993px) {
  .mobile-bottom-nav {
    display: none !important;
  }
}

.bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 5px 6px;
  height: var(--sg-bottom-nav-height, 60px);
}

.bnav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  height: 100%;
  min-height: 48px;
  padding: 3px 2px;
  border: 0;
  background: transparent;
  color: #8A94A6;
  font-family: inherit;
  font-size: var(--sg-bottom-nav-label-size, 10px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.18s ease;
}

.bnav-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 28px;
  border-radius: 14px;
  transition: background-color 0.18s ease, transform 0.12s ease;
}

.bnav-item i {
  font-size: var(--sg-bottom-nav-icon-size, 22px);
  line-height: 1;
}

.bnav-label {
  white-space: nowrap;
}

.bnav-item.active {
  color: var(--primary, #1677FF);
}

.bnav-item.active .bnav-icon {
  background: rgba(22, 119, 255, 0.10);
}

.bnav-item:active .bnav-icon {
  transform: scale(0.9);
}

.bnav-badge {
  position: absolute;
  top: -4px;
  right: 2px;
  display: none;                  /* toggled inline by the JS */
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border: 2px solid #fff;
  border-radius: 9px;
  background: #FF4D4F;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

/* Small phones — keep the bar compact but never below 56px */
@media (max-width: 400px) {
  .bottom-nav-inner {
    padding: 4px 2px;
  }
  .bnav-icon {
    width: 42px;
    height: 26px;
  }
  .bnav-item i {
    font-size: 20px;
  }
}

/* ============================================================
   DRAWERS — cart / wishlist / account / notifications
   They must never start under the status bar nor end under the
   gesture bar, and they must always sit above the bottom nav.
   ============================================================ */
.cart-drawer,
.account-drawer,
.wishlist-drawer {
  box-sizing: border-box;
  /* !important is required: cart-drawer.blade.php / wishlist-drawer.blade.php /
     account-drawer.blade.php each ship an inline <style> block inside <body>
     with their own legacy `z-index: 1100/1101`. A <style> tag in the body is
     parsed after this file, so without !important it would win and the bottom
     navigation bar would paint on top of the open drawer. */
  z-index: var(--sg-z-drawer) !important;
}

/* Side panels that span the full screen height respect the insets. */
@media (min-width: 992px) {
  .cart-drawer,
  .account-drawer,
  .wishlist-drawer {
    height: 100%;
    padding-top: var(--sg-safe-top, 0px);
    padding-bottom: var(--sg-safe-bottom, 0px);
  }
}

/* Mobile: account = full-height panel, cart/wishlist = bottom sheets.
   A sheet's top edge is mid-screen (no status-bar inset needed) and its
   footer / last rows carry the gesture-bar inset instead. */
@media (max-width: 991px) {
  .account-drawer {
    height: 100dvh;
    padding-top: var(--sg-safe-top, 0px);
    padding-bottom: var(--sg-safe-bottom, 0px);
  }

  .cart-drawer,
  .wishlist-drawer {
    padding-top: 0;
    padding-bottom: 0;
  }

  .wishlist-drawer .wishlist-body {
    padding-bottom: calc(12px + var(--sg-safe-bottom, 0px));
  }


}

.cart-overlay,
.account-overlay,
.wishlist-overlay,
.notification-overlay {
  z-index: var(--sg-z-overlay) !important;
}

.notification-panel {
  box-sizing: border-box;
  z-index: var(--sg-z-sheet) !important;
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}

.notification-panel.active {
  visibility: visible;
  pointer-events: auto;
}

.notification-overlay {
  display: block !important;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.45) !important;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  transition: opacity 0.25s ease, visibility 0s linear 0.25s !important;
}

.notification-overlay.active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.25s ease, visibility 0s linear 0s !important;
}

/* Desktop: right side panel */
@media (min-width: 992px) {
  .notification-panel {
    top: 0;
    right: -400px;
    width: 400px;
    height: 100%;
    border-radius: 0;
    box-shadow: -8px 0 32px rgba(15, 23, 42, 0.18);
    transition: right 0.34s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s linear 0.34s;
  }

  .notification-panel.active {
    right: 0;
    transition: right 0.34s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s linear 0s;
  }

  .notification-panel .notification-footer {
    padding-bottom: calc(16px + var(--sg-safe-bottom, 0px));
  }
}

/* Phones & tablets: floating sheet above the bottom nav */
@media (max-width: 991px) {
  .notification-panel {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: calc(var(--sg-safe-bottom, 0px) + 8px);
    width: auto;
    height: auto;
    max-height: min(78dvh, 680px);
    padding: 0;
    border-radius: 24px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28), 0 2px 10px rgba(15, 23, 42, 0.08);
    transform: translateY(calc(100% + 24px));
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s linear 0.38s;
  }

  .notification-panel.active {
    top: auto;
    bottom: calc(var(--sg-safe-bottom, 0px) + 8px);
    height: auto;
    transform: translateY(0);
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s linear 0s;
  }

  .notification-panel::before {
    content: '';
    flex: 0 0 auto;
    width: 40px;
    height: 4px;
    margin: 8px auto 2px;
    border-radius: 999px;
    background: #d8dee9;
  }

  .notification-panel .notification-header {
    flex: 0 0 auto;
    padding: 6px 16px 12px;
    border-bottom: 1px solid #eef1f7;
    border-radius: 0;
    background: #fff;
  }

  .notification-panel .notification-back-btn {
    background: #f3f5f9;
  }

  .notification-panel .notification-tabs {
    flex: 0 0 auto;
    gap: 6px;
    padding: 8px 14px 12px;
    border-bottom: 1px solid #eef1f7;
    scrollbar-width: none;
  }

  .notification-panel .notification-tabs::-webkit-scrollbar {
    display: none;
  }

  .notification-panel .notification-tab {
    padding: 7px 14px;
    font-size: 0.82rem;
    background: #f3f5f9;
  }

  .notification-panel .notification-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0 8px;
  }

  .notification-panel .notification-footer {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid #eef1f7;
    background: #fafbfd;
    border-radius: 0;
    text-align: center;
  }

  .notification-panel .notification-footer a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 14px;
    background: #eff6ff;
    color: #1677ff;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
  }

  .notification-panel .notification-footer a:hover {
    background: #e2edff;
    text-decoration: none;
  }

  .notification-panel .notification-footer .mark-all-read-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 14px;
    background: #fff;
    border: 1px solid #e3e8f0;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
  }
}
/* ============================================================
   MOBILE SEARCH SHEET
   `env(safe-area-inset-*)` is forced to 0px by Capacitor's
   SystemBars plugin (insetsHandling: "css"), so the sheet has to
   use the injected variables instead.
   ============================================================ */
.mobile-search-overlay {
  z-index: var(--sg-z-search) !important;
}

.mobile-search-panel {
  padding-top: var(--sg-safe-top, 0px);
  padding-bottom: var(--sg-safe-bottom, 0px);
}

.mobile-search-panel-header {
  padding-top: calc(12px + var(--sg-safe-top, 0px));
}

/* ============================================================
   FLOATING ACTION BUTTONS
   Kept on the LEFT side so they never sit under the cart /
   notification / account panels (all of which open from the right
   or from the bottom on phones).
   ============================================================ */
.floating-actions {
  position: fixed;
  left: 16px;
  bottom: calc(var(--sg-bottom-nav-height, 60px) + var(--sg-safe-bottom, 0px) + 16px);
  z-index: var(--sg-z-floating);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

/* Any popup (drawer, sheet, modal, search) covers the page: the
   floating buttons must not float above it. */
body.sg-overlay-open .floating-actions {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px);
}

.floating-action-btn {
  width: 52px;
  height: 52px;
  border-radius: 17px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-search-btn {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  color: #fff;
}

.floating-search-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.4);
}

.floating-search-btn svg {
  width: 24px;
  height: 24px;
}

.floating-back-to-top {
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #374151;
  border: 1px solid rgba(0, 0, 0, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
}

.floating-back-to-top.show,
.floating-back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.floating-back-to-top:hover {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  transform: translateY(-4px);
}

.floating-back-to-top svg {
  width: 22px;
  height: 22px;
}

@media (min-width: 993px) {
  .floating-actions {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .floating-actions {
    left: 12px;
    bottom: calc(var(--sg-bottom-nav-height, 60px) + var(--sg-safe-bottom, 0px) + 12px);
    gap: 12px;
  }
  .floating-action-btn {
    width: 46px;
    height: 46px;
    border-radius: 15px;
  }
  .floating-search-btn svg,
  .floating-back-to-top svg {
    width: 20px;
    height: 20px;
  }
}

/* ============================================================
   TOASTS — always above everything
   ============================================================ */
.toast-container,
.guest-notification-toast {
  z-index: var(--sg-z-toast) !important;
}

/* While a full screen drawer is open the bottom bar is hidden, so the
   drawer footer is never covered by it. */
body.sg-overlay-open .mobile-bottom-nav {
  display: none !important;
}

/* ============================================================
   STICKY SUB BARS (account tabs) — must sit right below the
   sticky mobile header, never underneath it.
   ============================================================ */
@media (max-width: 992px) {
  .account-tab-bar {
    position: sticky;
    top: var(--sg-mobile-header-height);
    z-index: var(--sg-z-subheader);
  }
}

/* ============================================================
   SHOP FILTER DRAWER (<= 1199.98px)
   ------------------------------------------------------------
   A floating card that starts BELOW the status bar and ends
   ABOVE the bottom navigation, with a dimmed, blurred backdrop.
   Every critical property is !important so stylesheet order can
   never stack the legacy full-height sidebar back on top.
   ============================================================ */
@media (max-width: 1199.98px) {
  .shop-sidebar,
  #shopSidebar {
    position: fixed !important;
    top: calc(var(--sg-safe-top, 0px) + 12px) !important;
    bottom: calc(var(--sg-safe-bottom, 0px) + 12px) !important;
    left: 12px !important;
    right: auto !important;
    width: min(86vw, 360px) !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 24px !important;
    background: #fff !important;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28), 0 2px 10px rgba(15, 23, 42, 0.08) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transform: translateX(calc(-100% - 32px));
    visibility: hidden;
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s linear 0.38s;
    z-index: var(--sg-z-drawer) !important;
  }

  .shop-sidebar.active,
  #shopSidebar.active {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s linear 0s;
  }

  .shop-sidebar:not(.active),
  #shopSidebar:not(.active) {
    pointer-events: none;
  }

  .shop-sidebar .sidebar-header,
  #shopSidebar .sidebar-header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 16px 18px;
    background: #fff;
    border-bottom: 1px solid #eef1f7;
    border-radius: 24px 24px 0 0;
  }

  .shop-sidebar .sidebar-close,
  #shopSidebar .sidebar-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f3f5f9;
  }

  .sidebar-overlay {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    background: rgba(15, 23, 42, 0.45) !important;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    transition: opacity 0.25s ease, visibility 0s linear 0.25s !important;
    z-index: var(--sg-z-overlay) !important;
  }

  .sidebar-overlay.active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.25s ease, visibility 0s linear 0s !important;
  }
}

@media (max-width: 991.98px) {
  .shop-sidebar,
  #shopSidebar {
    bottom: calc(var(--sg-safe-bottom, 0px) + 12px) !important;
  }
}