@import url('https://fonts.googleapis.com/css2?family=Tiro+Devanagari+Hindi:ital@0;1&family=Rajdhani:wght@400;500;600;700&family=Nunito:wght@400;500;600;700;800&display=swap');

/* ── CSS Variables ──────────────────────────────────────────────────────────
   Default values below. theme.php overrides these dynamically from DB.
   To reset, clear the site_settings table or use Admin → Settings → Theme.
   ───────────────────────────────────────────────────────────────────────── */
:root {
  --primary: #B22222;
  --primary-dark: #8B0000;
  --primary-light: #DC143C;
  --gold: #FFD700;
  --gold-dark: #FFA500;
  --dark: #1a0505;
  --bg: #FFF9F0;
  --card-bg: #FFFDF5;
  --text: #2d1010;
  --text-muted: #7a5c5c;
  --border: #e8d5c4;
  --shadow: 0 4px 20px rgba(178,34,34,0.12);
  --radius: 12px;
  --cart-width: 340px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* HEADER */
.site-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #c0392b 100%);
  position: sticky; top: 0; z-index: 1000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.header-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; gap: 12px;
}

.logo-area { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-area img { height: 50px; width: 50px; object-fit: contain; border-radius: 50%; border: 2px solid var(--gold); }
.logo-text { color: #fff; }
.logo-text .brand { font-family: 'Rajdhani', sans-serif; font-size: 1.2rem; font-weight: 700; line-height: 1; color: var(--gold); }
.logo-text .tagline { font-size: 0.65rem; opacity: 0.85; letter-spacing: 0.5px; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.btn-call {
  display: flex; align-items: center; gap: 6px;
  background: var(--gold); color: var(--dark);
  padding: 8px 14px; border-radius: 50px;
  font-weight: 700; font-size: 0.82rem;
  text-decoration: none; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: all 0.2s;
}
.btn-call:hover { background: #fff; transform: scale(1.05); }
.btn-call svg { width: 16px; height: 16px; }

.cart-toggle-btn {
  position: relative; background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  color: #fff; padding: 8px 14px; border-radius: 50px;
  cursor: pointer; font-size: 0.82rem; font-weight: 700;
  display: flex; align-items: center; gap: 6px;
  transition: all 0.2s; font-family: 'Nunito', sans-serif;
}
.cart-toggle-btn:hover { background: rgba(255,255,255,0.25); }
.cart-badge {
  background: var(--gold); color: var(--dark);
  border-radius: 50%; width: 20px; height: 20px;
  font-size: 0.7rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  position: absolute; top: -6px; right: -6px;
}

/* NAVBAR */
.main-nav {
  background: rgba(0,0,0,0.25);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }
.nav-list { display: flex; list-style: none; padding: 0 8px; white-space: nowrap; }
.nav-list li a {
  display: block; color: rgba(255,255,255,0.85);
  padding: 10px 14px; font-size: 0.82rem; font-weight: 600;
  text-decoration: none; transition: all 0.2s;
  border-bottom: 3px solid transparent;
}
.nav-list li a:hover, .nav-list li a.active {
  color: var(--gold); border-bottom-color: var(--gold);
}

/* HERO BANNER */
.hero {
  background: linear-gradient(135deg, #1a0505 0%, var(--primary-dark) 40%, #8B1A1A 100%);
  padding: 40px 16px; text-align: center; position: relative; overflow: hidden;
}
.hero::before {
  content: '🎆🎇✨🎆🎇✨🎆🎇✨🎆🎇✨';
  position: absolute; top: 0; left: 0; right: 0;
  font-size: 2rem; opacity: 0.08; letter-spacing: 4px;
  animation: sparkle 3s infinite alternate;
}
@keyframes sparkle { from { opacity: 0.05; } to { opacity: 0.15; } }

.hero-content { position: relative; z-index: 1; }
.hero-badge {
  display: inline-block; background: var(--gold);
  color: var(--dark); padding: 4px 16px;
  border-radius: 50px; font-size: 0.78rem; font-weight: 800;
  letter-spacing: 1px; text-transform: uppercase; margin-bottom: 12px;
}
.hero h1 {
  font-family: 'Rajdhani', sans-serif; font-size: 2.4rem;
  font-weight: 700; color: #fff; line-height: 1.1;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.hero h1 span { color: var(--gold); }
.hero-sub { color: rgba(255,255,255,0.8); margin: 10px 0 20px; font-size: 0.95rem; }

.hero-stats {
  display: flex; justify-content: center; gap: 24px;
  flex-wrap: wrap; margin-top: 20px;
}
.hero-stat {
  text-align: center; color: #fff;
}
.hero-stat .num { font-family: 'Rajdhani', sans-serif; font-size: 1.8rem; font-weight: 700; color: var(--gold); }
.hero-stat .lbl { font-size: 0.72rem; opacity: 0.8; text-transform: uppercase; letter-spacing: 1px; }

/* TICKER */
.ticker-bar {
  background: var(--gold); color: var(--dark);
  padding: 8px 0; overflow: hidden; white-space: nowrap;
}
.ticker-inner {
  display: inline-block;
  animation: ticker 20s linear infinite;
  font-weight: 700; font-size: 0.85rem; letter-spacing: 1px;
}
@keyframes ticker { from { transform: translateX(100vw); } to { transform: translateX(-100%); } }

/* SECTION */
.section { padding: 16px; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 3px solid var(--primary);
}
.section-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.4rem; font-weight: 700; color: var(--primary-dark);
  display: flex; align-items: center; gap: 8px;
}
.discount-badge {
  background: var(--primary); color: #fff;
  padding: 3px 10px; border-radius: 50px;
  font-size: 0.75rem; font-weight: 700;
}

/* VIEW TOGGLE */
.view-toggle { display: flex; gap: 4px; }
.view-btn {
  background: var(--border); border: none; cursor: pointer;
  padding: 6px 10px; border-radius: 6px; font-size: 1rem;
  transition: all 0.2s; line-height: 1;
}
.view-btn.active { background: var(--primary); color: #fff; }

/* PRODUCT GRID */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.product-grid.list-view {
  grid-template-columns: 1fr;
}

/* PRODUCT CARD */
.product-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.product-card:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(178,34,34,0.2); }

.product-card .img-wrap {
  position: relative; aspect-ratio: 1; overflow: hidden;
  background: #f5e8e8; cursor: pointer;
}
.product-card .img-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.3s;
}
.product-card:hover .img-wrap img { transform: scale(1.05); }

.play-overlay {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  background: rgba(0,0,0,0.3);
}
.play-overlay svg { width: 40px; height: 40px; fill: #fff; opacity: 0.9; }

.zoom-hint {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(0,0,0,0.5); color: #fff;
  font-size: 0.65rem; padding: 2px 6px; border-radius: 4px;
}

.product-info { padding: 10px; }
.product-name {
  font-size: 0.85rem; font-weight: 700; line-height: 1.3;
  margin-bottom: 6px; color: var(--text);
}
.price-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.price-original {
  font-size: 0.78rem; text-decoration: line-through; color: var(--text-muted);
}
.price-sale { font-size: 1rem; font-weight: 800; color: var(--primary); }
.unit-label { font-size: 0.7rem; color: var(--text-muted); }

.qty-row {
  display: flex; align-items: center; gap: 6px;
}
.qty-input-wrap {
  display: flex; align-items: center; border: 2px solid var(--border);
  border-radius: 8px; overflow: hidden; flex: 1;
}
.qty-btn {
  background: var(--primary); color: #fff; border: none;
  width: 32px; height: 32px; font-size: 1.1rem; cursor: pointer;
  transition: background 0.2s; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.qty-btn:hover { background: var(--primary-dark); }
.qty-num {
  flex: 1; text-align: center; border: none; outline: none;
  font-size: 0.9rem; font-weight: 700; background: #fff;
  font-family: 'Nunito', sans-serif; min-width: 0;
}
.item-total-price {
  font-size: 0.8rem; font-weight: 700; color: var(--primary);
  white-space: nowrap; min-width: 50px; text-align: right;
}

/* LIST VIEW styles */
.list-view .product-card {
  display: grid; grid-template-columns: 100px 1fr;
}
.list-view .product-card .img-wrap { aspect-ratio: auto; height: 100%; }
.list-view .product-info { padding: 12px; }
.list-view .product-name { font-size: 0.9rem; }

/* FLOATING CART */
.cart-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 2000; opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.cart-overlay.open { opacity: 1; pointer-events: all; }

.side-cart {
  position: fixed; top: 0; right: -100%; bottom: 0;
  width: min(var(--cart-width), 100vw);
  background: #fff; z-index: 2001;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,0.3);
  transition: right 0.35s cubic-bezier(0.4,0,0.2,1);
}
.side-cart.open { right: 0; }

.cart-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff; padding: 16px; display: flex;
  align-items: center; justify-content: space-between;
}
.cart-header h3 { font-family: 'Rajdhani', sans-serif; font-size: 1.2rem; }
.cart-close {
  background: rgba(255,255,255,0.2); border: none; color: #fff;
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  font-size: 1.2rem; display: flex; align-items: center; justify-content: center;
}

.cart-items { flex: 1; overflow-y: auto; padding: 12px; }
.cart-empty {
  text-align: center; padding: 40px 20px; color: var(--text-muted);
}
.cart-empty .emoji { font-size: 3rem; display: block; margin-bottom: 12px; }

.cart-item {
  display: flex; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--border); align-items: center;
}
.cart-item img { width: 50px; height: 50px; object-fit: cover; border-radius: 8px; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 0.8rem; font-weight: 700; line-height: 1.2; }
.cart-item-price { font-size: 0.85rem; color: var(--primary); font-weight: 700; }
.cart-item-remove {
  background: none; border: none; color: #ccc; cursor: pointer;
  font-size: 1.1rem; padding: 4px;
}
.cart-item-remove:hover { color: var(--primary); }

.cart-footer { padding: 16px; border-top: 2px solid var(--border); }
.cart-totals { margin-bottom: 12px; }
.cart-total-row {
  display: flex; justify-content: space-between;
  font-size: 0.88rem; margin-bottom: 4px;
}
.cart-total-row.grand {
  font-weight: 800; font-size: 1.1rem; color: var(--primary);
  padding-top: 8px; border-top: 2px solid var(--border); margin-top: 6px;
}
.cart-savings {
  background: #e8f5e9; color: #2e7d32;
  padding: 8px 12px; border-radius: 8px;
  font-size: 0.82rem; font-weight: 700; text-align: center;
  margin-bottom: 12px;
}

.btn-checkout {
  width: 100%; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border: none; padding: 14px;
  border-radius: 10px; font-size: 1rem; font-weight: 800;
  cursor: pointer; font-family: 'Nunito', sans-serif;
  transition: all 0.2s; letter-spacing: 0.5px;
}
.btn-checkout:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(178,34,34,0.4); }
.btn-checkout:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-whatsapp {
  width: 100%; background: #25D366; color: #fff; border: none;
  padding: 12px; border-radius: 10px; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; font-family: 'Nunito', sans-serif;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 8px; text-decoration: none;
  transition: background 0.2s;
}
.btn-whatsapp:hover { background: #128C7E; }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 3000; display: flex; align-items: flex-end;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-box {
  background: #fff; width: 100%; border-radius: 20px 20px 0 0;
  max-height: 95vh; overflow-y: auto;
  transform: translateY(100%); transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  padding: 20px;
}
.modal-overlay.open .modal-box { transform: translateY(0); }

.modal-handle {
  width: 40px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 0 auto 16px;
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: var(--border); border: none; border-radius: 50%;
  width: 32px; height: 32px; cursor: pointer; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
}

/* IMAGE LIGHTBOX */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.9);
  z-index: 4000; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.lightbox.open { opacity: 1; pointer-events: all; }
.lightbox img { max-width: 90vw; max-height: 85vh; border-radius: 8px; object-fit: contain; }
.lightbox-close {
  position: absolute; top: 16px; right: 16px;
  background: rgba(255,255,255,0.2); border: none; color: #fff;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  font-size: 1.3rem; display: flex; align-items: center; justify-content: center;
}
.lightbox iframe { width: 90vw; height: 50vw; max-height: 60vh; border-radius: 8px; border: none; }

/* CHECKOUT FORM */
.checkout-title {
  font-family: 'Rajdhani', sans-serif; font-size: 1.5rem;
  font-weight: 700; color: var(--primary-dark); margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 0.82rem; font-weight: 700;
  color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 12px 14px;
  border: 2px solid var(--border); border-radius: 10px;
  font-size: 0.95rem; font-family: 'Nunito', sans-serif;
  transition: border-color 0.2s; background: #fff;
  color: var(--text);
}
.form-group input:focus, .form-group textarea:focus {
  border-color: var(--primary); outline: none;
}
.form-group textarea { resize: vertical; min-height: 80px; }

.order-summary-mini {
  background: #FFF5F5; border: 2px solid #FECDD3;
  border-radius: 10px; padding: 14px; margin-bottom: 16px;
}
.order-summary-mini h4 {
  font-size: 0.9rem; font-weight: 700; margin-bottom: 8px;
  color: var(--primary-dark);
}
.order-item-line {
  display: flex; justify-content: space-between;
  font-size: 0.82rem; padding: 3px 0;
  border-bottom: 1px dashed #FECDD3;
}
.order-total-line {
  display: flex; justify-content: space-between;
  font-weight: 800; font-size: 1rem; color: var(--primary);
  margin-top: 8px; padding-top: 6px; border-top: 2px solid #FECDD3;
}

/* SUCCESS */
.success-box {
  text-align: center; padding: 30px 20px;
}
.success-box .emoji { font-size: 4rem; display: block; margin-bottom: 16px; animation: bounce 0.5s ease; }
@keyframes bounce { 0%,100%{transform:scale(1)}50%{transform:scale(1.2)} }
.success-box h2 { font-family: 'Rajdhani', sans-serif; font-size: 1.8rem; color: #2e7d32; margin-bottom: 8px; }
.success-box p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }

/* CATEGORY TABS */
.cat-tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 16px;
  padding-bottom: 0; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex-shrink: 0; padding: 8px 16px;
  background: #fff; border: 2px solid var(--border);
  border-radius: 50px; font-size: 0.82rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
  font-family: 'Nunito', sans-serif;
}
.cat-tab.active, .cat-tab:hover {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

/* STICKY SUMMARY BAR */
.sticky-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
  z-index: 999; transform: translateY(100%); transition: transform 0.3s;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}
.sticky-bar.show { transform: translateY(0); }
.sticky-bar-info { font-size: 0.82rem; }
.sticky-bar-info strong { font-size: 1rem; }
.sticky-bar .btn-view-cart {
  background: var(--gold); color: var(--dark);
  border: none; padding: 8px 16px; border-radius: 50px;
  font-weight: 800; cursor: pointer; font-family: 'Nunito', sans-serif;
  font-size: 0.85rem; white-space: nowrap;
}

/* ADDRESS SECTION */
.address-bar {
  background: var(--primary-dark); color: rgba(255,255,255,0.85);
  text-align: center; padding: 8px 16px; font-size: 0.78rem;
}

/* FOOTER */
.site-footer {
  background: var(--dark); color: rgba(255,255,255,0.8);
  padding: 30px 16px 20px; margin-bottom: 60px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
/* Brand section full width on mobile */
.footer-section:first-child {
  grid-column: 1 / -1;
}
.footer-section h4 {
  color: var(--gold); font-family: 'Rajdhani', sans-serif;
  font-size: 1rem; font-weight: 700; margin-bottom: 10px;
}
.footer-section p, .footer-section a {
  font-size: 0.78rem; line-height: 1.8; color: rgba(255,255,255,0.7);
  text-decoration: none; display: block;
}
.footer-section a:hover { color: var(--gold); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 14px; text-align: center;
  font-size: 0.75rem; color: rgba(255,255,255,0.5);
}

/* LOADING */
.loading-spinner {
  display: flex; justify-content: center; padding: 40px;
}
.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* TOAST */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #333; color: #fff; padding: 10px 20px;
  border-radius: 50px; font-size: 0.85rem; font-weight: 600;
  z-index: 9999; opacity: 0; transition: all 0.3s; white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: #2e7d32; }
.toast.error { background: var(--primary-dark); }

/* RESPONSIVE */
@media (min-width: 600px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: repeat(4, 1fr); }
  /* Reset brand section span on desktop */
  .footer-section:first-child { grid-column: auto; }
}
@media (min-width: 900px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); }
  .product-grid.list-view { grid-template-columns: repeat(2, 1fr); }
  .header-top { padding: 12px 24px; }
  .section { padding: 20px 24px; }
  .cat-tabs { padding: 16px 24px 0; }
}

