/* ============================================================
   STYLE.CSS — Global styles, components, dark mode
   ============================================================ */

/* ── Reset & Variables ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:   #0f172a;
  --accent:    #f59e0b;
  --bg:        #ffffff;
  --text:      #0f172a;
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --surface:   #f8fafc;
  --border:    #e2e8f0;
  --muted:     #64748b;
  --success:   #10b981;
  --danger:    #ef4444;
  --radius:    12px;
  --radius-lg: 20px;
  --shadow:    0 4px 24px rgba(0,0,0,.08);
  --shadow-lg: 0 12px 48px rgba(0,0,0,.14);
  --transition: .2s ease;
}

html.dark {
  --bg:      #0f172a;
  --text:    #f1f5f9;
  --surface: #1e293b;
  --border:  #334155;
  --muted:   #94a3b8;
  --shadow:  0 4px 24px rgba(0,0,0,.4);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition), color var(--transition);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font-body); }

/* ── Typography ─────────────────────────────────────────── */
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.2; }

/* ── Layout ─────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.page-content { flex: 1; padding-top: 80px; }

/* ── NAV ─────────────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; gap: 24px;
  padding: 0 32px; height: 72px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  transition: background var(--transition);
}
.nav-logo { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 800; font-size: 1.2rem; }
.logo-icon { font-size: 1.5rem; }
.nav-links { display: flex; gap: 8px; margin-left: auto; }
.nav-links a { padding: 6px 16px; border-radius: 8px; font-weight: 500; transition: background var(--transition); }
.nav-links a:hover, .nav-links a.active { background: var(--surface); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { background: none; border: none; font-size: 1.2rem; padding: 8px; border-radius: 8px; transition: background var(--transition); position: relative; display: inline-flex; align-items: center; gap: 4px; }
.icon-btn:hover { background: var(--surface); }
.cart-badge { background: var(--accent); color: var(--primary); font-size: .7rem; font-weight: 800; min-width: 18px; height: 18px; border-radius: 99px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.hamburger { display: none; background: none; border: none; font-size: 1.4rem; margin-left: 8px; }

.mobile-nav { display: none; flex-direction: column; gap: 4px; padding: 16px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.mobile-nav.open { display: flex; }
.mobile-nav a { padding: 12px 16px; border-radius: var(--radius); font-weight: 500; }
.mobile-nav a:hover { background: var(--border); }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .hamburger { display: block; }
  .nav { padding: 0 16px; }
}

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; border-radius: var(--radius); font-weight: 600; font-size: .95rem; border: none; transition: all var(--transition); cursor: pointer; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { opacity: .85; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-accent { background: var(--accent); color: var(--primary); }
.btn-accent:hover { opacity: .9; transform: translateY(-1px); }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: .85rem; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── CARDS ──────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: transform var(--transition), box-shadow var(--transition); }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

/* ── PRODUCT CARD ─────────────────────────────────────────── */
.product-card { position: relative; }
.product-card .product-img { aspect-ratio: 1; overflow: hidden; }
.product-card .product-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.product-card:hover .product-img img { transform: scale(1.05); }
.product-card .product-body { padding: 16px; }
.product-card .product-name { font-family: var(--font-head); font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.product-card .product-desc { color: var(--muted); font-size: .85rem; margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card .product-footer { display: flex; align-items: center; justify-content: space-between; }
.product-card .price { font-family: var(--font-head); font-size: 1.1rem; font-weight: 800; }
.product-badge { position: absolute; top: 12px; left: 12px; background: var(--accent); color: var(--primary); font-size: .7rem; font-weight: 800; padding: 3px 10px; border-radius: 99px; text-transform: uppercase; letter-spacing: .05em; }
.product-badge.digital { background: #6366f1; color: #fff; }
.product-badge.out { background: var(--muted); color: #fff; }
.wish-btn { position: absolute; top: 12px; right: 12px; background: rgba(255,255,255,.9); border: none; border-radius: 50%; width: 34px; height: 34px; font-size: 1rem; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); transition: transform var(--transition); }
.wish-btn:hover { transform: scale(1.15); }

/* ── PRODUCT GRID ─────────────────────────────────────────── */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 24px; }

/* ── FILTERS ─────────────────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 32px; align-items: center; }
.filter-chip { padding: 6px 16px; border-radius: 99px; border: 2px solid var(--border); background: var(--bg); font-size: .85rem; font-weight: 600; cursor: pointer; transition: all var(--transition); }
.filter-chip:hover { border-color: var(--accent); }
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.search-input { padding: 8px 16px; border-radius: 99px; border: 2px solid var(--border); background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: .9rem; outline: none; min-width: 200px; }
.search-input:focus { border-color: var(--accent); }

/* ── FORMS ──────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .9rem; }
.form-input { width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: .95rem; outline: none; transition: border var(--transition); }
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--muted); }
textarea.form-input { resize: vertical; min-height: 90px; }
select.form-input { appearance: none; }

/* ── ORDER TRACKER ────────────────────────────────────────── */
.tracker { display: flex; flex-direction: column; gap: 0; }
.tracker-step { display: flex; gap: 16px; position: relative; padding-bottom: 28px; }
.tracker-step:last-child { padding-bottom: 0; }
.tracker-icon-wrap { display: flex; flex-direction: column; align-items: center; }
.tracker-icon { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; border: 3px solid var(--border); background: var(--bg); z-index: 1; }
.tracker-icon.done { background: var(--success); border-color: var(--success); }
.tracker-icon.current { background: var(--accent); border-color: var(--accent); animation: pulse 1.5s infinite; }
.tracker-line { width: 3px; flex: 1; background: var(--border); margin: 4px 0; }
.tracker-line.done { background: var(--success); }
.tracker-content { padding: 8px 0; }
.tracker-label { font-weight: 700; font-family: var(--font-head); }
.tracker-date { font-size: .82rem; color: var(--muted); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(245,158,11,.4); } 50% { box-shadow: 0 0 0 8px transparent; } }

/* ── CART TABLE ───────────────────────────────────────────── */
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th { text-align: left; padding: 12px 16px; border-bottom: 2px solid var(--border); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.cart-table td { padding: 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.cart-item-img { width: 60px; height: 60px; border-radius: var(--radius); object-fit: cover; }
.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-btn { width: 30px; height: 30px; border: 2px solid var(--border); background: var(--bg); border-radius: 6px; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; transition: all var(--transition); }
.qty-btn:hover { border-color: var(--accent); }

/* ── ORDER SUMMARY ────────────────────────────────────────── */
.order-summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: .95rem; }
.summary-row.total { font-weight: 800; font-size: 1.1rem; border-top: 2px solid var(--border); margin-top: 8px; padding-top: 16px; }
.summary-row .free { color: var(--success); font-weight: 700; }

/* ── PAYMENT METHODS ─────────────────────────────────────── */
.payment-methods { display: flex; flex-direction: column; gap: 12px; }
.pay-option { border: 2px solid var(--border); border-radius: var(--radius); padding: 16px 20px; cursor: pointer; display: flex; align-items: center; gap: 12px; transition: all var(--transition); }
.pay-option:hover { border-color: var(--accent); }
.pay-option.selected { border-color: var(--accent); background: rgba(245,158,11,.06); }
.pay-option input[type=radio] { accent-color: var(--accent); }
.pay-option-label { font-weight: 600; }
.pay-option-desc { font-size: .82rem; color: var(--muted); }

/* ── ADMIN ─────────────────────────────────────────────────── */
.admin-layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 72px); }
.admin-sidebar { background: var(--primary); color: #fff; padding: 24px 0; position: sticky; top: 72px; height: calc(100vh - 72px); overflow-y: auto; }
.admin-sidebar .sidebar-logo { padding: 0 24px 24px; font-family: var(--font-head); font-weight: 800; font-size: 1.1rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-nav { padding: 16px 0; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 12px 24px; color: rgba(255,255,255,.7); font-weight: 500; transition: all var(--transition); }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.admin-content { padding: 32px; overflow-y: auto; }
.admin-section { display: none; }
.admin-section.active { display: block; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.admin-header h2 { font-size: 1.5rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.stat-value { font-family: var(--font-head); font-size: 1.8rem; font-weight: 800; }
.stat-label { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th { background: var(--surface); padding: 12px 16px; text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom: 2px solid var(--border); }
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.data-table tr:hover td { background: var(--surface); }
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700; }
.status-placed { background:#dbeafe; color:#1d4ed8; }
.status-confirmed { background:#d1fae5; color:#065f46; }
.status-shipped { background:#fef3c7; color:#92400e; }
.status-delivered { background:#d1fae5; color:#065f46; }
.status-cancelled { background:#fee2e2; color:#991b1b; }

@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .admin-sidebar.open { display: block; position: fixed; z-index: 200; width: 240px; }
}

/* ── STARS ─────────────────────────────────────────────────── */
.stars { display: flex; gap: 2px; }
.star { color: var(--muted); font-size: 1.1rem; }
.star.filled { color: var(--accent); }

/* ── TOAST ─────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--primary); color: #fff; padding: 12px 20px; border-radius: var(--radius); font-weight: 500; opacity: 0; transform: translateY(12px); transition: all .3s ease; max-width: 300px; box-shadow: var(--shadow-lg); }
.toast.show { opacity: 1; transform: none; }
.toast.toast-error { background: var(--danger); }
.toast.toast-info { background: #6366f1; }

/* ── MODAL ─────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 24px; backdrop-filter: blur(4px); }
.modal { background: var(--bg); border-radius: var(--radius-lg); padding: 32px; max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; position: relative; }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 1.4rem; color: var(--muted); }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 80px 24px; }
.empty-icon { font-size: 4rem; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.3rem; margin-bottom: 8px; }
.empty-state p { color: var(--muted); margin-bottom: 24px; }

/* ── SECTION TITLE ───────────────────────────────────────── */
.section-title { text-align: center; margin-bottom: 48px; }
.section-title h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin-bottom: 8px; }
.section-title p { color: var(--muted); max-width: 500px; margin: 0 auto; }

/* ── HERO ────────────────────────────────────────────────── */
.hero { padding: 100px 24px 80px; text-align: center; background: linear-gradient(135deg, var(--surface) 0%, var(--bg) 100%); position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 60% 0%, rgba(245,158,11,.08) 0%, transparent 70%); pointer-events: none; }
.hero h1 { font-size: clamp(2.5rem, 6vw, 4rem); margin-bottom: 16px; }
.hero h1 span { color: var(--accent); }
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 480px; margin: 0 auto 36px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── COUPON BAR ───────────────────────────────────────────── */
.coupon-bar { display: flex; gap: 8px; }
.coupon-bar input { flex: 1; }
.coupon-result { margin-top: 8px; font-size: .85rem; font-weight: 600; }
.coupon-result.ok { color: var(--success); }
.coupon-result.err { color: var(--danger); }

/* ── CHECKOUT STEPS ─────────────────────────────────────── */
.checkout-steps { display: flex; gap: 0; margin-bottom: 32px; }
.checkout-step { flex: 1; text-align: center; padding: 12px; border-bottom: 3px solid var(--border); font-size: .85rem; font-weight: 600; color: var(--muted); transition: all var(--transition); }
.checkout-step.active { border-color: var(--accent); color: var(--accent); }
.checkout-step.done { border-color: var(--success); color: var(--success); }

/* ── UPI QR ────────────────────────────────────────────────── */
.upi-box { text-align: center; padding: 24px; }
.upi-qr { width: 180px; height: 180px; border: 2px solid var(--border); border-radius: var(--radius); margin: 16px auto; display: flex; align-items: center; justify-content: center; font-size: .8rem; color: var(--muted); background: var(--surface); }
.upi-qr img { width: 100%; height: 100%; object-fit: contain; }
.upi-vpa { font-family: monospace; background: var(--surface); padding: 8px 16px; border-radius: 8px; margin: 8px auto; display: inline-block; font-size: .9rem; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .cart-table { font-size: .82rem; }
  .cart-table .hide-mobile { display: none; }
  .admin-content { padding: 16px; }
}
@media (max-width: 400px) {
  .products-grid { grid-template-columns: 1fr; }
}

/* ── PRINT ────────────────────────────────────────────────── */
@media print {
  .nav, .footer, .btn, #toast-container { display: none !important; }
  .page-content { padding-top: 0; }
}
