/* Brand palette derived from swaminarayanbhagwan.org — warm terracotta /
   burnt-orange + deep cocoa, with Baloo Bhai 2 display + Inter body. */
:root {
  --brand: #d05e2d;        /* burnt orange — primary accent */
  --brand-2: #bd5629;      /* brick — gradient / hover */
  --brand-dark: #a8481f;   /* deep brick — active / pressed */
  --brand-ink: #9c3f1c;    /* deep accent text */
  --brand-soft: #f8d9c8;   /* soft peach tint */
  --terracotta: #d97e57;   /* secondary terracotta */
  --amber: #fb8b24;        /* secondary amber accent */
  --peach: #f9e3d6;        /* light peach (tabs / light buttons) */
  --bg: #fdf4ee;           /* warm off-white */
  --card: #ffffff;
  --surface: #fdf3ec;
  --surface-border: #f1ddcb;
  --text: #41301f;         /* warm dark brown */
  --title: #572713;        /* deep cocoa — headings */
  --muted: #9c8a78;
  --label: #94715a;
  --border: #f0e0d2;
  --danger: #d23b3b;
  --danger-bg: #fdecea;
  --radius: 16px;
  --radius-lg: 26px;
  --shadow: 0 4px 18px rgba(150, 80, 30, 0.10);
  --shadow-card: 0 14px 40px rgba(140, 70, 25, 0.16);
  --maxw: 520px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Baloo Bhai 2', 'Inter', system-ui, sans-serif;
  --font-guj: 'Mukta Vaani', 'Inter', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
body {
  background:
    radial-gradient(125% 60% at 50% 0%, #fbe0d0 0%, #fdeadf 44%, #fdf4ee 100%) no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
}

/* Display font for headings & brand */
.auth-title h1, .view-title, .section-title, .user-name, .stat-value,
.auth-tab, .btn-jsr, .field-label { font-family: var(--font-display); }
/* Gujarati / Devanagari devotional captions */
.sw-divider span, .auth-foot { font-family: var(--font-guj); }

.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: 400; font-size: 0.85em; }
.req { color: var(--brand-2); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  background: #3a2a1c;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  z-index: 1000;
  max-width: 90%;
  text-align: center;
  font-size: 0.9rem;
  transition: transform 0.3s ease, opacity 0.3s ease;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--brand-2); }

/* ============================================================
   AUTH (login / signup) — devotional theme
   ============================================================ */
.auth-view {
  position: relative;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 22px) 16px calc(env(safe-area-inset-bottom, 0px) + 26px);
  overflow: hidden;
}
/* Devotional glow + soft mandala behind the auth screen */
.auth-view::before {
  content: "";
  position: absolute;
  top: -160px;
  left: 50%;
  width: 560px;
  height: 560px;
  transform: translateX(-50%);
  background:
    radial-gradient(circle at 50% 50%, rgba(251, 139, 36, 0.30) 0%, rgba(217, 126, 87, 0.16) 38%, transparent 68%);
  pointer-events: none;
  z-index: 0;
}
.auth-wrap { position: relative; z-index: 1; width: 100%; max-width: 440px; }

.auth-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 8px 0 20px;
}
.deity {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  border-radius: 50%;
  padding: 2px;
  background:
    linear-gradient(140deg, var(--amber), var(--brand) 55%, var(--brand-dark)) border-box;
  border: 1.5px solid transparent;
  box-shadow: 0 5px 14px rgba(176, 74, 28, 0.24);
}
.deity::after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: var(--brand-soft);
  background-size: cover;
  background-position: center;
}
.deity-left::after { background-image: url('/images/deity-left.jpg'), url('/images/deity-left.svg'); }
.deity-right::after { background-image: url('/images/deity-right.jpg'), url('/images/deity-right.svg'); }
.auth-title { text-align: center; min-width: 0; }
.auth-title h1 {
  margin: 0;
  font-family: var(--font-guj);
  font-size: 1.34rem;
  line-height: 1.2;
  font-weight: 700;
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 45%, var(--amber) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.2px;
}
.auth-sub {
  display: inline-block;
  margin: 8px 0 0;
  padding: 3px 14px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  box-shadow: 0 4px 12px rgba(189, 86, 41, 0.34);
}

