:root {
  /* Color Palette */
  --primary: #2ecc71;
  --primary-dark: #27ae60;
  --primary-light: #e8f8f0;
  --secondary: #f39c12;
  --text-main: #2c3e50;
  --text-muted: #7f8c8d;
  --bg-main: #ffffff;
  --bg-subtle: #f8f9fa;
  --bg-dark: #1e272e;
  --border: #eaecee;

  /* Typography */
  --font-heading: "Outfit", sans-serif;
  --font-body: "Inter", sans-serif;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.12);

  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --radius: 12px;
  --radius-pill: 50px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  color: var(--text-main);
  background-color: var(--bg-main);
  line-height: 1.6;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

.container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Topbar --- */
.topbar {
  background: var(--bg-dark);
  color: white;
  font-size: 0.85rem;
  padding: 8px 0;
}

.topbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar-left {
  display: flex;
  gap: 20px;
}

.topbar-right a {
  margin-left: 20px;
  opacity: 0.8;
  transition: var(--transition);
}

.topbar-right a:hover {
  opacity: 1;
}

/* --- Navbar --- */
.navbar {
  background: var(--bg-main);
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: var(--transition);
  border-bottom: 1px solid var(--border);
}

.navbar.scrolled {
  padding: 12px 0;
  box-shadow: var(--shadow-sm);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}

.nav-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.app-logo-link {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.app-logo-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.app-logo-img {
  display: block;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  transition: height 0.3s ease;
}

.app-logo-name {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 30px;
  align-items: center;
}

.nav-link {
  font-weight: 500;
  position: relative;
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--primary);
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: var(--transition);
}

.nav-link:hover::after {
  width: 100%;
}

.search-box {
  flex-grow: 1;
  max-width: 400px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 12px 20px;
  padding-left: 45px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  background: white;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.nav-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  transition: var(--transition);
}

.action-btn:hover {
  background: var(--bg-subtle);
}

.cart-btn {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.cart-btn:hover {
  background: var(--primary);
  color: white;
}

.cart-count {
  background: white;
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-btn:hover .cart-count {
  color: var(--primary);
}

/* --- Buttons --- */
.btn-primary {
  background: var(--primary);
  color: white;
  padding: 14px 28px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);
}

.btn-secondary {
  background: white;
  color: var(--primary);
  padding: 14px 28px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  transform: translateY(-2px);
}

/* --- Section Formatting --- */
section {
  padding: 80px 0;
}

.section-title {
  font-size: 2.2rem;
  margin-bottom: 2rem;
  text-align: center;
}

.section-title span {
  color: var(--primary);
}

/* --- Product Cards --- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 30px;
}

.product-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-5px);
}

.badge {
  position: absolute;
  top: 16px;
  left: 16px;
  background: var(--secondary);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  z-index: 2;
}

/* Wrapper needs position:relative so the "N options" badge can overlay correctly */
.product-img-wrapper {
  position: relative;
  margin-bottom: 16px;
}

.product-img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  transition: var(--transition);
  display: block;
}

/* Images inside the wrapper (without explicit .product-img class) */
.product-img-wrapper img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  transition: var(--transition);
  display: block;
}

.product-card:hover .product-img,
.product-card:hover .product-img-wrapper img {
  transform: scale(1.05);
}

.product-category {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.product-title {
  font-size: 1.1rem;
  margin-bottom: 8px;
  flex-grow: 1;
}

.product-rating {
  color: #ffc107;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.product-rating span {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-left: 4px;
}

.product-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Price row — price + optional strikethrough MRP + add button */
.product-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
}

.product-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.product-old-price {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: line-through;
  font-weight: 400;
}

.product-price del {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 400;
  margin-left: 6px;
}

/* Standard circular add button (no tiers) */
.add-cart-btn {
  background: var(--primary-light);
  color: var(--primary-dark);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  border: none;
}

.product-card:hover .add-cart-btn {
  background: var(--primary);
  color: white;
}

/* Wider pill variant when the product has bulk tiers ("+ N opts") */
.add-cart-btn.add-cart-btn--tiered {
  width: auto;
  min-width: 52px;
  border-radius: 20px;
  padding: 0 10px;
  font-size: 11px;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}

