/* =====================================================
   ZANDO WEB — responsive.css
   Full responsive system: mobile-first, desktop max-width
   ===================================================== */

/* ── Desktop Container Centering ────────────────────── */
@media (min-width: 1025px) {
  .page-content-inner {
    padding: 0;
  }

  .main-area {
    padding: var(--space-6) var(--space-8);
  }

  /* Desktop: wider sidebar */
  .sidebar {
    width: var(--sidebar-width);
  }

  /* Desktop: 5-column product grid */
  .products-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  /* Desktop: larger hero */
  .carousel {
    border-radius: 0;
  }

  /* Desktop: search takes max 560px */
  .header-search {
    max-width: 560px;
  }
}

/* ── Large Desktop (≥1400px) ─────────────────────────── */
@media (min-width: 1400px) {
  .products-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* ── Medium Desktop (993px – 1200px) ─────────────────── */
@media (min-width: 993px) and (max-width: 1200px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ── Tablet & below (≤992px) ─────────────────────────── */
@media (max-width: 992px) {
  :root {
    --header-height: 64px;
    --nav-height: 44px;
    --sidebar-width: 220px;
  }

  .sidebar {
    display: none;
  }

  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
  }

  /* Product detail */
  .product-detail-layout {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .product-detail-name {
    font-size: 1.5rem !important;
    font-weight: 700;
  }

  .product-detail-price {
    font-size: 2rem !important;
  }

  .product-main-image {
    border-radius: 0 !important;
    background: #ffffff !important;
  }

  .product-main-image img {
    object-fit: contain !important;
  }

  /* Sticky Action Footer at bottom */
  .product-detail-actions {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: #ffffff !important;
    padding: 0.75rem 1rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08) !important;
    border-top: 1px solid #EFEFEF !important;
    z-index: 1000 !important;
    margin: 0 !important;
  }

  .product-detail-actions .wishlist-btn {
    border: none !important;
    background: transparent !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .product-detail-actions .wishlist-btn .material-icons-round {
    font-size: 1.75rem !important;
    color: #000000 !important;
  }

  .product-detail-actions .btn {
    height: 46px !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 0.875rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-transform: uppercase !important;
    padding: 0 var(--space-4) !important;
  }

  .product-detail-actions #detail-add-cart-btn {
    background: #ffffff !important;
    color: #2E062B !important;
    border: 1.5px solid #2E062B !important;
  }

  .product-detail-actions #detail-buy-now-btn {
    background: #2E062B !important;
    color: #ffffff !important;
    border: none !important;
  }

  /* Header styling for mobile product page */
  .product-detail-header {
    background: #ffffff !important;
    border-bottom: 1px solid #EFEFEF !important;
    box-shadow: none !important;
  }

  .product-detail-header .icon-btn {
    color: #2E062B !important;
  }

  .product-detail-gallery {
    position: static;
  }

  .cart-layout {
    grid-template-columns: 1fr;
    max-width: 680px;
    margin: 0 auto;
  }

  .cart-order-summary {
    position: static;
  }

  /* Admin layout */
  .admin-layout {
    max-width: 100%;
  }
}

