/* --- 1. VARIABLES & RESET --- */


* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, Arial, sans-serif;
  color: var(--text);
  background: #fff;
  overflow-x: hidden;
}

/* --- 2. LAYOUT --- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 16px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.top-bar {
  background: var(--blue-900);
  color: #fff;
  font-size: 13px;
}

.top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
}

.top-left {
  display: flex;
  gap: 16px;
  align-items: center;
}

.top-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  opacity: 0.95;
}

.icon {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
}

/* --- 3. NAVIGATION --- */
.main-nav-wrapper {
  border-bottom: 1px solid #f3f4f6;
  position: relative; /* Anchor for absolute mobile menu */
}

.main-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}

.logo {
  height: 40px;
  width: auto;
}

.desktop-nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.nav-link {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  transition: color 0.15s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
}

/* --- 4. ACTIONS & CART --- */
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-link {
  position: relative;
  padding: 8px;
  color: var(--blue-900);
}

.cart-count {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.cart-badge-pulse {
  transform: scale(1.25);
  box-shadow: 0 0 0 8px rgba(255, 69, 58, 0.18);
}

.stars .star {
  display: inline-block;
  position: relative;
  color: #d1d5db;
  font-size: 0.75rem;
  line-height: 1;
}

.stars .star.full {
  color: #fbbf24;
}

.stars .star.half {
  color: #d1d5db;
}

.stars .star.half::before {
  content: '★';
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  overflow: hidden;
  color: #fbbf24;
}

.stars .star.empty {
  color: #d1d5db;
}

/* --- 5. MOBILE MENU COMPONENTS --- */
.mobile-menu-button {
  display: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 8px;
}

.mobile-menu-button .icon {
  width: 24px;
  height: 24px;
  stroke: var(--blue-900);
}

/* The Mobile Nav (Hidden by default on all screens) */
.mobile-nav {
  display: none; 
  flex-direction: column;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: #fff;
  z-index: 99;
  border-bottom: 1px solid #f3f4f6;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

  /* Animation Initial State */
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.4s ease;
}

/* --- 6. RESPONSIVE QUERIES --- */

/* Mobile Views (Tablets and Phones) */
@media (max-width: 767px) {
  .hidden-sm,
  .desktop-nav,
  .top-right {
    display: none !important;
  }

  .mobile-menu-button {
    display: inline-flex;
  }

  .main-inner {
    height: 64px;
  }

  .mobile-nav {
    display: flex; /* Switch to flex so it can be animated */
    padding: 0 16px;
  }

  /* When the 'open' class is toggled via JS */
  .mobile-nav.open {
    max-height: 400px; /* Big enough to fit all links */
    opacity: 1;
    padding: 16px;
  }

  .mobile-nav .nav-link {
    display: block;
    padding: 12px 0;
    width: 100%;
    border-bottom: 1px solid #f9fafb;
  }
}

/* Desktop Views (Safeguard) */
@media (min-width: 768px) {
  .mobile-nav {
    display: none !important;
  }
  .mobile-menu-button {
    display: none !important;
  }
}

/* Mobile-specific overrides: remove desktop-style active underline and top border for mobile menu */
@media (max-width: 767px) {
  .mobile-nav .nav-link.active::after { display: none !important; }
  .main-nav-wrapper { border-bottom: none; }
  .mobile-nav { box-shadow: none; border-bottom: none; }
}