/* --- Footer --- */
.footer {
  background: var(--bg-dark);
  color: white;
  padding: 80px 0 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-col h4 {
  font-size: 1.2rem;
  margin-bottom: 24px;
  color: white;
}

.footer-col p {
  color: #adb5bd;
  margin-bottom: 20px;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 12px;
}

.footer-links a {
  color: #adb5bd;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--primary);
  padding-left: 5px;
}

.footer-bottom {
  text-align: center;
  padding-top: 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #adb5bd;
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 992px) {
  .nav-links {
    display: none;
  }
  .topbar-right {
    display: none;
  }
  .topbar-left {
    width: 100%;
    justify-content: center;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 992px) {
  .hero-content { flex-direction: column; text-align: center; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* =========================
   SPLIT MEGA MENU 
   ========================= */

.has-mega {
  position: relative;
  display: flex;
  align-items: center;
}

.mega-menu.split-mega {
  position: absolute;
  top: calc(100% + 22px);
  left: 0;
  width: 800px;
  height: 480px;
  display: flex;
  padding: 0;
  border-radius: var(--radius);
  overflow: visible; /* we need visible so the ::before bridge works, but children border-radius will clip */
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  flex-direction: row;
  background: white;
  border: 1px solid var(--border);
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  pointer-events: none;
  transition:
    opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
    transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
    visibility 0s linear 0.3s;
  z-index: 999;
}

.has-mega:hover .mega-menu.split-mega {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  transition:
    opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
    transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
    visibility 0s;
}

/* Invisible bridge so mouse doesn't fall in gap */
.mega-menu.split-mega::before {
  content: "";
  position: absolute;
  top: -30px;
  left: 0;
  width: 100%;
  height: 30px;
  background: transparent;
  z-index: -1;
}

.mega-sidebar {
  width: 300px;
  background-color: var(--bg-dark);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex-shrink: 0;
  border-top-left-radius: var(--radius);
  border-bottom-left-radius: var(--radius);
}

.mega-sidebar::-webkit-scrollbar {
  width: 5px;
}
.mega-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

.mega-sidebar-item {
  padding: 14px 26px;
  cursor: pointer;
  font-size: 1.05rem;
  transition: all 0.2s;
  font-family: var(--font-heading);
  font-weight: 500;
  border-left: 4px solid transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mega-sidebar-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.mega-sidebar-item.active {
  background-color: rgba(255, 255, 255, 0.08);
  border-left-color: var(--primary);
  color: var(--primary-light);
}

.mega-content {
  flex-grow: 1;
  background-color: var(--bg-main);
  padding: 40px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-top-right-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

.mega-content::-webkit-scrollbar {
  width: 5px;
}
.mega-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

.mega-pane {
  display: none;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 30px;
}

.mega-pane.active {
  display: grid;
}

.mega-pane a {
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition:
    color 0.2s,
    transform 0.2s;
  padding: 4px 0;
}

.mega-pane a:hover {
  color: var(--primary);
  transform: translateX(3px);
}

/* =========================
   CART SIDEBAR
   ========================= */

.cart-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.cart-overlay.open {
  opacity: 1;
  visibility: visible;
}

.cart-sidebar {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 440px;
  height: 100vh;
  background: #f2f2f2;
  z-index: 2001;
  display: flex;
  flex-direction: column;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
  color: #1a1a1a;
  font-family: var(--font-body);
}

.cart-sidebar.open {
  transform: translateX(0);
  right: 0;
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 40px;
}

.cart-header h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 500;
  color: #1a1a1a;
  letter-spacing: -0.5px;
}

.close-cart-btn {
  color: #1a1a1a;
  transition: opacity 0.2s;
}

.close-cart-btn:hover {
  opacity: 0.6;
}

/* Cart Items */
.cart-items {
  flex-grow: 1;
  overflow-y: auto;
  padding: 0 40px;
  display: flex;
  flex-direction: column;
}

.cart-item {
  display: flex;
  gap: 20px;
  padding: 24px 0;
  border-top: 1px solid #e0e0e0;
}

.cart-item-img {
  width: 80px;
  height: 110px;
  background: transparent;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-item-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.cart-item-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.cart-item-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cart-item-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.cart-item-price {
  font-weight: 600;
  font-size: 0.95rem;
}

.cart-item-details {
  font-size: 0.8rem;
  color: #1a1a1a;
  display: grid;
  grid-template-columns: 80px auto;
  gap: 6px 0;
  font-weight: 500;
}

.cart-item-details div {
  grid-column: span 2;
  display: flex;
}

.cart-item-details span {
  width: 70px;
  color: #888;
  font-weight: 400;
}

/* Summary Area */
.cart-summary {
  padding: 0 40px 40px 40px;
  border-top: 1px solid #e0e0e0;
}

.promo-box {
  display: flex;
  align-items: center;
  margin-top: 30px;
  margin-bottom: 30px;
}

.promo-box input {
  flex-grow: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid #1a1a1a;
  padding: 10px 0;
  font-size: 0.85rem;
  outline: none;
  border-radius: 0;
}

.promo-box input::placeholder {
  color: #888;
}

.btn-apply {
  background: #e0e0e0;
  color: #555;
  padding: 12px 30px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1px;
  border: none;
  margin-left: 20px;
  transition: background 0.2s;
}

.btn-apply:hover {
  background: #d0d0d0;
  color: #1a1a1a;
}

.summary-details {
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 15px;
  margin-bottom: 15px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 15px;
  color: #1a1a1a;
}

.summary-row.total-row {
  font-size: 1.3rem;
  font-weight: 500;
  margin-bottom: 30px;
  font-family: var(--font-heading);
  letter-spacing: -0.5px;
}

.btn-checkout {
  width: 100%;
  background: #1a1a1a;
  color: #fff;
  padding: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-align: center;
  transition: opacity 0.2s;
}

.btn-checkout:hover {
  opacity: 0.85;
}

/* ── Header auth avatar (logged-in state) ── */
.header-avatar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  transition: var(--transition);
  font-weight: 600;
}

.header-avatar-btn:hover {
  background: var(--bg-subtle);
}

.header-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #3d9bff);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.header-avatar-label {
  font-size: 0.9rem;
  color: var(--text-main);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