/* ── Mobile (≤768px) ─────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --header-height: 60px;
    --nav-height: 42px;
  }

  /* Header */
  .header-top {
    padding: 0.75rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
  }

  .header-logo {
    order: 1;
  }

  .header-actions {
    order: 2;
    display: flex;
    align-items: center;
    gap: 0;
  }

  /* Hide cart, profile and track orders from top header on mobile */
  #cart-header-btn,
  #orders-header-btn,
  #profile-header-btn {
    display: none !important;
  }

  .header-search {
    order: 3;
    flex: 0 0 100%;
    max-width: 100%;
    margin-top: 0.75rem;
  }

  .header-search-inner {
    height: 44px;
    border-radius: 8px;
  }

  .header-search-btn {
    width: 46px;
    height: 44px;
    background: #FFFF00 !important;
  }

  .header-search-btn .material-icons-round {
    color: #000000 !important;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }

  .icon-btn .material-icons-round {
    font-size: 1.35rem;
  }

  /* Category nav */
  .category-nav-inner {
    padding: 0 0.875rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .category-nav-inner::-webkit-scrollbar {
    display: none;
  }

  .category-nav {
    display: none !important;
  }

  .all-categories-btn-wrapper {
    display: none !important;
  }

  /* Main area */
  .main-area {
    padding: var(--space-3) var(--space-3) calc(var(--space-3) + 70px);
  }

  /* Products grid */
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
  }

  /* Hero carousel — taller on mobile */
  .home-hero {
    margin-bottom: var(--space-4);
  }
  .carousel {
    border-radius: 0;
  }

  /* Track orders card */
  .track-orders-card {
    padding: var(--space-4) var(--space-4);
    margin-bottom: var(--space-4);
  }

  .track-orders-icon {
    width: 44px;
    height: 44px;
  }

  .track-orders-icon .material-icons-round {
    font-size: 1.4rem;
  }

  .track-orders-title {
    font-size: var(--text-base);
  }

  .track-orders-sub {
    font-size: var(--text-xs);
  }

  /* Product cards — overlay layout on mobile matching screenshot */
  .product-card {
    position: relative;
    border: none !important;
    border-radius: var(--radius-lg) !important;
    overflow: hidden !important;
    aspect-ratio: 1 / 1.05;
    background: transparent;
  }

  .product-card-image-wrap {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: auto !important;
  }

  .product-card-body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 70%, transparent 100%) !important;
    padding: 0.625rem 0.75rem !important;
    display: flex;
    flex-direction: column;
    gap: 2px !important;
    z-index: 2;
  }

  .product-card-name {
    color: white !important;
    font-size: var(--text-sm) !important;
    font-weight: 700 !important;
    -webkit-line-clamp: 1 !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  }

  .product-card-price {
    color: #FFFF00 !important; /* Yellow price as in the image! */
    font-size: var(--text-sm) !important;
    font-weight: 700 !important;
    font-family: var(--font-display) !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  }

  /* Hide wishlist, add-to-cart, rating, and shop on mobile to match the image precisely */
  .product-card-wishlist,
  .product-card-add-btn,
  .product-card-rating,
  .product-card-shop,
  .product-card-badge {
    display: none !important;
  }

  /* Cart */
  .cart-layout {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .cart-item {
    padding: var(--space-3) var(--space-3);
    gap: var(--space-3);
  }

  .cart-item-img {
    width: 52px;
    height: 52px;
  }

  .cart-item-actions {
    gap: var(--space-1);
  }

  .qty-btn {
    width: 24px;
    height: 24px;
    font-size: var(--text-sm);
  }

  /* Auth pages */
  .auth-logo {
    font-size: 2.75rem;
  }

  .auth-card {
    max-width: 100%;
    padding: 0 var(--space-2);
  }

  .auth-page {
    padding: var(--space-8) var(--space-4);
    align-items: flex-start;
    padding-top: 10vh;
  }

  /* Product detail */
  .product-detail-layout {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }

  .product-detail-name {
    font-size: var(--text-2xl);
  }

  .product-detail-price {
    font-size: 2rem;
  }

  .product-main-image {
    border-radius: var(--radius-lg);
  }

  /* Order history */
  .order-history-page {
    max-width: 100%;
  }

  .order-history-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  /* Profile */
  .profile-page {
    max-width: 100%;
  }

  .profile-actions {
    padding: 0 var(--space-4) var(--space-6);
  }

  /* Notifications */
  .notifications-page {
    max-width: 100%;
  }

  /* Toast — centered bottom on mobile */
  .toast-container {
    right: var(--space-3);
    left: var(--space-3);
    bottom: calc(70px + var(--space-3)); /* Above bottom nav */
    align-items: stretch;
  }

  .toast {
    min-width: 0;
    max-width: 100%;
  }

  /* Modal — full screen on mobile */
  .modal-box {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .modal-overlay:not(.bottom-sheet) {
    align-items: flex-end;
    padding: 0;
  }

  .modal-overlay:not(.bottom-sheet) .modal-box {
    animation: slideUp 0.3s ease;
  }

  /* Tabs — horizontal scroll */
  .tabs {
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }

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

  .tab-item {
    padding: var(--space-3) var(--space-4);
    white-space: nowrap;
  }

  /* Admin panel */
  .admin-product-row {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .admin-product-info {
    min-width: 0;
    flex: 1 1 60%;
  }

  /* Carousel arrows — smaller on mobile */
  .carousel-arrow {
    width: 32px;
    height: 32px;
  }

  .carousel-arrow .material-icons-round {
    font-size: 1rem;
  }

  /* Sections title */
  .products-section-title {
    font-size: var(--text-base);
    margin-bottom: var(--space-3);
  }

  /* Page content spacing */
  .page-content-inner {
    min-height: calc(100vh - var(--header-height) - var(--nav-height) - 70px);
  }

  /* Header logo text */
  .header-logo-text {
    font-size: 1.4rem;
  }

  /* Cart order summary — sticky at bottom on mobile */
  .cart-order-summary {
    position: sticky;
    bottom: 70px; /* Above bottom nav */
  }

  /* payment methods — scroll */
  .payment-methods {
    flex-wrap: nowrap;
  }

  /* Ensure bottom-sheet modals (like checkout) have enough bottom padding to not be hidden by mobile keyboard or browser chrome */
  .modal-overlay.bottom-sheet .modal-box {
    padding-bottom: calc(3rem + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ── Small Mobile (≤480px) ─────────────────────────── */
@media (max-width: 480px) {
  :root {
    --header-height: 56px;
  }

  .header-logo-text {
    font-size: 1.25rem;
  }

  .header-logo-icon {
    width: 24px;
    height: 24px;
  }

  .header-search-input {
    font-size: var(--text-xs);
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
  }

  .auth-logo {
    font-size: 2.5rem;
  }

  /* Make product cards more compact */
  .product-card-body {
    padding: 0.5rem 0.625rem;
  }

  .product-card-name {
    font-size: 0.7rem;
  }

  .product-card-price {
    font-size: var(--text-sm);
  }

  .track-orders-card {
    gap: var(--space-3);
  }

  .main-area {
    padding: var(--space-2) var(--space-2) calc(var(--space-2) + 70px);
  }

  /* Carousel text */
  .carousel-caption h3 {
    font-size: var(--text-lg);
  }



  /* Carousel dots */
  .carousel-dot {
    width: 6px;
    height: 6px;
  }

  .carousel-dot.active {
    width: 18px;
  }
}

/* ── Very Small Mobile (≤360px) ─────────────────────── */
@media (max-width: 360px) {
  .header-top {
    padding: 0.375rem 0.625rem;
    gap: var(--space-1);
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .icon-btn .material-icons-round {
    font-size: 1.2rem;
  }

  .products-grid {
    gap: var(--space-1);
  }
}

/* ── Bottom Navigation Bar (mobile only) ──────────────── */
.bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #EFEFEF; /* Light grey bottom nav matching image */
    border-top: 1px solid #DCDCDC;
    z-index: var(--z-sticky);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    align-items: center;
    justify-content: space-around;
    padding: 0 var(--space-2);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    background: transparent;
    flex: 1;
    position: relative;
    color: #6E6E6E; /* Grey color for inactive icons */
    min-height: 48px;
  }

  .bottom-nav-item .material-icons-round {
    font-size: 1.625rem;
  }

  .bottom-nav-item.active {
    color: #000000; /* Black active icon */
  }

  .bottom-nav-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
    min-width: 16px;
    height: 16px;
    background: var(--color-accent);
    color: #000;
    font-size: 9px;
    font-weight: 700;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
  }

  /* Push page content above bottom nav */
  .app-layout {
    padding-bottom: 64px;
  }
}

/* ── Desktop: ensure no bottom-nav padding ─────────────── */
@media (min-width: 769px) {
  .app-layout {
    padding-bottom: 0;
  }

  /* Desktop: ensure header search is visible */
  .header-search {
    display: block;
  }
}

/* ── Print / Utility ─────────────────────────────────── */
@media print {
  .site-header,
  .bottom-nav,
  .toast-container {
    display: none !important;
  }
}

/* ── Safe area insets (notch/home-indicator support) ──── */
@supports (padding: max(0px)) {
  .bottom-nav {
    padding-bottom: max(env(safe-area-inset-bottom), 0px);
    height: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  .main-area {
    padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px) + 70px);
  }
}

/* ── Landscape mobile adjustments ────────────────────── */
@media (max-width: 768px) and (orientation: landscape) {


  .auth-page {
    padding-top: var(--space-6);
  }

  .bottom-nav {
    height: 52px;
  }
}

/* ── Desktop specific polish ─────────────────────────── */
@media (min-width: 769px) {
  /* Hover effects only on non-touch devices */
  .product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
  }

  .track-orders-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }

  /* Wider admin table columns on desktop */
  .admin-product-row {
    flex-wrap: nowrap;
  }

  /* Prevent text from being too wide on very large screens */
  .page-content-inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
  }
}
