/* ===== ROOT VARIABLES ===== */
:root {
  --primary-color: #00319E;
  --secondary-color: #f7feff;
  --accent-color: #28a745;
  --dark-color: #212529;
  --light-color: #f8f9fa;
  --font-primary: 'Inter', sans-serif;
  --font-display: 'Playfair Display', serif;
  --nav-height-desktop: 95px;
  --nav-height-mobile: 85px;
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --radius-md: 4px;
  --medium-gray: #dee2e6;
  --light-gray: #f8f9fa;
  --dark-gray: #6c757d;
  --text-dark: #212529;
  --text-light: #6c757d;
  --primary-green: #28a745;
  --dark-green: #1e7e34;
  --light-green: #d4edda;
  --groceries: #28a745;
  --housewares: #17a2b8;
  --hardware: #6c757d;
  --clothing: #e83e8c;
  --stationary: #fd7e14;
  --hampers: #6610f2;
  --primary-light: #1a3fb0;
  --primary-dark: #002380;
  --success: #28a745;
  --muted: #6c757d;
  --dark: #212529;
}

/* ===== BASE STYLES ===== */
body {
  font-family: var(--font-primary);
  color: var(--dark-color);
  line-height: 1.6;
  padding-top: var(--nav-height-desktop);
  background-color: #fff;
}

/* ===== NAVIGATION ===== */
.navbar {
  padding: var(--space-md) 0;
  /* Solid Gradient Background for Top Bar */
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  box-shadow: 0 4px 20px rgba(0,0,0,0.15); 
  transition: all var(--transition-normal);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1050;
}

/* Desktop navbar height */
.navbar.navbar-expand-lg {
  height: var(--nav-height-desktop);
  min-height: var(--nav-height-desktop);
}

/* Mobile navbar height */
@media (max-width: 992px) {
  body {
    padding-top: var(--nav-height-mobile);
  }
  
  .navbar {
    min-height: var(--nav-height-mobile);
    height: auto;
    padding: var(--space-sm) 0;
  }
  
  .navbar .container {
    padding: 0 var(--space-sm);
  }
}

.navbar.scrolled {
  padding: var(--space-sm) 0;
  box-shadow: var(--shadow-md);
}

.navbar-brand {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0;
}

.navbar-brand img {
  max-height: 55px;
  width: auto;
  transition: transform var(--transition-normal);
  object-fit: contain;
}

@media (max-width: 576px) {
  .navbar-brand img {
    max-height: 45px;
  }
}

.navbar-brand img:hover {
  transform: scale(1.05);
}

/* Navbar Toggler */
.navbar-toggler {
  border: 2px solid rgba(255, 255, 255, 0.6); /* Border added for visibility */
  background-color: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: var(--space-sm);
  font-size: 1.5rem;
  margin-left: auto;
  order: 2;
  color: white;
  height: 44px;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.navbar-toggler:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: #fff;
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
  outline: none;
}

/* Navbar Container */
.navbar .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 100%;
  padding: 0 var(--space-md);
}

/* Navigation Links Container */
#navbarNav {
  width: 100%;
  order: 3;
}

/* Collapse Behavior */
.navbar-collapse {
  /* Background removed here to be handled by Media Query for Glass effect */
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-top: var(--space-sm);
  max-height: 70vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 992px) {
  .navbar-collapse {
    background: transparent;
    box-shadow: none;
    padding: 0;
    margin-top: 0;
    max-height: none;
    overflow-y: visible;
    display: flex !important;
    flex-basis: auto;
    flex-grow: 1;
    order: 2;
  }
  
  #navbarNav {
    width: auto;
  }
}

/* Navigation Links */
.navbar-nav {
  flex-direction: column;
  width: 100%;
  margin: 0;
  padding: 0;
}

@media (min-width: 992px) {
  .navbar-nav {
    flex-direction: row;
    width: auto;
    margin-right: auto;
  }
}

.nav-item {
  width: 100%;
  margin-bottom: var(--space-xs);
}

@media (min-width: 992px) {
  .nav-item {
    width: auto;
    margin-bottom: 0;
    margin-right: var(--space-xs);
  }
  
  .nav-item:last-child {
    margin-right: 0;
  }
}

