/* ==========================================================================
   Ganesh Laddu Auction - festive but professional, mobile-first
   ========================================================================== */

/* Guards against elements (e.g. dc-wipewrap) whose own inline display style
   would otherwise fight the hidden attribute. */
[hidden] { display: none !important; }

:root {
  --saffron: #E8770E;
  --saffron-dark: #B5651D;
  --maroon: #8A1C1C;
  --gold: #D4A017;
  --cream: #FFF7EC;
  --cream-2: #FDEFD9;
  --ink: #3A2A15;
  --ink-soft: #6E5A3E;
  --line: #EAD9BE;
  --card: #FFFFFF;
  --good: #1B7F3B;
  --bad: #B3261E;
  --shadow: 0 6px 22px rgba(138, 28, 28, .10);
  --radius: 16px;
  --tap: 52px;
  font-synthesis-weight: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 50% -120px, var(--cream-2), transparent 70%),
    var(--cream);
  -webkit-tap-highlight-color: transparent;
  line-height: 1.45;
}

.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 40px; }
.wrap-wide { max-width: 1100px; }

/* ---- header ------------------------------------------------------------ */
.masthead { text-align: center; padding: 18px 8px 8px; }
.masthead h1 {
  font-size: clamp(20px, 6vw, 28px);
  margin: 0;
  letter-spacing: .5px;
  color: var(--maroon);
  font-weight: 800;
}
.masthead .sub { color: var(--saffron-dark); font-weight: 600; font-size: 14px; margin-top: 2px; }
.masthead .diyas { font-size: 20px; letter-spacing: 6px; }
/* Both source images have a solid white background - frame them in a card so
   that reads as intentional instead of a stray white box, in both themes. */
.temple-logo, .ganesha-img {
  display: block; margin: 0 auto 8px; background: #fff; box-shadow: 0 3px 10px rgba(0,0,0,.18);
}
.temple-logo { height: 44px; width: auto; border-radius: 10px; padding: 4px 10px; }
.ganesha-img { height: 84px; width: auto; border-radius: 14px; padding: 5px; border: 2px solid var(--gold); }
.ganesha-img.lg { height: clamp(90px, 12vw, 160px); border-width: 3px; border-radius: 18px; }
.temple-logo.lg { height: clamp(40px, 5vw, 60px); padding: 6px 14px; }
.brand-logo { height: 40px; width: auto; vertical-align: middle; margin-right: 8px; background: #fff; border-radius: 8px; padding: 3px 8px; }

/* ---- privacy policy popup (iframe in a <dialog>) ------------------ */
dialog.privacy-modal {
  width: min(94vw, 720px); height: min(92vh, 900px); max-width: none; max-height: none;
  padding: 0; border: none; border-radius: 14px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
dialog.privacy-modal::backdrop { background: rgba(0,0,0,.55); }
.privacy-modal-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--maroon); color: #fff; padding: 12px 14px; font-weight: 700;
}
.privacy-modal-close {
  background: rgba(255,255,255,.15); color: #fff; border: none; border-radius: 8px;
  padding: 8px 14px; font-size: 14px; font-weight: 700; cursor: pointer; min-height: 36px;
}
.privacy-modal-close:hover { background: rgba(255,255,255,.25); }
dialog.privacy-modal iframe { width: 100%; height: calc(100% - 46px); border: none; display: block; }
@media (max-width: 480px) {
  dialog.privacy-modal { width: 100vw; height: 100vh; border-radius: 0; }
}

.welcome {
  text-align: center; margin: 10px auto 4px; font-size: 15px; color: var(--ink-soft);
}
.welcome b { color: var(--ink); font-size: 17px; }

