/* ==========================================================================
   RASA - RESPONSIVE STYLES
   Ensures perfect layout on 320px, 375px, 414px, 768px, 1024px, 1366px, 1920px
   ========================================================================== */

/* Large Desktops (1440px and up) */
@media (min-width: 1440px) {
  :root {
    --container-max: 1380px;
  }
  .products-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Medium Desktops / Laptops (1024px to 1366px) */
@media (max-width: 1200px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

/* Tablets (768px to 1023px) */
@media (max-width: 1023px) {
  .header-main {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .search-container {
    order: 3;
    max-width: 100%;
    width: 100%;
  }
  .location-picker {
    display: flex;
  }
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
  .categories-grid {
    grid-template-columns: repeat(5, 1fr);
  }
  .hero-slider-wrap {
    aspect-ratio: 16 / 9;
  }
  .hero-slide {
    aspect-ratio: 16 / 9;
    height: 100%;
  }
  .hero-title {
    font-size: 1.6rem;
  }
  .tracker-steps {
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }
}

/* Mobile Devices (Under 768px) */
@media (max-width: 767px) {
  body {
    padding-bottom: 64px; /* Space for mobile bottom bar */
  }

  .top-bar {
    display: none;
  }

  .site-header {
    padding: 0.35rem 0 0.5rem;
  }

  .header-main {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
    padding: 0.35rem 0 !important;
  }

  .brand-logo {
    order: 1 !important;
    font-size: 1.25rem !important;
    flex-shrink: 0 !important;
  }
  .brand-icon-box {
    width: 32px !important;
    height: 32px !important;
    font-size: 1.1rem !important;
  }

  .location-picker {
    order: 2 !important;
    display: flex !important;
    align-items: center !important;
    padding: 0.25rem 0.5rem !important;
    gap: 0.35rem !important;
    max-width: 140px !important;
    min-width: 0 !important;
    flex-shrink: 1 !important;
  }
  .location-label {
    display: none !important; /* Hide DELIVER TO label to save space on mobile */
  }
  .location-val {
    max-width: 85px !important;
    font-size: 0.75rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .header-actions {
    order: 3 !important;
    margin-left: auto !important; /* Pushes Cart & Profile to the far right */
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    flex-shrink: 0 !important;
  }
  .wishlist-header-btn,
  .cart-header-btn {
    width: 38px !important;
    height: 38px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .heart-icon-svg,
  .cart-icon-svg {
    display: block !important;
    width: 19px !important;
    height: 19px !important;
  }

  /* Row 2: Search Bar Full Width */
  .search-container {
    order: 4 !important;
    width: 100% !important;
    flex: 0 0 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    margin-top: 0.35rem !important;
  }
  .search-box {
    width: 100% !important;
    padding: 0.4rem 0.75rem !important;
  }

  /* 2-Column Product Grid for Indian Mobile Apps */
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .product-card {
    padding: 0.65rem;
  }
  .product-title {
    font-size: 0.8125rem;
    height: 2.2rem;
  }
  .product-selling-price {
    font-size: 0.9375rem;
  }
  .product-orig-price {
    font-size: 0.75rem;
  }
  .btn-add-cart, .qty-stepper {
    font-size: 0.75rem;
    padding: 0.45rem;
  }

  /* Categories Grid on Mobile */
  .categories-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
  }
  .category-card {
    padding: 0.6rem 0.25rem;
  }
  .category-avatar {
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
  }
  .category-card-name {
    font-size: 0.6875rem;
  }

  /* 16:9 Ad Screen on Mobile */
  .hero-slider-wrap {
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
  }
  .hero-slide {
    aspect-ratio: 16 / 9;
    height: 100%;
  }
  .hero-content {
    padding: 0.85rem 1rem;
    max-width: 82%;
  }
  .hero-title {
    font-size: clamp(0.95rem, 3.8vw, 1.25rem);
    margin-bottom: 0.2rem;
  }
  .hero-subtitle {
    font-size: clamp(0.68rem, 2.4vw, 0.8rem);
    margin-bottom: 0.45rem;
    -webkit-line-clamp: 2;
  }
  .hero-tag {
    font-size: 0.625rem;
    padding: 0.15rem 0.5rem;
    margin-bottom: 0.3rem;
  }
  .hero-cta {
    padding: 0.35rem 0.75rem;
    font-size: 0.72rem;
  }
  .carousel-arrow {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .feature-card {
    padding: 0.75rem 1rem;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  /* Mobile Bottom Navigation Bar Enabled */
  .mobile-bottom-nav {
    display: block;
  }

  /* Tracker on Mobile */
  .tracker-steps {
    overflow-x: auto;
    padding-bottom: 0.75rem;
  }
  .tracker-step {
    width: 70px;
    flex-shrink: 0;
  }
  .tracker-circle {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }
  .tracker-title {
    font-size: 0.65rem;
  }
}

/* Extra Small Mobile (320px to 374px) */
@media (max-width: 374px) {
  .categories-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .location-picker {
    max-width: 105px !important;
    padding: 0.2rem 0.35rem !important;
  }
  .location-val {
    max-width: 60px !important;
  }
  .brand-logo {
    font-size: 1.15rem !important;
    gap: 0.35rem !important;
  }
  .brand-icon-box {
    width: 28px !important;
    height: 28px !important;
    font-size: 1rem !important;
  }
  .products-grid {
    grid-template-columns: 1fr;
  }
}