.nav-link {
  font-weight: 500;
  padding: 0.875rem var(--space-sm) !important;
  transition: all var(--transition-fast);
  color: var(--text-dark) !important;
  border-radius: var(--radius-md);
  display: block;
  width: 100%;
}

@media (min-width: 992px) {
  .nav-link {
    padding: 0.625rem var(--space-sm) !important;
    width: auto;
  }
}

/* Override nav link colors for our theme */
.navbar-light .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.9) !important;
}

.navbar-light .navbar-nav .nav-link:hover,
.navbar-light .navbar-nav .nav-link.active {
  color: white !important;
  background-color: rgba(255, 255, 255, 0.1);
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary-color) !important;
  background-color: var(--secondary-color);
}

/* Dropdown Menus */
.nav-item.dropdown {
  position: relative;
}

.dropdown-menu {
  border: none;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  padding: var(--space-sm) 0;
  animation: dropdownSlide 0.3s ease;
  position: static;
  width: 100%;
  margin-top: var(--space-xs);
  border: 1px solid var(--medium-gray);
}

@media (min-width: 992px) {
  .dropdown-menu {
    position: absolute;
    width: 250px;
    margin-top: 0;
    border: none;
  }
  
  .dropdown-menu.show {
    display: block;
  }
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  padding: 0.75rem 1.5rem;
  transition: all var(--transition-fast);
  width: 100%;
  display: block;
}

.dropdown-item:hover {
  background-color: var(--secondary-color);
  color: var(--primary-color);
}

/* Action Buttons Container */
.navbar .d-flex.align-items-center {
  order: 1;
  margin-left: auto;
  flex-wrap: nowrap;
  gap: var(--space-xs);
}

@media (max-width: 992px) {
  .navbar .d-flex.align-items-center {
    order: 2;
    margin-left: 0;
    margin-top: var(--space-sm);
    width: 100%;
    justify-content: center;
  }
}

/* Action Buttons */
.btn {
  padding: 0.625rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-size: 0.875rem;
  height: 42px;
}

@media (max-width: 768px) {
  .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    height: 40px;
  }
}

@media (max-width: 576px) {
  .btn {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    height: 38px;
    min-width: 38px;
  }
  
  .btn span:not(.badge),
  .btn i + span {
    display: none;
  }
  
  .btn i {
    margin: 0 !important;
  }
}

.btn-outline-light {
  border-color: rgba(255, 255, 255, 0.5);
  color: white;
}

.btn-outline-light:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: white;
  color: white;
}

.btn-success {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
}

.btn-success:hover {
  background-color: #218838;
  border-color: #1e7e34;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Search Dropdown */
.search-dropdown {
  min-width: 280px;
  max-width: 90vw;
  width: 100%;
}

@media (max-width: 576px) {
  .search-dropdown {
    min-width: 250px;
    transform: translateX(-50%);
    left: 50% !important;
    right: auto !important;
  }
}

/* Cart Badge */
.position-relative .badge {
  font-size: 0.65rem;
  padding: 0.25em 0.5em;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hero Section */
.hero-section {
  margin-top: 0;
  min-height: calc(80vh - var(--nav-height-desktop));
  max-height: calc(90vh - var(--nav-height-desktop));
}

@media (max-width: 992px) {
  .hero-section {
    min-height: calc(80vh - var(--nav-height-mobile));
    max-height: calc(90vh - var(--nav-height-mobile));
  }
}

/* Category Navigation (Old - Desktop Only) */
.category-nav {
  background: var(--secondary-color);
  padding: var(--space-md) 0;
  position: sticky;
  top: var(--nav-height-desktop);
  z-index: 1020;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 992px) {
  .category-nav {
    top: var(--nav-height-mobile);
  }
}

/* Modal Z-Index Override */
.modal {
  z-index: 1055;
}

.modal-backdrop {
  z-index: 1050;
}

/* Prevent Horizontal Scroll on Mobile */
@media (max-width: 576px) {
  .navbar .container {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
    max-width: 100%;
    overflow-x: hidden;
  }
  
  .navbar-nav {
    max-width: 100%;
    overflow-x: hidden;
  }
}

/* Dropdown toggle arrow alignment */
.dropdown-toggle::after {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.255em;
}

/* Profile Indicator */
#profileIndicator {
  font-size: 0.6rem;
  padding: 0.2em 0.4em;
  min-width: 16px;
}

/* Final Order Button */
#finalOrderBtn {
  font-size: 0.875rem;
}

