/* ==========================================================================
   Nobo Deal — Storefront Mobile Polish (nd-mobile.css)
   --------------------------------------------------------------------------
   Centralized, ADDITIVE mobile-only overrides for the whole storefront.
   Every rule lives inside a media query so desktop is never affected.

   Breakpoints used (match the rest of the theme):
     991.98px — small laptop / large tablet
     767.98px — tablet → phone landscape
     575.98px — phones
     400px    — very narrow phones (360px devices)

   !important is used only where page-level <style> blocks (injected after
   this stylesheet) or nd-modern.css use it, so these fixes actually win.
   ========================================================================== */


/* ==========================================================================
   1. Mobile bottom navigation (desktop safety)
   The `.bottom-navigation` block is mobile-only chrome (see
   components/storefrontshell.jsx). It has no base CSS anywhere, so we hide
   it on desktop and give it a proper fixed treatment inside the mobile block.
   ========================================================================== */
@media (min-width: 768px) {
  .bottom-navigation { display: none !important; }
}

/* ==========================================================================
   1b. Mobile fixed Buy Now / Add to Cart bar (product detail page)
   Pinned above the bottom navigation so purchase actions never scroll away.
   ========================================================================== */
@media (min-width: 768px) {
  .nd-mobile-buybar { display: none !important; }
}

.nd-mobile-buybar {
  display: none;
  position: fixed;
  left: 0; right: 0;
  /* Bottom nav is ~60px tall (58px min-height + borders); keep a 2px gap so
     the two fixed bars never overlap. */
  bottom: calc(62px + env(safe-area-inset-bottom));
  z-index: 9990;
  background: rgba(255,255,255,.98);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid rgba(201,162,75,.35);
  box-shadow: 0 -10px 26px rgba(5,45,35,.16);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
}

.nd-mobile-buybar-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
}

