/* ============================================================
   RSDH Collection — Customer Frontend Design System
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #d4245a; --brand-dark: #a81b46; --brand-light: #fbe9ef;
  --brand-2: #ff6b35;
  --text-1: #1a1a1a; --text-2: #444; --text-3: #888; --text-inv: #fff;
  --bg-page: #f4f4f4; --bg-card: #fff; --bg-input: #f9f9f9;
  --border: #e8e8e8; --border-2: #d0d0d0;
  --success: #1a7a3f; --error: #c0392b; --warning: #e67e22;
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 16px;
  --shadow-sm: 0 1px 4px rgba(0,0,0,.07); --shadow-md: 0 3px 12px rgba(0,0,0,.10);
  --nav-h: 56px; --bottom-nav-h: 60px; --safe-b: env(safe-area-inset-bottom,0px);
  --t: .18s ease;
}

html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-page); color: var(--text-1); font-size: 15px;
  line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, select { font-family: inherit; outline: none; }

/* Top Nav */
#top-nav {
  position: sticky; top: 0; z-index: 200;
  height: var(--nav-h); background: var(--brand);
  display: flex; align-items: center; padding: 0 12px; gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.nav-logo { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: -.5px; flex-shrink: 0; }
.nav-search {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.18); border: 1.5px solid rgba(255,255,255,.3);
  border-radius: 20px; padding: 0 14px; height: 36px;
}
.nav-search input { flex: 1; background: none; border: none; color: #fff; font-size: 14px; }
.nav-search input::placeholder { color: rgba(255,255,255,.65); }
.nav-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: 50%; color: #fff; position: relative; }
.badge { position: absolute; top: 4px; right: 4px; background: #fff; color: var(--brand);
  font-size: 10px; font-weight: 700; min-width: 16px; height: 16px;
  border-radius: 8px; padding: 0 3px; display: flex; align-items: center; justify-content: center; }
.badge[data-n="0"] { display: none; }

/* Category Strip */
#cat-strip { background: #fff; border-bottom: 1px solid var(--border);
  display: flex; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
#cat-strip::-webkit-scrollbar { display: none; }
.cat-chip { flex-shrink: 0; padding: 10px 16px; font-size: 13px; font-weight: 500;
  color: var(--text-3); white-space: nowrap; border-bottom: 2px solid transparent;
  cursor: pointer; transition: color var(--t), border-color var(--t); }
.cat-chip.active, .cat-chip:hover { color: var(--brand); border-bottom-color: var(--brand); }

/* App container */
#app { min-height: calc(100vh - var(--nav-h) - var(--bottom-nav-h) - var(--safe-b));
  padding-bottom: calc(var(--bottom-nav-h) + var(--safe-b) + 12px); }
.page { display: none !important; }
.page.active { display: block !important; animation: fadeIn .2s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(5px)} to{opacity:1;transform:none} }

/* Hero */
.hero-banner { position: relative; }
.hero-banner img { width: 100%; aspect-ratio: 16/7; object-fit: cover; background: var(--brand-light); }
.hero-dots { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 5px; }
.hero-dots span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.5); transition: all var(--t); }
.hero-dots span.active { background: #fff; width: 18px; border-radius: 3px; }

/* Section head */
.section-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 12px 8px; }
.section-head h2 { font-size: 16px; font-weight: 700; }
.section-head a { font-size: 13px; color: var(--brand); font-weight: 500; }

/* Product Grid */
.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 4px 10px 10px; }
@media(min-width:480px){.product-grid{grid-template-columns:repeat(3,1fr)}}
@media(min-width:720px){.product-grid{grid-template-columns:repeat(4,1fr)}}

/* Product Card */
.p-card { background: var(--bg-card); border-radius: var(--radius-md); overflow: hidden;
  box-shadow: var(--shadow-sm); cursor: pointer; display: flex; flex-direction: column;
  transition: transform var(--t), box-shadow var(--t); }
