:root {
  --blue: #1a56db;
  --blue-dark: #1e40af;
  --sky: #0ea5e9;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, .1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { color: var(--ink); }

.boot-loader { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Shell ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.content { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 16px; }

.topbar { position: sticky; top: 0; z-index: 50; background: var(--card); box-shadow: var(--shadow); }
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.1rem; color: var(--blue); white-space: nowrap; }
.brand-mark { font-size: 1.4rem; }
.search-wrap { flex: 1; }
.search-input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: 999px; font-size: .95rem; background: var(--bg);
}
.search-input:focus { outline: none; border-color: var(--blue); background: #fff; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.cart-link { position: relative; font-size: 1.3rem; }
.cart-badge {
  position: absolute; top: -8px; right: -10px; background: var(--blue); color: #fff;
  font-size: .7rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px;
  display: grid; place-items: center; padding: 0 4px;
}
.account-link { font-weight: 600; color: var(--ink); font-size: .9rem; }
.announcement-bar { background: var(--blue); color: #fff; text-align: center; font-size: .82rem; padding: 5px; }

.footer { background: #fff; border-top: 1px solid var(--line); text-align: center; color: var(--muted); padding: 18px; font-size: .85rem; }

/* ---------- Buttons ---------- */
.btn { padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 600; cursor: pointer; font-size: .9rem; transition: .15s; }
.btn:hover { border-color: var(--blue); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-outline { background: #fff; color: var(--blue); border-color: var(--blue); }
.btn-text { background: none; border: none; color: var(--muted); }
.btn-lg { padding: 13px 20px; font-size: 1rem; }
.btn-block { width: 100%; margin-top: 10px; }
.btn-add { width: 100%; background: #eff6ff; color: var(--blue); border-color: #bfdbfe; }
.btn-add:hover { background: var(--blue); color: #fff; }

/* ---------- Hero ---------- */
.hero { background: linear-gradient(135deg, var(--blue), var(--sky)); color: #fff; border-radius: var(--radius); padding: 36px 28px; margin-bottom: 8px; }
.hero h2 { color: #fff; margin: 0 0 6px; font-size: 1.6rem; }
.hero p { margin: 0; opacity: .92; }

/* ---------- Sections & grids ---------- */
.section { margin: 26px 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 1.25rem; }
.grid { display: grid; gap: 14px; }
.grid-cats { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.grid-products { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }

.cat-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; text-align: center; transition: .15s; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.cat-card img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; }
.cat-card span { font-size: .8rem; font-weight: 600; line-height: 1.2; }

/* ---------- Product card ---------- */
.product-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: .15s; }
.product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.product-media { position: relative; display: block; aspect-ratio: 1; background: #f1f5f9; }
.product-media img { width: 100%; height: 100%; object-fit: cover; }
.discount-badge { position: absolute; top: 8px; left: 8px; background: var(--green); color: #fff; font-size: .7rem; font-weight: 700; padding: 3px 7px; border-radius: 6px; }
.flag-badge { position: absolute; top: 8px; right: 8px; font-size: .68rem; font-weight: 700; padding: 3px 7px; border-radius: 6px; color: #fff; }
.flag-badge.ltd { background: var(--amber); }
.flag-badge.dmg { background: var(--muted); }
.product-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.product-name { font-size: .85rem; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.1em; }
.product-price { display: flex; align-items: baseline; gap: 6px; margin-top: auto; }
.price { font-weight: 800; color: var(--ink); }
.mrp { font-size: .8rem; color: var(--muted); text-decoration: line-through; }

/* ---------- Quantity control ---------- */
.qty-control { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--blue); border-radius: 10px; overflow: hidden; }
.qty-control button { background: #eff6ff; color: var(--blue); border: none; width: 34px; height: 34px; font-size: 1.1rem; font-weight: 700; cursor: pointer; }
.qty-control button:hover { background: var(--blue); color: #fff; }
.qty-control .qty { font-weight: 700; }
.qty-control.lg button { width: 44px; height: 44px; font-size: 1.3rem; }
.qty-control.lg { max-width: 160px; }

/* ---------- PDP ---------- */
.pdp { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.pdp-main { width: 100%; border-radius: var(--radius); background: #f1f5f9; aspect-ratio: 1; object-fit: cover; }
.pdp-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pdp-thumbs img, .pdp-video-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.pdp-thumbs img.active { border-color: var(--blue); }
.pdp-videos { margin-top: 14px; display: grid; gap: 10px; }
.pdp-videos video { width: 100%; border-radius: var(--radius); }
.pdp-info h1 { margin: 0 0 12px; font-size: 1.5rem; }
.pdp-price { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.pdp-price .price { font-size: 1.6rem; }
.save { color: var(--green); font-weight: 700; font-size: .85rem; }
.pdp-stock { font-weight: 600; font-size: .9rem; }
.pdp-stock.in { color: var(--green); }
.pdp-stock.low { color: var(--amber); }
.pdp-stock.out { color: var(--red); }
.pdp-desc { color: var(--muted); line-height: 1.5; margin: 14px 0; }

/* ---------- Listing ---------- */
.listing-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.listing-head h1 { margin: 0; font-size: 1.35rem; }
.listing-controls { display: flex; align-items: center; gap: 14px; }
.check { display: flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--muted); }
.select { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 24px 0; }

/* ---------- Cart & checkout ---------- */
.cart-layout, .checkout-layout { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
.cart-line { display: grid; grid-template-columns: 64px 1fr auto auto auto; gap: 12px; align-items: center; background: var(--card); padding: 12px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; }
.cart-line img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; }
.cart-line-name { font-weight: 600; font-size: .9rem; }
.cart-line-price { color: var(--muted); font-size: .82rem; }
.cart-line-total { font-weight: 700; }
.cart-remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; }
.cart-summary { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; position: sticky; top: 80px; }
.cart-summary h2 { margin: 0 0 14px; font-size: 1.1rem; }
.summary-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: .9rem; }
.summary-row.muted { color: var(--muted); }
.summary-total { display: flex; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; font-weight: 800; font-size: 1.05rem; }
.checkout-form { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.checkout-form h2 { font-size: 1.05rem; margin: 4px 0 10px; }
.input { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; font-size: .95rem; font-family: inherit; }
.input:focus { outline: none; border-color: var(--blue); }
.cod-box { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px; padding: 14px; margin-bottom: 8px; }
.cod-box p { margin: 4px 0 0; }
.error-text { color: var(--red); font-size: .88rem; }

/* ---------- Order tracking ---------- */
.timeline { display: flex; justify-content: space-between; margin: 24px 0; position: relative; }
.timeline::before { content: ''; position: absolute; top: 9px; left: 5%; right: 5%; height: 2px; background: var(--line); }
.timeline-step { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; z-index: 1; flex: 1; }
.timeline-step .dot { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--line); }
.timeline-step.reached .dot { background: var(--green); border-color: var(--green); }
.timeline-step .label { font-size: .72rem; color: var(--muted); text-align: center; }
.timeline-step.reached .label { color: var(--ink); font-weight: 600; }
.tracking-box, .order-items { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin: 16px 0; }

/* ---------- Auth ---------- */
.auth-card { max-width: 380px; margin: 40px auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.auth-card h1 { margin: 0 0 16px; }

/* ---------- Misc ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.muted { color: var(--muted); }
.toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 14px 22px; border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 100; font-size: .92rem; }

.whatsapp-fab { position: fixed; bottom: 22px; right: 22px; width: 56px; height: 56px; border-radius: 50%; background: #25d366; color: #fff; display: grid; place-items: center; font-size: 1.6rem; box-shadow: var(--shadow-lg); z-index: 90; }

/* ---------- Skeletons ---------- */
.skeleton, .skeleton-card { background: linear-gradient(90deg, #eef2f7 25%, #e2e8f0 50%, #eef2f7 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--radius); }
.skeleton { height: 110px; }
.skeleton-card { height: 250px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

#blazor-error-ui { display: none; position: fixed; bottom: 0; width: 100%; background: #fee2e2; padding: 12px; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .pdp { grid-template-columns: 1fr; }
  .cart-layout, .checkout-layout { grid-template-columns: 1fr; }
  .brand-text { display: none; }
  .cart-summary { position: static; }
}