/* Smooth scroll offset for sticky nav */
.category-section { scroll-margin-top: 110px; }

/* No products */
.no-products {
  grid-column: 1/-1; text-align: center; padding: 40px;
  color: var(--text-muted); font-size: 0.9rem;
}

/* STOCK BADGES */
.out-of-stock-badge,
.low-stock-badge {
  position: absolute;
  top: 8px; left: 8px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  z-index: 2;
  pointer-events: none;
}
.out-of-stock-badge {
  background: rgba(183,28,28,0.92);
  color: #fff;
}
.low-stock-badge {
  background: rgba(230,81,0,0.88);
  color: #fff;
}
/* Dim card when out of stock */
.product-card[data-stock="0"] {
  opacity: 0.7;
}
.product-card[data-stock="0"] .qty-btn,
.product-card[data-stock="0"] .qty-num {
  cursor: not-allowed;
  background: #eee;
  color: #bbb;
}

/* FOOTER CATEGORIES — 2-col list on mobile to reduce height */
.footer-categories {
  grid-column: 1 / -1;
}
.footer-categories a {
  display: inline-block;
  width: calc(50% - 8px);
  vertical-align: top;
}
@media (min-width: 600px) {
  .footer-categories {
    grid-column: auto;
  }
  .footer-categories a {
    display: block;
    width: auto;
  }
}