.nd-mobile-buybar-qty {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  background: var(--nd-cream, #faf6ec);
  border: 1.5px solid rgba(201,162,75,.55);
  border-radius: 30px;
  padding: 3px;
}

.nd-mobile-buybar-qty .nd-mbb-btn {
  width: 40px; height: 40px;
  border: 0; border-radius: 50%;
  background: var(--nd-emerald-grad, linear-gradient(135deg,#0e6b54,#073b2e));
  color: var(--nd-gold-bright, #e9c86f);
  font-size: 17px; font-weight: 800; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.nd-mobile-buybar-qty .nd-mbb-btn:active { transform: scale(.92); }

.nd-mobile-buybar-qty .nd-mbb-qty {
  min-width: 30px;
  text-align: center;
  font-weight: 800;
  font-size: 15px;
  color: var(--nd-emerald-deep, #052d23);
}

.nd-mobile-buybar .nd-mbb-cart,
.nd-mobile-buybar .nd-mbb-buy {
  flex: 1 1 0;
  min-width: 0;
  border: 0;
  border-radius: 30px;
  min-height: 42px;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: .2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: transform .15s ease, box-shadow .2s ease;
}

.nd-mobile-buybar .nd-mbb-cart {
  background: transparent;
  color: #0E3B2E;
  border: 2px solid #0E3B2E;
  box-shadow: 0 6px 14px rgba(14,59,46,.18);
}

.nd-mobile-buybar .nd-mbb-cart:hover { background: rgba(14,59,46,.08); }

.nd-mobile-buybar .nd-mbb-buy {
  background: #0E3B2E;
  color: #fff;
  border: 0;
  box-shadow: 0 6px 14px rgba(14,59,46,.4);
}

.nd-mobile-buybar .nd-mbb-buy:hover { background: #155843; }

.nd-mobile-buybar .nd-mbb-cart:active,
.nd-mobile-buybar .nd-mbb-buy:active { transform: translateY(1px) scale(.98); }

@media (max-width: 767.98px) {
  .nd-mobile-buybar { display: block; animation: ndBuyBarIn .35s cubic-bezier(.22,.61,.36,1); }
  /* Keep page content clear of the fixed bar (bar height ~58px + bottom nav) */
  .product-detail-area,
  .related-products {
    padding-bottom: calc(118px + env(safe-area-inset-bottom)) !important;
  }
  /* Product pages: the support FAB (z 10000, bottom 76px) and back-to-top
     (bottom 74px) would sit inside the buybar band. Lift both above the bar
     so they stay tappable and never block the qty stepper / Buy Now button. */
  body:has(.nd-mobile-buybar) #nd-support { bottom: 128px; }
  body:has(.nd-mobile-buybar) #nd-back-top { bottom: 132px; }
}

@media (max-width: 575.98px) {
  .nd-mobile-buybar { padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); }
  .nd-mobile-buybar-inner { gap: 6px; }
  .nd-mobile-buybar .nd-mbb-cart,
  .nd-mobile-buybar .nd-mbb-buy { font-size: 12px; min-height: 42px; }
  .nd-mobile-buybar-qty .nd-mbb-btn { width: 38px; height: 38px; }
}

@keyframes ndBuyBarIn {
  from { transform: translateY(110%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .nd-mobile-buybar { animation: none !important; }
}


/* ==========================================================================
   2. Tablet (≤ 991.98px) — breadcrumbs, cards, forms, footer
   ========================================================================== */
@media (max-width: 991.98px) {
  /* ---- Breadcrumb: smaller title, wrap long names ---- */
  .breadcrumb-area { padding: 46px 0 42px; }
  .breadcrumb-content h2 { font-size: 26px; line-height: 1.3; overflow-wrap: anywhere; }
  .breadcrumb-content nav { font-size: 13px; flex-wrap: wrap; row-gap: 4px; }

  /* ---- Generic info card (track / wishlist / static pages) ---- */
  .nd-page-card { padding: 30px 26px; }

  /* ---- Checkout / Buy-Now panels ---- */
  .checkout-form-area { padding: 26px 22px; }
  .order-summary { padding: 24px 20px; }

  /* ---- Shop sidebar widgets ---- */
  .shop-sidebar .sidebar-widget { padding: 18px 16px; }
  .shop-sidebar .widget-title { font-size: 16px; }

  /* ---- Footer: tighten spacing ---- */
  .footer-top { padding: 48px 0 30px; }
  .footer-top h4 { font-size: 16px; margin-bottom: 18px; }

  /* ---- Auth (login/register) card ---- */
  .nd-auth-body { padding: 8px 26px 30px; }

  /* ---- Product gallery panel ---- */
  .product-gallery { padding: 14px; }
}


/* ==========================================================================
   3. Phones / small tablets (≤ 767.98px)
   ========================================================================== */
@media (max-width: 767.98px) {
  /* ---------- 3.0 Section rhythm (task 1.6) ----------
     Legacy responsive.css squeezed .section-padding to 26px on phones;
     bring it back into the 32–48px band. Cards/grids/buttons untouched. */
  .section-padding { padding: 32px 0; }

  /* ---------- 3.1 Bottom navigation (mobile-only chrome) ----------
     No base styles exist for this block anywhere in the theme, so the full
     fixed-tab-bar treatment lives here. */
  .bottom-navigation {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 9999;
    display: block;
    background: rgba(255,255,255,.97);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-top: 1px solid rgba(226,220,200,.85);
    box-shadow: 0 -8px 24px rgba(5,45,35,.14);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-navigation ul {
    display: flex;
    list-style: none; margin: 0; padding: 0;
  }
  .bottom-navigation ul li { flex: 1 1 0; min-width: 0; }
  .bottom-navigation ul li a {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    min-height: 58px;
    padding: 8px 4px;
    font-size: 11px; font-weight: 600;
    color: #5c6b64;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-navigation ul li a i { font-size: 20px; line-height: 1; color: inherit !important; }
  /* Every tab has the same resting colour.  The selected tab receives the
     familiar Shop-green treatment, rather than leaving Shop permanently
     highlighted or colouring Home/Cart/Login gold. */
  .bottom-navigation ul li a.active {
    color: var(--nd-emerald, #0b5c43) !important;
    background: linear-gradient(180deg, rgba(14,107,84,.11), rgba(14,107,84,0));
  }
  .bottom-navigation ul li a.active i,
  .bottom-navigation ul li a.active span { color: var(--nd-emerald, #0b5c43) !important; }
  /* A tap must not leave a square focus border around the nav item. */
  .bottom-navigation ul li a:focus,
  .bottom-navigation ul li a:focus-visible { outline: none !important; box-shadow: none !important; }
  .bottom-navigation .cart-badge {
    position: absolute; top: 4px; right: 18%;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 30px;
    background: linear-gradient(135deg, var(--nd-gold), var(--nd-gold-dark));
    color: #fff; font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 8px rgba(201,162,75,.55);
  }
  /* Reserve room so the fixed bar never covers footer / page content */
  footer.footer { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }

  /* ---------- 3.2 Header — tap targets & row fit ---------- */
  .nd-mobile-menu-toggle { width: 36px; min-height: 40px; }
  .nd-action-btn { min-width: 38px; min-height: 40px; }
  .nd-search button { width: 30px; height: 30px; }
  /* 16px inputs prevent iOS auto-zoom on focus; explicit heights keep the
     pill compact regardless of the 16px font */
  .nd-search input {
    font-size: 16px !important;
    height: 30px;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 1;
  }

  /* ---------- 3.3 Search suggestion dropdown (Dynamic Island) ----------
     Keep the popover inside the viewport and scrollable on small screens. */
  .nd-search { position: relative; }
  .nd-search .nd-suggest {
    position: absolute;
    top: calc(100% + 8px);
    left: 0; right: 0;
    z-index: 1200;
    max-height: min(60vh, 420px);
    overflow-y: auto;
    background: #fff;
    border: 1px solid rgba(201,162,75,.5);
    border-radius: 14px;
    box-shadow: 0 18px 44px rgba(5,45,35,.24);
  }
  .nd-search .nd-suggest ul { list-style: none; margin: 0; padding: 6px; }
  .nd-search .nd-suggest li a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 10px; text-decoration: none;
  }
  .nd-search .nd-suggest li a img {
    flex: 0 0 40px; width: 40px; height: 40px;
    object-fit: cover; border-radius: 8px; background: var(--nd-cream);
  }
  .nd-search .nd-suggest .nd-suggest-name {
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 13px; color: var(--nd-ink, #222831);
  }
  .nd-search .nd-suggest .nd-suggest-price {
    font-size: 12.5px; font-weight: 700; white-space: nowrap;
    color: var(--nd-gold-dark, #a8842f);
  }
  .nd-search .nd-suggest .nd-suggest-status {
    padding: 14px; font-size: 13px; text-align: center; color: var(--nd-muted, #6b7b73);
  }
  /* Mobile nav dropdowns must scroll instead of growing past the screen */
  #main-nav .dropdown, #main-nav .submenu {
    max-height: 60vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  }

  /* ---------- 3.4 Breadcrumb ---------- */
  .breadcrumb-area { padding: 42px 0 38px; }
  .breadcrumb-content h2 { font-size: 24px; }
  .breadcrumb-content nav { font-size: 12.5px; }

  /* ---------- 3.5 Generic info card ---------- */
  .nd-page-card { padding: 26px 18px; }
  .nd-page-card .page-title { font-size: 24px; }

  /* ---------- 3.6 Home hero ---------- */
  .nd-home .slider-content { padding: 26px 20px 24px; }
  .nd-home .slider-title { font-size: 24px; }
  .nd-home .slider-subtitle { font-size: 14px; line-height: 1.65; }
.nd-home .nd-hero-carousel, .nd-home .nd-hero-track { min-height: 240px; }
.nd-home .nd-hero-control { width: 40px; height: 40px; }

  /* ---------- 3.7 Product detail ---------- */
  .product-main-image img { min-height: 260px; }
  .product-details-content { padding: 22px 16px !important; }
  .product-detail-action .theme-btn,
  .product-detail-action .theme-btn + .theme-btn {
    min-height: 48px;
    padding: 12px 8px !important;
    font-size: 13px !important;
  }
  /* Qty stepper: 44px tap targets */
  .quantity-selector .qty-btn,
  .buy-page .quantity-selector .qty-btn { width: 44px; height: 44px; min-width: 44px; }
  .quantity-selector .qty-input { height: 44px !important; }
  .product-thumb { width: 68px; height: 68px; }

  /* ---------- 3.8 Combo detail: action row shares width ---------- */
  .nd-detail-action {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  }
  .nd-detail-action > .quantity-selector { flex: 0 0 100%; }
  .nd-detail-action > br { display: none; }
  .nd-detail-action > .theme-btn {
    flex: 1 1 0; min-width: 0; text-align: center;
    padding: 12px 8px !important; font-size: 13px !important; white-space: nowrap;
  }

  /* ---------- 3.9 Forms (login / register / checkout / buy / track) ---------- */
  .form-control:not(.qty-input):not(.form-check-input),
  .nd-input .form-control,
  .checkout-form-area .form-control,
  .buy-page .checkout-form-area .form-control {
    min-height: 46px;
    font-size: 16px !important; /* prevent iOS zoom */
    border-radius: 10px !important;
  }
  textarea.form-control { min-height: 96px; }
  .form-check-label, .checkout-form-area label, .buy-page .checkout-form-area label { font-size: 14.5px; }
  .checkout-form-area { padding: 24px 16px !important; }
  .buy-page .checkout-form-area { padding: 24px 16px !important; }
  .order-summary { padding: 22px 16px !important; }
  .checkout-form-area .theme-btn,
  .buy-page .checkout-form-area .theme-btn { min-height: 50px; font-size: 15px !important; white-space: normal; }

  /* Auth (login/register) */
  .nd-auth-body { padding: 8px 18px 28px !important; }
  .nd-auth-head { padding: 26px 16px 6px; }
  .nd-auth-card .theme-btn { width: 100%; min-height: 48px; }

  /* Track order button */
  .nd-page-card .theme-btn { min-height: 48px; }

  /* ---------- 3.10 Shop / collection / brand / search ---------- */
  .shop-topbar { padding: 12px 14px; }
  .shop-topbar p { font-size: 13px; }
  .shop-sidebar .sidebar-widget { padding: 16px 14px; }
  .collection-brands { padding: 12px 14px; }
  .brand-chip { padding: 8px 14px 8px 6px; }
  .brand-chip img { width: 30px; height: 30px; }

  /* ---------- 3.11 Footer ---------- */
  .footer-top { padding: 40px 0 26px; }
  .footer-top h4 { font-size: 15.5px; margin-bottom: 16px; }
  .footer-social a { width: 42px; height: 42px; }
  .footer-brand .footer-logo-chip img { height: 38px; }
  .footer-bottom { padding: 14px 12px calc(14px + env(safe-area-inset-bottom)); }
  .footer-bottom p { font-size: 12px; line-height: 1.6; }

  /* ---------- 3.12 FAQ ---------- */
  .faq-toggle.nd-faq-toggle {
    padding: 14px 16px;
    font-size: 15px;
    line-height: 1.5;
    white-space: normal;
    text-align: left;
    align-items: flex-start;
    gap: 10px;
  }

  /* ---------- 3.13 Support widget chat (send button tap target) ---------- */
  #nd-support .nd-ai-form button { width: 40px; height: 40px; flex-basis: 40px; }
  #nd-support .nd-ai-form input { min-height: 40px; font-size: 14px; }

  /* ---------- 3.14 Empty state ---------- */
  .nd-empty-state { padding: 44px 16px; }
}


/* ==========================================================================
   4. Phones (≤ 575.98px)
   ========================================================================== */
@media (max-width: 575.98px) {
  /* ---------- 4.1 Header row: give search real space ---------- */
  .nd-logo .site-logo { max-width: 104px; max-height: 36px; }
  .nd-actions { gap: 1px; }
  .nd-action-btn { min-width: 34px; padding: 5px 3px; }

  /* ---------- 4.2 Hero ---------- */
  .nd-home .slider-content { padding: 22px 16px 20px; border-radius: 110px 110px 16px 16px; }
  .nd-home .slider-title { font-size: 22px; }
  .nd-home .slider-subtitle { font-size: 13.5px; }
  .nd-home .nd-hero-carousel, .nd-home .nd-hero-track { min-height: 225px; }

  /* ---------- 4.3 Product detail ---------- */
  .product-gallery { padding: 10px !important; }
  .product-main-image img { min-height: 230px; }
  .product-detail-title { font-size: 20px !important; }
  .product-thumbs { gap: 8px; }
  .product-thumb { width: 62px; height: 62px; }

  /* ---------- 4.4 Pagination: drop the long text links, keep arrows+nums ---------- */
  .shop-pagination .page-item:nth-child(2),
  .shop-pagination .page-item:nth-last-child(2),
  .collection-pagination .page-item:nth-child(2),
  .collection-pagination .page-item:nth-last-child(2),
  .search-pagination .page-item:nth-child(2),
  .search-pagination .page-item:nth-last-child(2) { display: none; }
  .shop-pagination .pagination,
  .collection-pagination .pagination,
  .search-pagination .pagination { gap: 4px; }
  .shop-pagination .page-link,
  .collection-pagination .page-link,
  .search-pagination .page-link {
    min-width: 42px; height: 44px;
    padding: 0 8px;
    font-size: 13.5px;
  }
  .shop-pagination .page-item:not(:last-child),
  .collection-pagination .page-item:not(:last-child),
  .search-pagination .page-item:not(:last-child) { margin-right: 0; }

  /* ---------- 4.5 Receipt table: scroll inside the card ---------- */
  .receipt-box { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .receipt-box .table { min-width: 540px; }
  .receipt-box { padding: 20px 14px !important; }

  /* ---------- 4.6 Cards: keep price rows tidy on 2-col grids ---------- */
  .tp-product-card.style-6 .product-price { gap: 4px; }
  .tp-product-card.style-6 .save-label { padding: 1px 6px; }
  .nd-combo-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; }

  /* ---------- 4.7 Cart item rows (checkout / buy-now summary) ---------- */
  .cart-items-list .cart-item { padding: 12px 10px !important; }
  .cart-item-img { flex: 0 0 auto; }
  .cart-item-info h6 { font-size: 13px; line-height: 1.4; }
  .cart-item-info small { font-size: 11.5px; }

  /* ---------- 4.8 Trust strip ---------- */
  .nd-trust-item { padding: 10px 12px; }
  .nd-trust-text strong { font-size: 13.5px; }
  .nd-trust-text span { font-size: 11.5px; }

  /* ---------- 4.9 Section titles / ornaments ---------- */
  .nd-home .section-title { font-size: 18px; }
  .title-link { padding: 7px 14px; font-size: 12.5px; }

  /* ---------- 4.10 Shop sort on smallest phones ---------- */
  .shop-sort .form-control { font-size: 15px; min-height: 44px; }
}


/* ==========================================================================
   5. Very narrow phones (≤ 400px — 360px devices)
   ========================================================================== */
@media (max-width: 400px) {
  /* Account icon duplicates the bottom-nav Account tab; hiding it gives the
     search pill more room on 360px screens. */
  .nd-primary-account { display: none !important; }
  .nd-logo .site-logo { max-width: 92px; }
  .nd-mobile-menu-toggle { width: 32px; }
  .nd-action-btn { min-width: 32px; }

  /* One-line name clamp on cards so the 2-col grid stays even */
  .tp-product-card.style-6 .product-name a,
  .nd-home .tp-product-card .product-name a {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Keep the buy-now attention animation from overflowing the button */
  .product-detail-action .buy-now-btn { animation: none; }

  .nd-home .slider-title { font-size: 20px; }
  .nd-home .nd-hero-carousel, .nd-home .nd-hero-track { min-height: 200px; }
}

/* ===== Bottom nav (mobile): hover + active gold feedback ===== */
.bottom-navigation ul li a { transition: color .2s ease, transform .15s ease; }
.bottom-navigation ul li a:hover i,
.bottom-navigation ul li a:hover span,
.bottom-navigation ul li a:active i,
.bottom-navigation ul li a:active span {
  color: var(--nd-gold-dark, #b8860b) !important;
}
.bottom-navigation ul li a.active span { color: var(--nd-emerald, #0b5c43) !important; }
.bottom-navigation ul li a.active { transform: translateY(-1px); }