@media (max-width: 768px) {
  #finalOrderBtn {
    font-size: 0.8125rem;
  }
}

@media (max-width: 576px) {
  #finalOrderBtn {
    font-size: 0.75rem;
    padding: 0.375rem 0.5rem;
  }
}

/* =========================================
   STRICT BRAND GLASSMORPHISM IMPLEMENTATION
   ========================================= */
@media (max-width: 992px) {
  /* Mobile Main Menu */
  .navbar-collapse.collapsing,
  .navbar-collapse.show {
    padding: 2rem 1.5rem;
    margin: 20px 1rem 0; /* Floating look */
    
    /* 
       1. SAFETY & BRANDING:
       High opacity (0.92) of your Brand Blue (#00319E).
       This ensures the background is dark enough for white text to be readable
       on ANY hero slide, even bright ones.
    */
    background: rgba(0, 49, 158, 0.92); 
    
    /* 
       2. AESTHETICS:
       Strong blur (20px) creates the frosted glass effect.
    */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    
    /* 3. DEPTH */
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 1030;
  }

  /* Text Styling */
  .navbar-nav .nav-link {
    color: #ffffff !important; /* White text */
    font-weight: 500;
    font-size: 1.1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3); /* Extra shadow for contrast */
    padding: 12px 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
  }

  .navbar-nav .nav-link:last-child {
    border-bottom: none;
  }

  /* Hover Effect: Slide animation */
  .navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
    padding-left: 20px !important; 
  }

  /* 
     DROPDOWNS INSIDE MOBILE:
     Changed from White Glass to Dark Brand Glass to maintain consistency.
  */
  .dropdown-menu {
    background-color: rgba(0, 30, 90, 0.95); /* Darker Brand Blue */
    box-shadow: none;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 0;
    padding: 0.5rem 0 0.5rem 1.5rem;
    border-radius: 8px;
    backdrop-filter: blur(10px);
  }
  
  .dropdown-item {
    color: #ffffff; /* White text on dark brand glass */
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  }
  
  .dropdown-item:hover {
    background-color: transparent;
    color: #fff;
    font-weight: 600;
    padding-left: 5px;
  }
}

/* Logo and Toggler Spacing */
.navbar .container > a.navbar-brand {
  margin-right: auto;
  flex-shrink: 0;
}

/* Ensure all nav items are visible */
.navbar-nav .nav-item .nav-link,
.navbar-nav .nav-item .dropdown-toggle {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ===== HERO SECTION ===== */
.hero-section {
  height: 80vh;
  min-height: 500px;
  position: relative;
  overflow: hidden;
}

.carousel-item {
  height: 80vh;
  min-height: 500px;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.carousel-caption {
  background: rgba(0, 0, 0, 0.5);
  padding: 2rem;
  border-radius: 8px;
  max-width: 600px;
  margin-left: 3%;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  width: 50px;
  height: 50px;
}

.carousel-indicators button {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin: 0 5px;
}

/* Category-specific button colors */
.btn-groceries {
  background-color: var(--groceries);
  border-color: var(--groceries);
}

.btn-housewares {
  background-color: var(--housewares);
  border-color: var(--housewares);
}

.btn-hardware {
  background-color: var(--hardware);
  border-color: var(--hardware);
}

.btn-clothing {
  background-color: var(--clothing);
  border-color: var(--clothing);
}

.btn-stationery {
  background-color: var(--stationary);
  border-color: var(--stationary);
}

.btn-hampers {
  background-color: var(--hampers);
  border-color: var(--hampers);
}

.btn-promotions {
  background-color: #dc3545;
  border-color: #dc3545;
}

/* ===== WOW! INTERACTIVE CATEGORY DECK (New Replacement) ===== */
/* This replaces the standard category list with a 3D animated experience */
.category-deck-section {
  padding: 5rem 0;
  background: #fff;
  position: relative;
  overflow: hidden;
  z-index: 1010; /* Below sticky nav but above hero content flow */
}

.deck-header {
  text-align: center;
  margin-bottom: 4rem;
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease-out;
}

.deck-header.visible {
  opacity: 1;
  transform: translateY(0);
}

.deck-header .section-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--dark-color);
  margin-bottom: 1rem;
}

