/* ============================================================
   Blinkit Redesign — yellow + sky-blue theme
   Mobile-first, Telegram Mini App safe-area aware.
   ============================================================ */
:root {
  --yellow: #FFC93C;
  --yellow-deep: #F5B301;
  --yellow-soft: #FFF6DC;
  --sky: #38BDF8;
  --sky-deep: #0EA5E9;
  --sky-soft: #E8F7FE;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --faint: #98A2B3;
  --bg: #F7F9FC;
  --card: #FFFFFF;
  --line: #EDF0F4;
  --success: #12B76A;
  --success-soft: #E7F8EF;
  --danger: #F04438;
  --danger-soft: #FEECEB;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow: 0 6px 20px rgba(16,24,40,.07);
  --shadow-lg: 0 16px 40px rgba(16,24,40,.14);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tab-h: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg); color: var(--ink);
  font-size: 15px; line-height: 1.45;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
img { max-width: 100%; display: block; }
a { color: var(--sky-deep); text-decoration: none; }

/* ---------- splash ---------- */
.splash {
  position: fixed; inset: 0; display: grid; place-content: center; justify-items: center;
  gap: 10px; background: linear-gradient(160deg, #FFFDF5 0%, #F7F9FC 45%, #EAF7FE 100%);
  z-index: 100;
}
.splash-logo {
  width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center;
  font-size: 38px; background: var(--yellow); box-shadow: 0 12px 28px rgba(245,179,1,.35);
  animation: pop .5s cubic-bezier(.2,.9,.3,1.2);
}
.splash-name { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.splash-bar { width: 132px; height: 5px; border-radius: 99px; background: #E6EAF0; overflow: hidden; }
.splash-bar span { display: block; width: 40%; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--yellow), var(--sky)); animation: slide 1.1s infinite ease-in-out; }
.splash-hint { color: var(--muted); font-size: 13px; }
@keyframes slide { 0%{transform:translateX(-100%)} 100%{transform:translateX(320%)} }
@keyframes pop { from{transform:scale(.6);opacity:0} to{transform:scale(1);opacity:1} }

/* ---------- shell ---------- */
.app { display: flex; flex-direction: column; height: 100dvh; }
.view {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 12px 14px calc(var(--tab-h) + 28px + var(--safe-b));
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(10px + var(--safe-t)) 14px 10px;
  background: linear-gradient(135deg, var(--yellow) 0%, #FFD86B 55%, #FFE9A8 100%);
  border-bottom-left-radius: 22px; border-bottom-right-radius: 22px;
  box-shadow: var(--shadow-sm);
}
.topbar-row { display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; letter-spacing: -.4px; }
.brand .bolt {
  width: 30px; height: 30px; border-radius: 9px; background: #101828; color: var(--yellow);
  display: grid; place-items: center; font-size: 16px;
}
.topbar-loc { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ink-2);
  font-weight: 600; margin-top: 2px; max-width: 100%; }
.topbar-loc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  margin-left: auto; width: 38px; height: 38px; border-radius: 50%;
  background: #101828; color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 15px; flex: none;
}
.searchbar {
  margin-top: 10px; display: flex; align-items: center; gap: 8px;
  background: #fff; border-radius: 14px; padding: 11px 12px; box-shadow: var(--shadow-sm);
}
.searchbar input { flex: 1; border: 0; outline: 0; font-size: 15px; background: transparent; color: var(--ink); }
.searchbar input::placeholder { color: var(--faint); }