/* ---- cards ----------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 14px 0;
}
.card h2 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--ink-soft); }

.highbid {
  text-align: center;
  background: linear-gradient(180deg, #FFFDF8, #FFF3DF);
  border-color: var(--gold);
}
.highbid .amount {
  font-size: clamp(38px, 13vw, 60px);
  font-weight: 800; color: var(--maroon); line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.highbid .bidder { font-size: 18px; font-weight: 700; margin-top: 4px; }
.highbid .bidder .trophy { margin-right: 6px; }
.highbid .muted { color: var(--ink-soft); font-size: 14px; }
.highbid-inner { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.highbid-content { flex: 1; min-width: 160px; }
.highbid-ganesha { margin: 0; flex-shrink: 0; }

/* ---- bid form ------------------------------------------------------- */
.bidform label { display: block; font-weight: 700; margin-bottom: 8px; }
.inputrow { display: flex; gap: 10px; align-items: stretch; }
.inputrow .cur {
  display: flex; align-items: center; padding: 0 14px; font-size: 22px; font-weight: 800;
  background: var(--cream-2); border: 1px solid var(--line); border-radius: 12px; color: var(--maroon);
}
.inputrow input {
  flex: 1; min-width: 0; font-size: 24px; font-weight: 700; padding: 12px 14px;
  border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.inputrow input:focus { outline: none; border-color: var(--saffron); }

button, .btn {
  font: inherit; font-weight: 800; cursor: pointer; border: 0; border-radius: 12px;
  min-height: var(--tap); padding: 12px 18px; color: #fff; background: var(--saffron);
  transition: transform .05s ease, filter .15s ease;
}
button:active, .btn:active { transform: translateY(1px); }
button:disabled { filter: grayscale(.5) opacity(.6); cursor: not-allowed; }
.btn-block { width: 100%; font-size: 20px; margin-top: 12px; }
.btn-maroon { background: var(--maroon); }
.btn-ghost { background: #fff; color: var(--maroon); border: 2px solid var(--line); }
.btn-good { background: var(--good); }
.btn-bad { background: var(--bad); }
.btn-warn { background: var(--gold); color: var(--ink); }
.btn-sm { min-height: 40px; padding: 8px 12px; font-size: 14px; border-radius: 10px; }

.hint { font-size: 13px; color: var(--ink-soft); margin-top: 8px; }
.result { margin-top: 12px; padding: 12px 14px; border-radius: 12px; font-weight: 700; display: none; }
.result.show { display: block; }
.result.ok { background: #E7F5EC; color: var(--good); border: 1px solid #B7E0C4; }
.result.err { background: #FCEBEA; color: var(--bad); border: 1px solid #F2C6C2; }

/* ---- live board --------------------------------------------------- */
.board .live-tag {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1px; font-size: 13px;
}
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
.row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  margin-top: 8px; background: var(--cream); border: 1px solid var(--line);
}
.row .swatch { width: 12px; height: 34px; border-radius: 6px; flex: 0 0 auto; }
.row .name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .amt { font-weight: 800; font-variant-numeric: tabular-nums; }
.row.top {
  background: linear-gradient(90deg, #FFF1D6, #FFE7C0);
  border-color: var(--gold); box-shadow: 0 2px 10px rgba(212,160,23,.25);
}
.row.top .name::before { content: "🏆 "; }
.row.new { animation: slidein .5s ease, flash 1.4s ease; }

.newbid-toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 40;
  background: var(--maroon); color: #fff; padding: 12px 20px; border-radius: 14px;
  font-weight: 800; box-shadow: 0 10px 30px rgba(0,0,0,.25); text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.newbid-toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.newbid-toast small { display: block; font-weight: 600; opacity: .85; }

.announce-toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(-12px); top: 22px; z-index: 60;
  background: linear-gradient(90deg, var(--gold), var(--saffron)); color: #fff; padding: 16px 28px;
  border-radius: 16px; font-weight: 800; font-size: 18px; box-shadow: 0 10px 30px rgba(0,0,0,.3);
  text-align: center; opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s;
  max-width: 90vw;
}
.announce-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- history ----------------------------------------------------- */
table.history { width: 100%; border-collapse: collapse; font-size: 14px; }
table.history th, table.history td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.history td.amt, table.history th.amt { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- overlays (paused / countdown / winner) --------------------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: none;
  align-items: center; justify-content: center; text-align: center;
  background: rgba(58, 20, 20, .92); color: #fff; padding: 24px;
}
.overlay.show { display: flex; }
.overlay .big { font-size: clamp(80px, 34vw, 200px); font-weight: 800; line-height: 1; color: var(--gold);
  font-variant-numeric: tabular-nums; animation: pop .4s ease; }
.overlay .label { font-size: clamp(18px, 5vw, 26px); font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.overlay .muted { opacity: .8; margin-top: 10px; }

.winner .crown { font-size: 54px; }
.winner .wname { font-size: clamp(30px, 9vw, 52px); font-weight: 800; color: var(--gold); margin: 6px 0; }
.winner .wamt { font-size: clamp(28px, 8vw, 44px); font-weight: 800; }
.winner .thanks { margin-top: 16px; opacity: .9; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 49; }
.confetti i {
  position: absolute; top: -10px; width: 9px; height: 14px; opacity: .9;
  animation: fall linear forwards;
}

/* ---- banners / states ------------------------------------------ */
.banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60; text-align: center;
  padding: 8px 12px; font-weight: 700; font-size: 14px; display: none;
}
.banner.show { display: block; }
.banner.warn { background: var(--gold); color: var(--ink); }
.banner.err { background: var(--bad); color: #fff; }

/* ---- manual closing call: a slim banner, NOT a blocking overlay -
   bidding must stay fully usable while the admin narrates the call ---- */
.mc-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 55;
  display: none; align-items: center; justify-content: center; gap: 14px;
  background: linear-gradient(90deg, var(--maroon), #6b1f1f);
  color: #fff; padding: 10px 16px; box-shadow: 0 2px 10px rgba(0,0,0,.3);
}
.mc-banner.show { display: flex; }
.mc-banner .mc-num { font-size: clamp(34px, 9vw, 48px); font-weight: 800; color: var(--gold); line-height: 1; }
.mc-banner .mc-text { font-weight: 700; letter-spacing: 1px; text-transform: uppercase; font-size: 13px; }
.mc-banner .mc-sub { font-weight: 600; font-size: 13px; opacity: .9; }

.centerbox { text-align: center; padding: 40px 16px; }
.centerbox .emoji { font-size: 46px; }
.centerbox h2 { color: var(--maroon); }

.otp-input {
  letter-spacing: 14px; text-align: center; font-size: 30px; font-weight: 800;
  padding: 14px; width: 100%; border: 2px solid var(--line); border-radius: 12px;
}

.spinner { width: 34px; height: 34px; border: 4px solid var(--line); border-top-color: var(--saffron);
  border-radius: 50%; animation: spin 1s linear infinite; margin: 20px auto; }

.foot { text-align: center; color: var(--ink-soft); font-size: 12px; margin-top: 26px; }

/* ---- animations ---------------------------------------------- */
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slidein { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes flash { 0% { background: #FFE07A; } 100% { } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition: none !important; }
  .confetti { display: none !important; }
}

/* ==========================================================================
   DISPLAY / TV MODE
   ========================================================================== */
body.tv { background: radial-gradient(1400px 700px at 50% 0, #23110f, #150a09); color: #fff; }
.tv .stage { max-width: 1400px; margin: 0 auto; padding: 3vh 4vw; text-align: center; }
.tv h1 { color: var(--gold); font-size: clamp(28px, 4.4vw, 60px); margin: 0 0 2vh; letter-spacing: 2px; }
.tv .cur-label { letter-spacing: 4px; text-transform: uppercase; opacity: .7; font-size: clamp(14px, 1.6vw, 22px); }
.tv .cur-amt { font-size: clamp(64px, 15vw, 200px); font-weight: 800; color: #fff; line-height: 1; font-variant-numeric: tabular-nums; }
.tv .cur-name { font-size: clamp(28px, 5vw, 64px); font-weight: 800; color: var(--gold); margin-top: 1vh; }
.tv .rule { height: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); margin: 3vh auto; width: 70%; }
.tv .tv-row { display: flex; justify-content: space-between; font-size: clamp(18px, 2.6vw, 34px); padding: 1vh 4vw; }
.tv .tv-row .amt { font-weight: 800; font-variant-numeric: tabular-nums; }
.tv .livebadge { margin-top: 3vh; font-weight: 800; letter-spacing: 3px; font-size: clamp(16px, 2vw, 26px); }
.tv .tv-count { font-size: clamp(120px, 40vw, 440px); font-weight: 800; color: var(--gold); line-height: 1; }
.pop-anim { animation: pop .4s ease; }
.tv .tv-winner .wn { font-size: clamp(40px, 9vw, 120px); color: var(--gold); font-weight: 800; }
.tv .tv-winner .wa { font-size: clamp(34px, 7vw, 90px); font-weight: 800; }

/* ==========================================================================
   ADMIN
   ========================================================================== */
.admin { background: #F6F1E7; }
.admin .wrap { max-width: 1100px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; flex-wrap: wrap; }
.topbar .brand { font-weight: 800; color: var(--maroon); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; }
.tabs a { padding: 8px 12px; border-radius: 10px; text-decoration: none; color: var(--ink); background: #fff; border: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.tabs a.active { background: var(--maroon); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat .k { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-soft); }
.stat .v { font-size: 22px; font-weight: 800; color: var(--maroon); font-variant-numeric: tabular-nums; }

.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.controls button { min-height: 60px; font-size: 16px; }

.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: 13px; letter-spacing: 1px; }
.pill.DRAFT { background: #EEE; color: #555; }
.pill.READY { background: #EEE; color: #555; }
.pill.LIVE { background: #E7F7EC; color: var(--good); }
.pill.COUNTDOWN { background: #FFF0D6; color: var(--saffron-dark); }
.pill.PAUSED { background: #FFF6D6; color: #8a6d1c; }
.pill.CLOSED { background: #FCEBEA; color: var(--bad); }
.pill.CANCELLED { background: #FCEBEA; color: var(--bad); }

/* Plain-text status coloring (no chip background) for places that already have
   their own badge styling - TV board, bidding view, participant live-tag. */
.st-LIVE { color: var(--good) !important; }
.st-CLOSED, .st-CANCELLED { color: var(--bad) !important; }
.st-COUNTDOWN, .st-PAUSED { color: var(--saffron-dark) !important; }
.st-DRAFT, .st-READY { color: var(--ink-soft) !important; }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.data tr:hover td { background: #FCF7EE; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 12px; }

.field { margin: 10px 0; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

dialog { border: 0; border-radius: 16px; padding: 20px; max-width: 460px; width: calc(100% - 32px); box-shadow: 0 30px 80px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(30,10,10,.5); }

.toast {
  position: fixed; right: 16px; bottom: 16px; background: var(--ink); color: #fff; padding: 12px 16px;
  border-radius: 12px; font-weight: 700; z-index: 100; opacity: 0; transform: translateY(10px); transition: .2s;
}
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--bad); }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; }
.muted { color: var(--ink-soft); }