.deck-header .section-subtitle {
  color: var(--text-light);
  font-size: 1.1rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  perspective: 1000px; /* Essential for 3D effect */
}

.tilt-card {
  position: relative;
  height: 350px;
  border-radius: 20px; /* Matches product card radius */
  overflow: hidden;
  cursor: pointer;
  transform-style: preserve-3d;
  transform: perspective(1000px);
  box-shadow: var(--shadow-lg);
  transition: transform 0.1s ease-out; /* Fast response for mouse move */
  opacity: 0;
  animation: fadeUp 0.8s ease-out forwards;
  text-decoration: none; /* Since it's an anchor tag */
  display: block;
}

/* Staggered Animation Delays handled via HTML classes (nth-child) */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(50px) rotateX(10deg); }
  to { opacity: 1; transform: translateY(0) rotateX(0); }
}

.card-bg {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background-size: cover;
  background-position: center;
  transition: transform 0.5s ease;
  z-index: 1;
}

.tilt-card:hover .card-bg {
  transform: scale(1.1);
}

.card-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.2));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2rem;
  color: white;
  transform: translateZ(20px); /* Pushes text forward in 3D space */
  z-index: 2;
}

.card-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: #fff;
  background: rgba(255,255,255,0.2);
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  backdrop-filter: blur(5px);
  transition: all 0.3s ease;
}

.tilt-card:hover .card-icon {
  background: var(--primary-color); /* Uses your brand color */
  transform: translateY(-5px);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  transform: translateY(0);
  transition: transform 0.3s ease;
}

.card-action {
  margin-top: 10px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  font-weight: 600;
  color: var(--primary-color);
  display: inline-flex;
  align-items: center;
}

.tilt-card:hover .card-action {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile Responsive for Tilt Cards */
@media (max-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
  }
  .tilt-card {
    height: 300px;
  }
}

/* ===== OLD CATEGORY NAVIGATION STYLES ===== */
/* (Preserved below if you ever revert to the list view) */
.category-nav .nav-link {
  color: var(--primary-color);
  font-weight: 500;
  padding: 10px 16px;
  margin: 0 5px;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.category-nav .nav-link:hover,
.category-nav .nav-link.active {
  background-color: var(--primary-color);
  color: white;
}

/* ===== BREADCRUMB ===== */
.breadcrumb-container {
  background-color: #f8f9fa;
  padding: 10px 0;
  border-bottom: 1px solid #e9ecef;
}

.breadcrumb {
  background-color: transparent;
  padding: 0;
  margin: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: ">";
  color: #6c757d;
}

/* ===== PRODUCTS SECTION ===== */
.products-section {
  padding: 3rem 0;
  background-color: var(--secondary-color);
  min-height: 60vh;
  width: 100%;
  margin-top: calc(var(--nav-height-desktop) + 60px); /* Account for nav bars */
}

@media (max-width: 992px) {
  .products-section {
    margin-top: calc(var(--nav-height-mobile) + 60px);
  }
}

.category-section {
  display: block;
  opacity: 0;
  height: 0;
  overflow: hidden;
  transition: opacity 0.5s ease, height 0.5s ease;
}

.category-section.active {
  display: block;
  opacity: 1;
  height: auto;
  overflow: visible;
  animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ========== PRODUCT GRID ========== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  padding: 2rem 0;
  width: 100%;
  align-items: stretch;
}

/* ========== PRODUCT CARDS ========== */
.product-card {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 12px 35px rgba(0, 49, 158, 0.12);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  min-height: 420px;
  height: 100%;
  border: 1px solid rgba(0, 49, 158, 0.08);
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  cursor: pointer; /* Add cursor pointer to indicate clickable */
}

.product-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 25px 60px rgba(0, 49, 158, 0.18);
}