.p-card:active { transform: scale(.98); }
.p-card__img { position: relative; aspect-ratio: 3/4; overflow: hidden; background: #f0f0f0; }
.p-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.p-card:hover .p-card__img img { transform: scale(1.04); }
.p-card__badge { position: absolute; top: 8px; left: 8px; background: var(--brand);
  color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px; }
.p-card__wish { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px;
  background: rgba(255,255,255,.9); border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center; }
.p-card__wish.active svg { fill: var(--brand); stroke: var(--brand); }
.p-card__info { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.p-card__brand { font-size: 11px; color: var(--text-3); text-transform: uppercase; }
.p-card__name { font-size: 13px; font-weight: 500; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.p-card__price { display: flex; align-items: baseline; gap: 5px; margin-top: 4px; flex-wrap: wrap; }
.price-sale { font-size: 14px; font-weight: 700; }
.price-mrp  { font-size: 11px; color: var(--text-3); text-decoration: line-through; }
.price-off  { font-size: 11px; color: var(--success); font-weight: 600; }
.p-card__rating { display: flex; align-items: center; gap: 3px; font-size: 11px; color: var(--text-3); }
.star { color: #f4a62a; }

/* Skeleton */
.skeleton { background: linear-gradient(90deg,#ececec 25%,#f8f8f8 50%,#ececec 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* Bottom Nav */
#bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  height: calc(var(--bottom-nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: #fff; border-top: 1px solid var(--border);
  display: flex; box-shadow: 0 -2px 12px rgba(0,0,0,.07); }
.bnav { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--text-3); font-size: 10px; font-weight: 500;
  cursor: pointer; transition: color var(--t); position: relative; background: none; border: none; }
.bnav.active, .bnav:hover { color: var(--brand); }
.bnav svg { width: 22px; height: 22px; }
.bnav-badge { position: absolute; top: 6px; right: calc(50% - 18px);
  background: var(--brand); color: #fff; font-size: 9px; font-weight: 700;
  min-width: 15px; height: 15px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px; }
.bnav-badge[data-n="0"] { display: none; }

/* Product Detail */
.pd-gallery { background: #f5f5f5; }
.pd-gallery-main img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.pd-thumbs { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; scrollbar-width: none; }
.pd-thumbs::-webkit-scrollbar { display: none; }
.pd-thumb { flex-shrink: 0; width: 60px; height: 60px; border-radius: var(--radius-sm);
  overflow: hidden; border: 2px solid transparent; cursor: pointer; transition: border-color var(--t); }
.pd-thumb.active { border-color: var(--brand); }
.pd-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pd-info { padding: 14px; }
.pd-brand { font-size: 12px; color: var(--text-3); text-transform: uppercase; margin-bottom: 4px; }
.pd-name { font-size: 18px; font-weight: 700; line-height: 1.3; }
.pd-price { display: flex; align-items: baseline; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.pd-price .sale { font-size: 24px; font-weight: 800; }
.pd-price .mrp  { font-size: 15px; color: var(--text-3); text-decoration: line-through; }
.pd-price .off   { font-size: 15px; color: var(--success); font-weight: 600; }
.pd-section { padding: 14px; border-top: 8px solid var(--bg-page); }
.pd-section h3 { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.size-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.size-btn { min-width: 44px; height: 36px; padding: 0 12px; border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; background: #fff;
  cursor: pointer; transition: all var(--t); }
.size-btn.active { border-color: var(--brand); background: var(--brand-light); color: var(--brand); }

/* Sticky CTA */
.pd-cta { position: sticky; bottom: calc(var(--bottom-nav-h) + var(--safe-b));
  background: #fff; border-top: 1px solid var(--border); padding: 10px 14px;
  display: flex; gap: 10px; z-index: 100; }
.btn-wish-lg { width: 48px; height: 48px; border-radius: var(--radius-md);
  border: 1.5px solid var(--border-2); background: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.btn-wish-lg.active { border-color: var(--brand); color: var(--brand); }
.btn-add-cart { flex: 1; height: 48px; border-radius: var(--radius-md);
  background: var(--brand); color: #fff; font-size: 15px; font-weight: 700; }
.btn-buy-now  { flex: 1; height: 48px; border-radius: var(--radius-md);
  background: var(--brand-2); color: #fff; font-size: 15px; font-weight: 700; }

/* Cart */
.cart-item { background: #fff; margin: 8px 10px; border-radius: var(--radius-md);
  padding: 12px; display: flex; gap: 12px; box-shadow: var(--shadow-sm); }
.cart-item__img { width: 80px; height: 100px; border-radius: var(--radius-sm);
  overflow: hidden; flex-shrink: 0; background: #f0f0f0; }
.cart-item__img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item__info { flex: 1; }
.cart-item__name { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.cart-item__meta { font-size: 12px; color: var(--text-3); }
.cart-item__price { font-size: 16px; font-weight: 700; margin: 6px 0; }
.qty-ctrl { display: flex; align-items: center; border: 1.5px solid var(--border-2);
  border-radius: 6px; overflow: hidden; width: fit-content; }
.qty-btn { width: 32px; height: 32px; background: var(--bg-input);
  font-size: 18px; font-weight: 500; border: none; display: flex; align-items: center; justify-content: center; }
.qty-num { width: 36px; text-align: center; font-size: 14px; font-weight: 600; border: none; background: #fff; }
.cart-item__remove { background: none; border: none; color: var(--text-3); font-size: 12px; text-decoration: underline; cursor: pointer; margin-top: 6px; }
.cart-summary { background: #fff; margin: 8px 10px; border-radius: var(--radius-md);
  padding: 14px; box-shadow: var(--shadow-sm); }
.cart-summary h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.summary-row { display: flex; justify-content: space-between; font-size: 13px;
  padding: 5px 0; border-bottom: 1px dashed var(--border); }
.summary-row:last-child { border: none; }
.summary-row.total { font-size: 16px; font-weight: 700; border-top: 1.5px solid var(--border-2);
  border-bottom: none; margin-top: 6px; padding-top: 10px; }
.summary-row.green { color: var(--success); }
.coupon-row { display: flex; gap: 8px; margin: 12px 0; }
.coupon-input { flex: 1; height: 40px; padding: 0 12px; border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm); background: var(--bg-input); font-size: 14px; text-transform: uppercase; }
.coupon-input:focus { border-color: var(--brand); }
.btn-apply { height: 40px; padding: 0 16px; background: var(--brand); color: #fff;
  font-size: 13px; font-weight: 700; border-radius: var(--radius-sm); }
.btn-checkout { display: block; width: 100%; height: 52px; background: var(--brand); color: #fff;
  font-size: 16px; font-weight: 700; border-radius: var(--radius-md); margin: 12px 0 0; }

/* Checkout */
.checkout-section { background: #fff; margin: 8px 10px; border-radius: var(--radius-md);
  padding: 14px; box-shadow: var(--shadow-sm); }
.checkout-section h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px; }
.checkout-section h3 .step-num { width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.form-group { margin-bottom: 12px; }
.form-label { font-size: 12px; color: var(--text-3); margin-bottom: 4px; display: block; }
.form-input { width: 100%; height: 44px; padding: 0 12px;
  border: 1.5px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--bg-input); font-size: 14px; transition: border-color var(--t); }
.form-input:focus { border-color: var(--brand); background: #fff; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }
.payment-option { display: flex; align-items: center; gap: 12px; padding: 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  cursor: pointer; margin-bottom: 8px; transition: border-color var(--t); }
.payment-option.selected { border-color: var(--brand); background: var(--brand-light); }
.payment-option input[type=radio] { accent-color: var(--brand); width: 18px; height: 18px; }
.payment-option__label strong { display: block; font-size: 14px; }
.payment-option__label span { font-size: 12px; color: var(--text-3); }

/* Toast */
#toast-wrap { position: fixed; bottom: calc(var(--bottom-nav-h) + var(--safe-b) + 12px);
  left: 50%; transform: translateX(-50%); z-index: 999;
  display: flex; flex-direction: column-reverse; gap: 8px; pointer-events: none; }
.toast { background: #222; color: #fff; font-size: 13px; padding: 10px 18px;
  border-radius: 20px; box-shadow: var(--shadow-md); animation: toastIn .25s ease-out; }
.toast.success { background: var(--success); }
.toast.error   { background: var(--error); }
@keyframes toastIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }

/* Empty state */
.empty-state { text-align: center; padding: 60px 24px; color: var(--text-3); }
.empty-state h3 { font-size: 16px; color: var(--text-2); margin: 16px 0 6px; }
.empty-state p  { font-size: 14px; }
.empty-state a  { color: var(--brand); font-weight: 600; }

/* Offline */
#offline-bar { display: none; background: var(--warning);
  color: #fff; text-align: center; padding: 7px; font-size: 13px; }
body.offline #offline-bar { display: block; }