.auth-card {
  position: relative;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px 18px 20px;
  overflow: hidden;
}
/* Saffron crown bar across the top of the card */
.auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--amber), var(--brand), var(--brand-dark), var(--brand), var(--amber));
}

.auth-tabs {
  display: flex;
  background: var(--peach);
  border-radius: 14px;
  padding: 6px;
  gap: 6px;
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 8px;
  border-radius: 11px;
  font-size: 1rem;
  font-weight: 700;
  color: #b08a6e;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s, transform 0.18s;
}
.auth-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  box-shadow: 0 6px 16px rgba(189, 86, 41, 0.32);
  transform: translateY(-1px);
}

.auth-form { display: flex; flex-direction: column; gap: 15px; }

.fld { display: flex; flex-direction: column; gap: 7px; }
.fld-head {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--label);
  line-height: 1.35;
}
.fld-head .hint { color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; }
.fld-head .req { color: var(--brand-2); }

/* phone row */
.phone-row { display: flex; gap: 10px; }
.cc {
  flex: 0 0 auto;
  width: auto;
  min-width: 92px;
  padding: 0 8px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  font-size: 0.98rem;
  font-weight: 700;
  color: #6a5746;
  cursor: pointer;
}
.phone-row input { flex: 1; }

/* password row with eye */
.pw-row { position: relative; display: flex; }
.pw-row input { flex: 1; padding-right: 46px; }
.pw-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 8px;
  color: #b08a63;
  cursor: pointer;
  display: flex;
}
.pw-eye svg { width: 22px; height: 22px; }
.pw-eye.on { color: var(--brand); }

/* big devotional submit */
.btn-jsr {
  position: relative;
  margin-top: 6px;
  background: linear-gradient(135deg, var(--amber) 0%, var(--brand) 45%, var(--brand-2) 100%);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 16px 16px;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 10px 22px rgba(189, 86, 41, 0.38);
  transition: transform 0.12s ease, box-shadow 0.18s ease, filter 0.15s;
}
/* soft sheen */
.btn-jsr::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 55%);
  pointer-events: none;
}
.btn-jsr:hover { box-shadow: 0 14px 28px rgba(189, 86, 41, 0.46); }
.btn-jsr:active { transform: translateY(1px); filter: brightness(0.97); }
.btn-jsr[disabled] { opacity: 0.65; }

.link-forgot {
  background: none;
  border: none;
  color: var(--brand-ink);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px;
  align-self: center;
}

.sw-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #b79a7d;
  font-size: 0.95rem;
  margin-top: 2px;
}
.sw-divider::before, .sw-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e7cdaf, transparent);
}

.back-link {
  background: none;
  border: none;
  color: var(--brand-ink);
  font-weight: 600;
  cursor: pointer;
  align-self: center;
  font-size: 0.9rem;
}

.auth-dots {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin: 18px 0 10px;
}
.auth-dots span { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.auth-dots span:nth-child(1) { background: var(--amber); }
.auth-dots span:nth-child(2) { background: var(--brand); }
.auth-dots span:nth-child(3) { background: var(--terracotta); }
.auth-dots span:nth-child(4) { background: var(--brand-2); }
.auth-dots span:nth-child(5) { background: var(--brand-dark); }

.auth-foot { text-align: center; color: var(--muted); font-size: 0.82rem; margin: 0; }

/* ---------- Generic form controls ---------- */
label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #5b4a3b;
}
input, select, textarea {
  font: inherit;
  padding: 13px 14px;
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
input::placeholder, textarea::placeholder { color: #c2a98e; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(208, 94, 45, 0.18);
}
textarea { resize: vertical; }
.row { display: flex; gap: 12px; }
.row > label { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, background 0.15s;
}
.btn:active { filter: brightness(0.95); }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, var(--brand) 0%, var(--brand-2) 100%); color: #fff; box-shadow: 0 6px 14px rgba(231, 106, 16, 0.28); }
.btn-light { background: var(--peach); color: #7a5e45; }
.btn.full { width: 100%; }
.btn-ghost {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.55);
  color: #fff;
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 0.85rem;
  cursor: pointer;
}

