/* ===============================================================
   Nashik Kumbh Mela 2026 - Stylesheet
   Mobile-first. Designed for phone screens, scales up gracefully.
   =============================================================== */

/* ---------- Design tokens ---------- */
:root {
  --saffron:        #E8730C;
  --saffron-dark:   #B85A06;
  --saffron-light:  #FFF3E6;
  --emergency:      #D32F2F;
  --emergency-dark: #9E2222;
  --emergency-light:#FDECEC;
  --info:           #1565C0;
  --success:        #2E7D32;
  --ink:            #1A1A1A;
  --ink-soft:       #5F5F5F;
  --ink-faint:      #8C8C8C;
  --line:           #E6E3DD;
  --bg:             #F6F5F2;
  --surface:        #FFFFFF;
  --radius:         12px;
  --radius-sm:      8px;
  --shell-max:      480px;
  --tabbar-h:       62px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Noto Sans", "Noto Sans Devanagari", Arial, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
ul { list-style: none; }

/* ---------- App shell ---------- */
.app-shell {
  max-width: var(--shell-max);
  margin: 0 auto;
  min-height: 100%;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar__brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.topbar__logo { height: 34px; width: auto; max-width: 190px; object-fit: contain; display: block; }
.topbar__mark {
  width: 30px; height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--saffron);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.topbar__name {
  font-size: 15px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Language switcher ---------- */
.langswitch {
  display: flex;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.langswitch__opt {
  font-size: 12px;
  padding: 5px 10px;
  color: var(--ink-soft);
  background: var(--surface);
}
.langswitch__opt.is-active {
  background: var(--saffron);
  color: #fff;
  font-weight: 600;
}

/* ---------- Screen (scroll area) ---------- */
.screen {
  flex: 1;
  padding: 16px 16px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom));
}
.screen__head { margin-bottom: 14px; }
.screen__eyebrow { font-size: 12px; color: var(--ink-soft); }
.screen__title { font-size: 22px; font-weight: 700; line-height: 1.25; margin-top: 2px; }

/* ---------- Section label ---------- */
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 18px 0 8px;
}

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

/* ---------- SOS button ---------- */
.sos {
  width: 100%;
  background: var(--emergency-light);
  color: var(--emergency-dark);
  border: 2px solid var(--emergency);
  border-radius: var(--radius);
  padding: 17px;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.sos i { font-size: 22px; }
.sos:active { transform: scale(0.99); }
.sos-note {
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 6px;
}

/* ---------- Quick call grid ---------- */
.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.calltile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: block;
}
.calltile:active { background: var(--saffron-light); }
.calltile__icon { font-size: 20px; }
.calltile__icon--police { color: var(--info); }
.calltile__icon--danger { color: var(--emergency); }
.calltile__icon--warn   { color: var(--saffron-dark); }
.calltile__icon--ok     { color: var(--success); }
.calltile__name { font-size: 14px; font-weight: 600; margin-top: 4px; }
.calltile__num  { font-size: 12px; color: var(--ink-soft); }

/* ---------- List row (near you / links) ---------- */
.listrow {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.listrow:active { background: var(--saffron-light); }
.listrow__icon { font-size: 22px; color: var(--saffron-dark); flex-shrink: 0; }
.listrow__body { flex: 1; min-width: 0; }
.listrow__title { font-size: 14px; font-weight: 600; }
.listrow__sub { font-size: 12px; color: var(--ink-soft); }
.listrow__chev { font-size: 18px; color: var(--ink-faint); flex-shrink: 0; }

/* ---------- Place card (darshan) ---------- */
.place-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}
.place-card__media {
  height: 150px;
  background: var(--saffron-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--saffron);
  font-size: 40px;
}
.place-card__media img { width: 100%; height: 100%; object-fit: cover; }
.place-card__body { padding: 12px 14px; }
.place-card__title { font-size: 16px; font-weight: 700; }
.place-card__sub { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.place-card__meta {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-top: 8px; font-size: 12px; color: var(--ink-soft);
}
.place-card__meta i { font-size: 14px; vertical-align: -2px; margin-right: 3px; }

/* ---------- Badge / pill ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
}
.pill--open   { background: #E7F4E8; color: var(--success); }
.pill--closed { background: #F0EEEA; color: var(--ink-soft); }
.pill--cat    { background: var(--saffron-light); color: var(--saffron-dark); }
.pill--shahi  { background: var(--saffron-dark); color: #fff; }

/* ---------- Countdown ---------- */
.countdown {
  background: var(--saffron);
  color: #fff;
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
}
.countdown__num { font-size: 34px; font-weight: 800; line-height: 1; }
.countdown__label { font-size: 13px; opacity: 0.95; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 14px; font-weight: 600;
}
.btn--primary { background: var(--saffron); color: #fff; border-color: var(--saffron); }
.btn--block { width: 100%; }
.btn:active { transform: scale(0.99); }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 13px; font-weight: 600;
  margin-bottom: 5px;
}
.field input, .field textarea, .field select {
  width: 100%;
  font-family: inherit; font-size: 15px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 2px solid var(--saffron);
  outline-offset: -1px;
}
.field textarea { min-height: 90px; resize: vertical; }

/* ---------- Choice toggle ---------- */
.choice { display: flex; gap: 8px; }
.choice input { position: absolute; opacity: 0; }
.choice label {
  flex: 1; text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 8px;
  font-size: 13px; font-weight: 600;
  color: var(--ink-soft);
}
.choice input:checked + label {
  border-color: var(--saffron);
  background: var(--saffron-light);
  color: var(--saffron-dark);
}

/* ---------- Notice ---------- */
.notice {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
}
.notice--ok   { background: #E7F4E8; color: var(--success); }
.notice--info { background: #E7F0FB; color: var(--info); }

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
}
.empty i { font-size: 40px; color: var(--ink-faint); }
.empty p { margin-top: 8px; font-size: 14px; }

/* ---------- Bottom tab bar ---------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--shell-max);
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar__item {
  display: flex; flex-direction: column;
  align-items: center; gap: 2px;
  padding: 9px 0;
  font-size: 11px;
  color: var(--ink-faint);
}
.tabbar__item i { font-size: 22px; }
.tabbar__item.is-active { color: var(--saffron); font-weight: 600; }
.tabbar__item--help.is-active { color: var(--emergency); }

/* ---------- News card with thumbnail ---------- */
.newscard { display: flex; gap: 12px; align-items: flex-start; }
.newscard__main { flex: 1; min-width: 0; }
.newscard__thumb {
  width: 84px; height: 84px; flex-shrink: 0;
  object-fit: cover; border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

/* ---------- Ad banner ---------- */
.ad-banner { margin: 14px 0; }
.ad-banner__img {
  width: 100%; height: auto; display: block;
  border-radius: var(--radius); border: 1px solid var(--line);
}

/* ---------- More menu ---------- */
.more-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.more-tile {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 14px;
}
.more-tile:active { background: var(--saffron-light); }
.more-tile__icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--saffron-light); color: var(--saffron-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 4px;
}
.more-tile__label { font-size: 15px; font-weight: 700; }
.more-tile__desc { font-size: 12px; color: var(--ink-soft); }

/* ---------- Nandi chatbot ---------- */
.nandi {
  position: fixed; right: 16px; bottom: 80px; z-index: 1000;
  width: 64px; height: 64px;
}
.nandi__bubble {
  width: 64px; height: 64px; border-radius: 50%; border: none;
  padding: 0; cursor: grab; touch-action: none; position: relative;
  background: var(--saffron); box-shadow: 0 6px 20px rgba(0,0,0,0.28);
  -webkit-tap-highlight-color: transparent;
}
.nandi__bubble:active { cursor: grabbing; }
.nandi__bubble img {
  width: 100%; height: 100%; border-radius: 50%; display: block;
  user-select: none; pointer-events: none;
}
.nandi__pulse {
  position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--saffron); opacity: 0.6;
  animation: nandiPulse 2.4s ease-out infinite; pointer-events: none;
}
@keyframes nandiPulse {
  0%   { transform: scale(1);    opacity: 0.6; }
  70%  { transform: scale(1.45); opacity: 0; }
  100% { opacity: 0; }
}
.nandi.is-open .nandi__pulse { display: none; }

.nandi__panel {
  position: absolute; right: 0; bottom: 78px;
  width: 340px; height: 470px; max-height: calc(100vh - 130px);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  display: flex; flex-direction: column; overflow: hidden;
}
/* the [hidden] attribute must win over display:flex */
.nandi__panel[hidden] { display: none !important; }
.nandi.is-top  .nandi__panel { bottom: auto; top: 78px; }
.nandi.is-left .nandi__panel { right: auto; left: 0; }
/* hide the bubble while the chat is open (the panel has its own close) */
.nandi.is-open .nandi__bubble { display: none; }

.nandi__head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--saffron);
  color: #fff; flex-shrink: 0;
}
.nandi__avatar { width: 38px; height: 38px; border-radius: 50%;
  background: #fff; }
.nandi__title { flex: 1; line-height: 1.25; }
.nandi__title strong { font-size: 15px; display: block; }
.nandi__title span { font-size: 11px; opacity: 0.9; }
.nandi__close {
  background: rgba(255,255,255,0.2); border: none; color: #fff;
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}

.nandi__msgs {
  flex: 1; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 9px;
  background: #FAF7F0;
}
.nandi__msg {
  max-width: 84%; padding: 9px 12px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.5; word-wrap: break-word;
}
.nandi__msg--bot {
  background: #fff; border: 1px solid var(--line);
  align-self: flex-start; border-bottom-left-radius: 4px;
}
.nandi__msg--user {
  background: var(--saffron); color: #fff;
  align-self: flex-end; border-bottom-right-radius: 4px;
}
.nandi__msg a { color: var(--saffron-dark); font-weight: 600; }
.nandi__msg--user a { color: #fff; }
.nandi__typing { display: flex; gap: 4px; }
.nandi__typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint);
  animation: nandiDot 1.2s infinite;
}
.nandi__typing span:nth-child(2) { animation-delay: 0.2s; }
.nandi__typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes nandiDot {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

.nandi__form {
  display: flex; gap: 8px; padding: 10px;
  border-top: 1px solid var(--line); background: var(--surface); flex-shrink: 0;
}
.nandi__form input {
  flex: 1; border: 1px solid var(--line); border-radius: 20px;
  padding: 9px 14px; font-size: 14px; font-family: inherit;
  outline: none; color: var(--ink);
}
.nandi__form input:focus { border-color: var(--saffron); }
.nandi__form button {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--saffron); color: #fff; cursor: pointer; flex-shrink: 0;
  font-size: 17px; display: flex; align-items: center; justify-content: center;
}

@media (max-width: 480px) {
  .nandi__panel {
    position: fixed; left: 8px; right: 8px; bottom: 8px; top: auto;
    width: auto; height: 72vh; max-height: none;
  }
  .nandi.is-top .nandi__panel { top: auto; bottom: 8px; }
}

/* ---------- Utilities ---------- */
.stack > * + * { margin-top: 10px; }
.muted { color: var(--ink-soft); }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