/* Add a subtle "view details" hint */
.product-card::after {
  content: "Click to view details";
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.product-card:hover::after {
  opacity: 1;
}

/* Category accent colors */
.category-groceries .product-card {
  border-top: 4px solid var(--groceries);
}

.category-housewares .product-card {
  border-top: 4px solid var(--housewares);
}

.category-hardware .product-card {
  border-top: 4px solid var(--hardware);
}

.category-clothing .product-card {
  border-top: 4px solid var(--clothing);
}

.category-stationary .product-card {
  border-top: 4px solid var(--stationary);
}

.category-hampers-promotions .product-card {
  border-top: 4px solid var(--hampers);
}

/* ========== PRODUCT IMAGE AREA ========== */
.product-image {
  height: 200px;
  min-height: 200px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #f8f9ff 0%, #e8edff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 25px;
  border-bottom: 1px solid rgba(0, 49, 158, 0.08);
}

.product-image img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: all 0.5s ease;
}

.product-card:hover .product-image img {
  transform: scale(1.08);
}

/* ========== PRODUCT INFO ========== */
.product-info {
  padding: 1.5rem;
  background: white;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  overflow: hidden;
}

.product-name {
  font-weight: 600;
  color: var(--dark);
  font-size: 1.15rem;
  line-height: 1.4;
  margin-bottom: 0.3rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
  min-height: 2.8rem;
}

.product-price {
  color: var(--success);
  font-weight: 700;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.2rem 0;
}

.product-unit {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 400;
  margin-left: 0.3rem;
}

.quantity-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9ff;
  border-radius: 10px;
  padding: 0.4rem;
  margin: 0.5rem 0 1rem 0;
}

.quantity-controls input {
  width: 65px;
  text-align: center;
  margin: 0 0.5rem;
  border: 2px solid #e8edff;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1.1rem;
  height: 38px;
  background: white;
}

.quantity-controls .btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  padding: 0;
  border: 2px solid #e8edff;
  background: white;
}

.quantity-controls .btn:hover {
  background-color: var(--primary-light);
  color: white;
}

.add-to-cart-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  border: none;
  color: white;
  padding: 0.9rem;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: auto;
}

.add-to-cart-btn:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 49, 158, 0.25);
}

/* ===== EXPANDED PRODUCT VIEW ===== */
.product-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

.product-modal-overlay.active {
  display: flex;
}

.product-modal {
  background: white;
  border-radius: 16px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

.product-modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.product-modal-close:hover {
  background-color: #f0f0f0;
  transform: rotate(90deg);
}

.product-modal-content {
  display: flex;
  flex-wrap: wrap;
}

.product-modal-image {
  flex: 1 1 40%;
  min-width: 300px;
  padding: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8f9ff 0%, #e8edff 100%);
}

.product-modal-image img {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 8px;
}

.product-modal-details {
  flex: 1 1 60%;
  min-width: 300px;
  padding: 30px;
}

.product-modal-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 15px;
  color: var(--dark-color);
}

.product-modal-price {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 20px;
}

.product-modal-description {
  margin-bottom: 25px;
  line-height: 1.6;
  color: var(--text-dark);
}

.product-modal-unit {
  font-size: 0.9rem;
  color: var(--muted);
  margin-left: 5px;
}

.product-modal-quantity {
  display: flex;
  align-items: center;
  margin-bottom: 25px;
}

.product-modal-quantity .quantity-controls {
  margin: 0;
  background: #f8f9ff;
  border-radius: 10px;
  padding: 0.4rem;
}

.product-modal-quantity input {
  width: 70px;
  text-align: center;
  margin: 0 0.5rem;
  border: 2px solid #e8edff;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1.1rem;
  height: 40px;
  background: white;
}

.product-modal-quantity .btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  padding: 0;
  border: 2px solid #e8edff;
  background: white;
}