/* ---------- tabs ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255,255,255,.94); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 10.5px; font-weight: 600; color: var(--faint); padding-top: 8px; }
.tab .ico { font-size: 20px; line-height: 1; filter: grayscale(1); opacity: .65; }
.tab.active { color: var(--ink); }
.tab.active .ico { filter: none; opacity: 1; }
.tab.active::after {
  content: ""; position: absolute; bottom: calc(var(--safe-b) + 4px); width: 18px; height: 3px;
  border-radius: 99px; background: var(--yellow-deep);
}

/* ---------- generic ---------- */
.section { margin: 18px 0 6px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.section-head h2 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.3px; }
.section-head .link { font-size: 12.5px; font-weight: 700; color: var(--sky-deep); }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 13px; padding: 12px 16px; font-weight: 800; font-size: 14.5px;
  background: var(--yellow); color: #1a1200; box-shadow: 0 4px 14px rgba(245,179,1,.28);
  transition: transform .08s ease, box-shadow .15s ease, opacity .15s;
}
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .5; box-shadow: none; }
.btn.block { width: 100%; }
.btn.sky { background: var(--sky); color: #04283a; box-shadow: 0 4px 14px rgba(14,165,233,.25); }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: none; border: 1px solid var(--line); }
.btn.danger { background: var(--danger-soft); color: var(--danger); box-shadow: none; }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800;
  padding: 3px 8px; border-radius: 99px; background: var(--sky-soft); color: var(--sky-deep);
}
.badge.yellow { background: var(--yellow-soft); color: #8a6400; }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.red { background: var(--danger-soft); color: var(--danger); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 99px;
  background: #fff; border: 1px solid var(--line); font-size: 13px; font-weight: 700;
  color: var(--ink-2); white-space: nowrap; box-shadow: var(--shadow-sm);
}
.pill.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- category chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