/* ---------- App shell ---------- */
.app-view { max-width: var(--maxw); margin: 0 auto; min-height: 100vh; }
.app-header {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 18px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 4px 14px rgba(200, 110, 30, 0.25);
}
.hello { font-size: 0.8rem; opacity: 0.92; }
.user-name { font-size: 1.15rem; font-weight: 700; }
.header-deities { display: flex; gap: 8px; align-items: center; }
.header-deities .deity {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
}
.app-header .btn-ghost { margin-left: 4px; }

.app-main { padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 86px); }
.view-title { margin: 4px 0 14px; font-size: 1.25rem; color: var(--title); }
.section-title { margin: 22px 0 10px; font-size: 1.05rem; color: #5b4a3b; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 14px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 0.88rem; font-weight: 600; color: #5b4a3b; }
.readonly-date {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 700;
  padding: 13px 14px;
  border-radius: 12px;
}

/* radio pills */
.radio-group { display: flex; gap: 12px; }
.radio-pill {
  flex: 1;
  position: relative;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  font-weight: 700;
  flex-direction: row;
  justify-content: center;
  background: var(--surface);
}
.radio-pill input { position: absolute; opacity: 0; pointer-events: none; }
.radio-pill span { color: var(--muted); }
.radio-pill:has(input:checked),
.radio-pill.checked { border-color: var(--brand); background: var(--brand-soft); }
.radio-pill:has(input:checked) span,
.radio-pill.checked span { color: var(--brand-dark); }

.note {
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

/* ---------- Stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--brand-dark); }
.stat-label { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }

/* ---------- History list ---------- */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.entry {
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.entry-date { font-weight: 700; }
.entry-sub { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
.badge { font-size: 0.72rem; font-weight: 700; padding: 4px 10px; border-radius: 20px; white-space: nowrap; }
.badge.present { background: var(--brand-soft); color: var(--brand-dark); }
.badge.absent { background: var(--danger-bg); color: var(--danger); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 14px; }
.pager button { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; cursor: pointer; color: var(--text); }
.pager button[disabled] { opacity: 0.4; cursor: default; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: var(--maxw);
  margin: 0 auto;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 20;
  box-shadow: 0 -2px 14px rgba(180, 110, 40, 0.08);
}
.nav-btn {
  flex: 1;
  border: none;
  background: none;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  color: var(--muted);
  cursor: pointer;
}
.nav-btn .nav-ico { font-size: 1.25rem; filter: grayscale(1); opacity: 0.55; }
.nav-btn.active { color: var(--brand); font-weight: 700; }
.nav-btn.active .nav-ico { filter: none; opacity: 1; }

/* error text under inputs */
.field-error { color: var(--danger); font-size: 0.78rem; font-weight: 500; }
input.invalid, select.invalid, textarea.invalid { border-color: var(--danger); }

/* install prompt — on-brand bottom card */
.install-banner {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 16px 14px;
  background: #fff;
  border: 1px solid var(--surface-border);
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(140, 70, 25, 0.26);
  z-index: 1200;
  overflow: hidden;
  animation: ib-rise 0.3s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
/* saffron crown bar, matching the auth card */
.install-banner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--amber), var(--brand), var(--brand-dark), var(--brand), var(--amber));
}
@keyframes ib-rise {
  from { opacity: 0; transform: translateX(-50%) translateY(22px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.ib-head { display: flex; align-items: center; gap: 13px; padding-right: 26px; }
.ib-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 13px;
  box-shadow: 0 3px 10px rgba(140, 70, 25, 0.28);
}
.ib-text { min-width: 0; }
.ib-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--title);
  line-height: 1.15;
}
.ib-sub { font-size: 0.8rem; color: var(--muted); margin-top: 2px; line-height: 1.3; }
.install-banner button { border: none; cursor: pointer; }
.ib-install {
  width: 100%;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.2px;
  padding: 13px 16px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--amber) 0%, var(--brand) 45%, var(--brand-2) 100%);
  box-shadow: 0 8px 18px rgba(189, 86, 41, 0.34);
  transition: transform 0.12s ease, filter 0.15s;
}
.ib-install:active { transform: translateY(1px); filter: brightness(0.97); }
.ib-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--peach);
  color: var(--brand-ink);
  font-size: 0.82rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ib-close:active { filter: brightness(0.95); }