.product-modal-quantity .btn:hover {
  background-color: var(--primary-light);
  color: white;
}

.product-modal-actions {
  display: flex;
  gap: 15px;
}

.product-modal-add-btn {
  flex: 1;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  border: none;
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.product-modal-add-btn:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 49, 158, 0.25);
}

.product-modal-category {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 15px;
}

.category-groceries {
  background-color: rgba(40, 167, 69, 0.1);
  color: var(--groceries);
}

.category-housewares {
  background-color: rgba(23, 162, 184, 0.1);
  color: var(--housewares);
}

.category-hardware {
  background-color: rgba(108, 117, 125, 0.1);
  color: var(--hardware);
}

.category-clothing {
  background-color: rgba(232, 62, 140, 0.1);
  color: var(--clothing);
}

.category-stationary {
  background-color: rgba(253, 126, 20, 0.1);
  color: var(--stationary);
}

.category-hampers-promotions {
  background-color: rgba(102, 16, 242, 0.1);
  color: var(--hampers);
}

/* Re-defining keyframes to ensure they exist in this specific context */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(30px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .product-modal {
    margin: 20px;
    max-height: calc(100vh - 40px);
  }
  
  .product-modal-content {
    flex-direction: column;
  }
  
  .product-modal-image,
  .product-modal-details {
    flex: 1 1 100%;
    padding: 20px;
  }
  
  .product-modal-title {
    font-size: 1.5rem;
  }
  
  .product-modal-price {
    font-size: 1.4rem;
  }
  
  .product-modal-actions {
    flex-direction: column;
  }
}

/* ===== ABOUT SECTION ===== */
.about-section {
  background-color: var(--secondary-color);
}

.about-text {
  font-size: 1.1rem;
  line-height: 1.8;
}