/* ---------- product grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 820px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.prod {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px; display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.prod .thumb {
  aspect-ratio: 1/1; border-radius: 14px; display: grid; place-items: center;
  font-size: 40px; background: var(--yellow-soft); margin-bottom: 8px; position: relative;
}
.prod .off-tag { position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 800;
  background: var(--sky); color: #04283a; padding: 2px 6px; border-radius: 6px; }
.prod .name { font-size: 13px; font-weight: 700; line-height: 1.3; margin: 0 0 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 34px; }
.prod .unit { font-size: 11.5px; color: var(--muted); margin-bottom: 8px; }
.prod .foot { display: flex; align-items: center; gap: 6px; margin-top: auto; }
.prod .price { font-weight: 800; font-size: 14.5px; }
.prod .mrp { font-size: 11.5px; color: var(--faint); text-decoration: line-through; }
.add-btn {
  margin-left: auto; border: 1.5px solid var(--sky-deep); color: var(--sky-deep);
  font-weight: 800; font-size: 12.5px; padding: 6px 14px; border-radius: 9px; background: #fff;
}
.add-btn.in-cart { background: var(--sky-deep); color: #fff; }
.stepper { margin-left: auto; display: flex; align-items: center; gap: 2px;
  background: var(--sky-deep); border-radius: 9px; padding: 3px; }
.stepper button { width: 26px; height: 24px; color: #fff; font-weight: 800; font-size: 16px; line-height: 1; }
.stepper span { color: #fff; font-weight: 800; font-size: 13px; min-width: 16px; text-align: center; }

/* ---------- horizontal carousel ---------- */
.carousel { display: flex; gap: 12px; overflow-x: auto; padding: 2px 0 6px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.carousel > .prod { min-width: 148px; width: 148px; scroll-snap-align: start; }

/* ---------- category tiles ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (min-width: 560px) { .cat-grid { grid-template-columns: repeat(6, 1fr); } }
.cat-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px;
  background: #fff; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.cat-tile .emoji { font-size: 26px; }
.cat-tile .label { font-size: 10.5px; font-weight: 700; text-align: center; color: var(--ink-2); line-height: 1.2; }

/* ---------- offer banner ---------- */
.offer-banner {
  border-radius: var(--radius); padding: 16px; color: #1a1200; position: relative; overflow: hidden;
  background: linear-gradient(120deg, var(--yellow) 0%, #FFDE8A 60%, var(--sky-soft) 100%);
  box-shadow: var(--shadow);
}
.offer-banner h3 { margin: 0 0 4px; font-size: 17px; font-weight: 800; }
.offer-banner p { margin: 0; font-size: 12.5px; color: #5a4400; }

/* ---------- list rows ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: var(--radius-sm);
  padding: 12px; box-shadow: var(--shadow-sm); }
.list-item .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--yellow-soft); font-size: 20px; flex: none; }
.list-item .tt { font-weight: 700; font-size: 14px; }
.list-item .ss { font-size: 12px; color: var(--muted); }

/* ---------- cart ---------- */
.cart-line { display: flex; gap: 12px; align-items: center; }
.cart-line .thumb { width: 56px; height: 56px; border-radius: 12px; background: var(--yellow-soft);
  display: grid; place-items: center; font-size: 24px; flex: none; }
.bill { display: flex; flex-direction: column; gap: 8px; }
.bill-row { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--ink-2); }
.bill-row.total { font-weight: 800; font-size: 16px; color: var(--ink); padding-top: 8px; border-top: 1px dashed var(--line); }
.bill-row .green { color: var(--success); font-weight: 700; }

/* ---------- sticky checkout bar ---------- */
.checkout-bar {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b)); z-index: 25;
  padding: 10px 14px; background: rgba(255,255,255,.96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px;
}
.checkout-bar .amt { font-weight: 800; font-size: 16px; }
.checkout-bar .sub { font-size: 11px; color: var(--muted); }

/* ---------- timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-step { display: flex; gap: 12px; }
.tl-rail { width: 22px; display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; background: #E4E7EC; border: 3px solid #fff;
  box-shadow: 0 0 0 1.5px #E4E7EC; margin-top: 3px; }
.tl-step.done .tl-dot { background: var(--success); box-shadow: 0 0 0 1.5px var(--success); }
.tl-step.active .tl-dot { background: var(--yellow-deep); box-shadow: 0 0 0 1.5px var(--yellow-deep); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.25)} }
.tl-line { flex: 1; width: 2px; background: #E4E7EC; margin: 2px 0; }
.tl-step.done .tl-line { background: var(--success); }
.tl-body { padding-bottom: 18px; }
.tl-title { font-weight: 700; font-size: 14px; }
.tl-step:not(.done):not(.active) .tl-title { color: var(--faint); font-weight: 600; }

/* ---------- sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end;
  background: rgba(16,24,40,.42); animation: fade .18s ease; }
@keyframes fade { from{opacity:0} to{opacity:1} }
.sheet-inner { width: 100%; max-height: 88dvh; overflow-y: auto; background: #fff;
  border-top-left-radius: 24px; border-top-right-radius: 24px; padding: 18px 16px calc(20px + var(--safe-b));
  animation: up .24s cubic-bezier(.2,.9,.3,1); }
@keyframes up { from{transform:translateY(40px);opacity:.6} to{transform:translateY(0);opacity:1} }
.sheet-grab { width: 42px; height: 4px; border-radius: 99px; background: #E4E7EC; margin: 0 auto 14px; }

/* ---------- forms ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line);
  background: #FAFBFC; font-size: 14.5px; outline: none; color: var(--ink);
}
.field input:focus, .field textarea:focus { border-color: var(--sky); background: #fff; }
.field-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- skeleton ---------- */
.sk { background: linear-gradient(90deg, #EEF1F5 25%, #F7F9FC 37%, #EEF1F5 63%);
  background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 12px; }
@keyframes shimmer { 0%{background-position:100% 0} 100%{background-position:-100% 0} }
.sk-card { height: 210px; border-radius: var(--radius); }
.sk-line { height: 12px; margin: 8px 0; }

/* ---------- empty / error ---------- */
.state { text-align: center; padding: 46px 20px; }
.state .em { font-size: 46px; margin-bottom: 10px; }
.state h3 { margin: 0 0 6px; font-size: 16px; font-weight: 800; }
.state p { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 24px + var(--safe-b));
  transform: translateX(-50%); z-index: 80; background: #101828; color: #fff;
  padding: 11px 18px; border-radius: 99px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg); animation: up .2s ease; max-width: 88vw; }

/* ---------- cart fab ---------- */
.cart-fab { position: fixed; right: 14px; bottom: calc(var(--tab-h) + 14px + var(--safe-b));
  z-index: 26; background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 16px;
  display: flex; align-items: center; gap: 8px; font-weight: 800; box-shadow: var(--shadow-lg); }
.cart-fab .n { background: var(--yellow); color: #1a1200; border-radius: 99px; padding: 1px 7px; font-size: 12px; }
