/* ===== Frontend Responsive ===== */

/* --- Desktop Overrides (fix original CSS that applies mobile styles globally) --- */
.header-nav { display: flex !important; }
.mobile-menu-btn { display: none !important; }
.bottom-nav { display: none !important; }
.search-toggle { display: none !important; }
body { padding-bottom: 0 !important; }

/* --- Header alignment fixes --- */

/* --- Tablet (≤1024px) --- */
@media (max-width: 1024px) {
  .container { padding: 0 16px; }
  .header-nav .nav-links { gap: 8px; }
  .header-nav .nav-links > li > a { font-size: 0.82rem; padding: 8px 10px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .cat-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
}

/* --- Mobile (≤768px) --- */
@media (max-width: 768px) {
  .container { padding: 0 12px; }

  /* Header navigation — hidden by default, toggled via .mobile-show */
  .header-nav {
    display: none !important;
  }
  .header-nav.mobile-show {
    display: block !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--primary-light);
    z-index: 200;
    border: none;
  }
  .header-nav.mobile-show .nav-links {
    flex-direction: column;
  }
  .header-nav.mobile-show .mega-menu {
    position: static;
    min-width: auto;
    box-shadow: none;
  }

  /* Mobile menu button */
  .mobile-menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
    color: var(--text);
    background: none;
    border: none;
    cursor: pointer;
  }

  /* Search */
  .search-toggle {
    display: flex !important;
  }
  .search-bar {
    display: none !important;
  }
  .search-bar.mobile-show {
    display: flex !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 12px;
    background: var(--primary-light);
    z-index: 200;
    max-width: none;
  }

  /* Header */
  .header-top { display: none !important; }
  .header-main .container { padding: 8px 12px; }
  .logo-text { font-size: 1.2rem; }
  .logo-sub { display: none; }
  .header-action { width: 36px; height: 36px; font-size: 1rem; }
  .header-actions { gap: 4px; }

  /* Hero */
  .hero-slider { height: 45vh; min-height: 280px; }
  .carousel-slide { padding: 20px 16px; }
  .carousel-content h1 { font-size: 1.3rem; }
  .carousel-content p { font-size: 0.8rem; }
  .carousel-img-wrap { height: 120px; }
  .carousel-icon { font-size: 2rem; min-width: 40px; }
  .hero-dots { bottom: 10px; }
  .hero-dot { width: 6px; height: 6px; }

  /* Product Grid */
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  /* Product Cards */
  .product-card .card-img { height: 110px; }
  .product-card .card-body { padding: 10px; }
  .product-card .card-title { font-size: 0.8rem; }
  .product-card .card-desc { font-size: 0.7rem; }
  .product-card .card-price .current { font-size: 0.9rem; }
  .product-card .btn-sm { padding: 6px 10px; font-size: 0.7rem; }
  .product-card .card-icon-badge { width: 24px; height: 24px; font-size: 0.7rem; }

  /* Categories Grid */
  .cat-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .cat-card { padding: 10px 6px; }
  .cat-card .icon { font-size: 1.3rem; }
  .cat-card h4 { font-size: 0.7rem; }

  /* Menu Section */
  .menu-category-section { padding: 12px; margin-bottom: 12px; }
  .menu-category-section .product-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .menu-category-header { flex-wrap: wrap; gap: 6px; }
  .menu-cat-icon { font-size: 1.2rem; }
  .menu-category-header h3 { font-size: 0.85rem; }
  .menu-cat-count { font-size: 0.65rem; padding: 2px 8px; }
  .menu-item h3 { font-size: 0.85rem; }
  .menu-item .card-desc { font-size: 0.7rem; }
  .menu-item .card-price .current { font-size: 0.9rem; }
  .menu-item .btn-sm { padding: 6px 10px; font-size: 0.7rem; }

  /* Detail Page */
  .detail-grid { grid-template-columns: 1fr; gap: 24px; }
  .detail-gallery { position: static; }
  .detail-main-image { max-height: 32vh; border-radius: var(--radius); }
  .detail-info h1 { font-size: 1.3rem; }
  .detail-pricing .price { font-size: 1.6rem; }
  .detail-trust { grid-template-columns: repeat(2, 1fr); }

  /* Cart Sidebar */
  .cart-sidebar { width: 100%; max-width: 100%; border-radius: 0; }
  .cart-items { max-height: calc(100vh - 260px); }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr; gap: 20px; text-align: center; }
  .footer-brand .social-links { justify-content: center; }
  .footer-bottom { font-size: 0.75rem; }

  /* Bottom Nav */
  .bottom-nav {
    display: flex !important;
  }
  body {
    padding-bottom: 64px !important;
  }

  /* Modal */
  .modal { width: 95%; margin: 20px auto; padding: 20px; }
  .quick-view-modal { width: 95%; }

  /* Search results */
  .search-results { position: fixed; top: 110px; left: 12px; right: 12px; max-height: 50vh; }
}

/* --- Small Mobile (≤480px) --- */
@media (max-width: 480px) {
  .container { padding: 0 8px; }
  .hero-slider { height: 38vh; min-height: 220px; }
  .carousel-slide { padding: 16px 12px; }
  .carousel-content h1 { font-size: 1.1rem; }
  .carousel-content p { font-size: 0.75rem; }
  .carousel-img-wrap { height: 100px; }
  .carousel-icon { font-size: 1.6rem; min-width: 32px; }
  .hero-dots { bottom: 8px; }

  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .product-card .card-img { height: 90px; }
  .product-card .card-body { padding: 8px; }
  .product-card .card-title { font-size: 0.75rem; }
  .product-card .card-desc { font-size: 0.65rem; }
  .product-card .card-price .current { font-size: 0.85rem; }

  .cat-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .cat-card { padding: 8px 4px; }
  .cat-card .icon { font-size: 1.1rem; }
  .cat-card h4 { font-size: 0.65rem; }
  .menu-category-section { padding: 8px; margin-bottom: 10px; }

  .detail-grid { grid-template-columns: 1fr; gap: 16px; }
  .detail-main-image { max-height: 28vh; }
  .detail-info h1 { font-size: 1.1rem; }
  .detail-pricing .price { font-size: 1.4rem; }
  .detail-trust { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .detail-trust-item .icon { font-size: 1.4rem; }
  .detail-trust-item span { font-size: 0.7rem; }

  .preloader-logo { font-size: 1.5rem; }
  .preloader-bar { width: 150px; }
  .footer { padding: 32px 0 80px; }
  .footer-grid { gap: 16px; }
}