.info-box {
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.values-list {
  padding-left: 20px;
}

.values-list li {
  margin-bottom: 10px;
}

.about-img {
  max-height: 500px;
  object-fit: cover;
}

.why-card {
  background-color: white;
  padding: 25px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  height: 100%;
  transition: all 0.3s ease;
}

.why-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* ===== FAQ SECTION ===== */
.faq-section {
  background-color: var(--light-color);
}

.accordion-button {
  background-color: white;
  color: var(--primary-color);
  font-weight: 500;
}

.accordion-button:not(.collapsed) {
  background-color: var(--secondary-color);
  color: var(--primary-color);
}

.accordion-button:focus {
  box-shadow: 0 0 0 0.25rem rgba(0, 49, 158, 0.25);
}

.accordion-item {
  border: 1px solid #e9ecef;
  margin-bottom: 10px;
  border-radius: 8px;
  overflow: hidden;
}

/* ===== MODALS ===== */
.modal-content {
  border-radius: 8px;
  border: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-header {
  background-color: var(--primary-color);
  color: white;
  border-radius: 8px 8px 0 0;
}

.modal-header .btn-close {
  filter: invert(1);
}

/* ===== SEARCH DROPDOWN ===== */
.search-dropdown {
  width: 300px;
  right: 0;
  left: auto;
}

.search-results {
  max-height: 300px;
  overflow-y: auto;
}

.search-result-item {
  padding: 10px;
  border-bottom: 1px solid #e9ecef;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-result-item:hover {
  background-color: var(--secondary-color);
}

.search-no-results {
  text-align: center;
  padding: 20px;
  color: #6c757d;
}

/* ===== CART ===== */
.cart-item {
  display: flex;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid #e9ecef;
}

.cart-item-image {
  width: 60px;
  height: 60px;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  border-radius: 4px;
  margin-right: 15px;
}

.cart-item-info {
  flex-grow: 1;
}

.cart-item-title {
  font-weight: 600;
  margin-bottom: 5px;
}

.cart-item-price {
  color: var(--primary-color);
  font-weight: 700;
}

.cart-item-quantity {
  display: flex;
  align-items: center;
}

.quantity-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #e9ecef;
  background-color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.quantity-btn:hover {
  background-color: var(--secondary-color);
}

.quantity-value {
  margin: 0 10px;
  font-weight: 600;
}

.cart-empty {
  text-align: center;
  padding: 40px 20px;
  color: #6c757d;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 992px) {
  .carousel-caption {
    max-width: 80%;
    margin-left: 10%;
    padding: 1.5rem;
  }
  
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .carousel-caption {
    max-width: 90%;
    margin-left: 5%;
    padding: 1rem;
  }
  
  .carousel-caption h1 {
    font-size: 1.8rem;
  }
  
  .carousel-caption p {
    font-size: 0.9rem;
  }
  
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }
  
  .category-nav .nav-link {
    font-size: 0.9rem;
    padding: 8px 12px;
    margin: 0 2px;
  }
  
  .search-dropdown {
    width: 250px;
  }
}

/* =========================================
   MOBILE NAVIGATION: SUB-CATEGORY & SNAP-OUT
   ========================================= */
@media (max-width: 576px) {
  
  /* 1. HIDE OLD DESKTOP NAV */
  .category-nav {
    display: none !important;
  }

  /* 2. MOBILE SUB-CATEGORY NAV (Level 2) */
  .mobile-sub-nav {
    position: fixed; /* Fixed to stick under navbar */
    top: var(--nav-height-mobile); /* Right below the 85px navbar */
    left: 0;
    width: 100%;
    z-index: 1040; /* Above content, below navbar (1050) */
    
    /* Brand Blue Background */
    background-color: var(--primary-color); 
    
    padding: 0.75rem 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    
    /* Snap-Out Transition */
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Hide Scrollbar for clean look */
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  
  .mobile-sub-nav::-webkit-scrollbar {
    display: none;
  }

  /* THE SNAP-OUT CLASS */
  .mobile-sub-nav.nav-hidden {
    transform: translateY(-100%); /* Slides it completely up and off-screen */
    position: fixed; /* Fixes it so it vanishes completely */
  }

  /* Sub-Category Pills Styling */
  #mobileSubNavList {
    display: flex;
    overflow-x: auto; /* Allow horizontal scrolling if many items */
    white-space: nowrap;
    padding: 0 1rem; /* Side padding for the scrollable area */
    scroll-behavior: smooth;
  }

  #mobileSubNavList .nav-link {
    color: rgba(255, 255, 255, 0.85);
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 0.8rem;
    padding: 0.4rem 1rem;
    white-space: nowrap;
    transition: all 0.2s ease;
    text-decoration: none;
  }

  #mobileSubNavList .nav-link:active,
  #mobileSubNavList .nav-link.active {
    background-color: #fff;
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  }

  /* Floating Back Button Styling */
  #backToCategoriesBtn {
    /* Base styles (can also be inline in HTML) */
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1030; /* Just above footer, below navs */
  }
  
  /* Ensure it's hidden by default (handled by inline style, but reinforcing here) */
  #backToCategoriesBtn[style*="display: none;"] {
    display: none !important;
  }

  /* Product grid adjustments (Maximize visibility) */
  .product-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding-top: 1rem;
  }
  
  /* Product cards - optimized for unobstructed view */
  .product-card {
    min-height: 380px;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    overflow: hidden;
    background-color: white;
  }
  
  .product-info {
    padding: 1rem;
    background-color: white;
  }
  
  .product-name {
    font-size: 1rem;
    min-height: 2.4rem;
    color: #333;
  }
  
  .product-price {
    font-size: 1.2rem;
    color: #007bff;
    font-weight: bold;
  }
  
  .add-to-cart-btn {
    padding: 0.7rem;
    font-size: 0.9rem;
    width: 100%;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
  }
  
  /* Carousel adjustments */
  .carousel-caption {
    max-width: 95%;
    margin-left: 2.5%;
    padding: 0.8rem;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 8px;
  }
  
  .carousel-caption h1 {
    font-size: 1.5rem;
  }
  
  .carousel-caption p {
    font-size: 0.8rem;
  }
  
  .carousel-caption .btn {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  
  /* Search */
  .search-dropdown {
    width: 100%;
  }
  
  /* About section */
  .about-img {
    margin-top: 30px;
  }
}