/* ==========================================================================
   Best Dressed — shared styles (admin, voting, results)
   Plain CSS, no build step. Dark "event" aesthetic with a gold accent.
   ========================================================================== */

:root {
  --bg: #0e0b14;
  --bg-soft: #171221;
  --panel: #1e1830;
  --panel-2: #251d3a;
  --border: #352a4f;
  --text: #f3eefc;
  --muted: #a99fc4;
  --gold: #e9c46a;
  --gold-strong: #f4b942;
  --accent: #b57edc;
  --danger: #ef6461;
  --success: #4bb96f;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
  --maxw: 960px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 800px at 50% -10%, #241a3a 0%, var(--bg) 55%);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.brand {
  text-align: center;
  margin: 8px 0 24px;
}
.brand .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 12px;
  color: var(--gold);
  font-weight: 600;
}
.brand h1 {
  font-size: clamp(28px, 6vw, 44px);
  margin: 6px 0 0;
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(180deg, #fff 0%, #e9d9ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand .sub { color: var(--muted); margin-top: 6px; }

/* ---------- Cards / panels ---------- */
.card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card + .card { margin-top: 20px; }

/* ---------- Flash / alerts ---------- */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 18px;
  font-weight: 500;
  border: 1px solid transparent;
}
.alert-success { background: rgba(75, 185, 111, 0.14); border-color: rgba(75,185,111,.4); color: #b8f0cb; }
.alert-error   { background: rgba(239, 100, 97, 0.14); border-color: rgba(239,100,97,.4); color: #ffc9c8; }
.alert-info    { background: rgba(181, 126, 220, 0.14); border-color: rgba(181,126,220,.4); color: #e7d3fb; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.field { margin-bottom: 18px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }

input[type="text"],
input[type="number"],
input[type="password"],
input[type="file"],
select {
  width: 100%;
  padding: 13px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(233, 196, 106, 0.18);
}
input.error, select.error { border-color: var(--danger); }
.error-text { color: #ffb0af; font-size: 13px; margin-top: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .05s ease, filter .15s ease, background .15s;
  text-decoration: none;
  line-height: 1;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-primary { background: linear-gradient(180deg, var(--gold-strong), var(--gold)); color: #2a1e05; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-danger { background: rgba(239, 100, 97, 0.16); border-color: rgba(239,100,97,.5); color: #ffc9c8; }
.btn-sm { padding: 8px 12px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Admin bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.topbar .title { font-size: 22px; font-weight: 800; margin: 0; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Candidate admin list ---------- */
.cand-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}
.cand-row + .cand-row { margin-top: 12px; }
.cand-thumb {
  width: 66px; height: 88px; border-radius: 10px; object-fit: cover; object-position: top center;
  background: var(--bg-soft); border: 1px solid var(--border); flex: 0 0 auto;
}
.cand-thumb.placeholder {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 24px; font-weight: 700;
}
.cand-meta { flex: 1 1 auto; min-width: 0; }
.cand-meta .name { font-weight: 700; font-size: 17px; }
.cand-meta .ord { color: var(--muted); font-size: 13px; }
.cand-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ord-btns { display: flex; flex-direction: column; gap: 4px; }
.ord-btns button {
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  width: 30px; height: 26px; border-radius: 7px; cursor: pointer; font-size: 12px; line-height: 1;
}
.ord-btns button:hover { border-color: var(--gold); }

.empty {
  text-align: center; color: var(--muted); padding: 40px 20px;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
}

.inline-form { display: inline; }
.muted { color: var(--muted); }
.center { text-align: center; }
.stack-sm > * + * { margin-top: 10px; }
.footer-note { text-align: center; color: var(--muted); font-size: 13px; margin-top: 28px; }

/* ==========================================================================
   Voting page
   ========================================================================== */
.vote-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 4px 0 22px;
}
.vote-option { position: relative; }
.vote-option input { position: absolute; opacity: 0; pointer-events: none; }
.vote-option label {
  display: block;
  margin: 0;
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel-2);
  transition: border-color .15s, transform .08s, box-shadow .15s;
}
.vote-option label:hover { border-color: var(--accent); }
.vote-option label:active { transform: scale(0.99); }
.vote-option .photo {
  width: 100%;
  aspect-ratio: 3 / 4;            /* portrait — matches phone photos (3:4), full outfit shown */
  object-fit: contain;           /* show the WHOLE outfit, never crop the dress */
  object-position: center;
  display: block;
  /* subtle backdrop so any letterboxing on off-ratio photos looks intentional */
  background:
    radial-gradient(120% 90% at 50% 0%, #221a33 0%, var(--bg-soft) 70%);
}
.vote-option .photo.placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 64px; font-weight: 800; color: var(--muted);
}
.vote-option .cap {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; font-weight: 700; font-size: 16px;
}
.vote-option .tick {
  margin-left: auto;
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: #2a1e05; font-size: 14px; flex: 0 0 auto;
}
.vote-option input:checked + label {
  border-color: var(--gold-strong);
  box-shadow: 0 0 0 4px rgba(233, 196, 106, 0.18);
}
.vote-option input:checked + label .tick {
  background: var(--gold-strong); border-color: var(--gold-strong);
}
.vote-option input:checked + label .tick::after { content: "✓"; }
.vote-option input:focus-visible + label { border-color: var(--gold); }

/* Confirmation / already-voted panels */
.result-panel { text-align: center; padding: 36px 24px; }
.result-panel .badge {
  width: 76px; height: 76px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 38px; margin-bottom: 12px;
}
.result-panel .badge.ok { background: rgba(75,185,111,.18); }
.result-panel .badge.warn { background: rgba(233,196,106,.18); }
.result-panel h2 { margin: 6px 0; font-size: 26px; }
.result-panel p { color: var(--muted); margin: 4px 0 0; }

/* ==========================================================================
   Results dashboard (LED screen)
   ========================================================================== */
.results-body {
  background: radial-gradient(1400px 900px at 50% -10%, #241a3a 0%, var(--bg) 55%);
}
.wrap.wide { max-width: 1200px; }
.results-head { text-align: center; margin: 6px 0 22px; }
.results-head .eyebrow {
  text-transform: uppercase; letter-spacing: .3em; color: var(--gold);
  font-weight: 700; font-size: clamp(11px, 1.4vw, 15px);
}
.results-head h1 {
  font-size: clamp(30px, 5vw, 58px); margin: 4px 0 0; font-weight: 800;
  background: linear-gradient(180deg, #fff, #e9d9ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.results-head .total { color: var(--muted); margin-top: 8px; font-size: clamp(14px, 1.8vw, 20px); }

.leader-cards {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 26px;
}
.leader-card {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; text-align: center; position: relative;
  min-width: 0; /* allow the grid track to shrink below content width */
  transition: border-color .3s, box-shadow .3s, transform .3s;
}
.leader-card .nm {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.leader-card.is-leader {
  border-color: var(--gold-strong);
  box-shadow: 0 0 0 2px rgba(244,185,66,.25), 0 18px 40px -18px rgba(244,185,66,.5);
  transform: translateY(-4px);
}
.leader-card .crown {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  font-size: 26px; opacity: 0; transition: opacity .3s;
}
.leader-card.is-leader .crown { opacity: 1; }
.leader-card .avatar {
  width: 100%; max-width: 150px; aspect-ratio: 3 / 4; height: auto;
  border-radius: 14px; object-fit: cover; object-position: top center;
  margin: 6px auto 10px; display: block; border: 3px solid var(--border);
  background: var(--bg-soft);
}
.leader-card.is-leader .avatar { border-color: var(--gold-strong); }
.leader-card .avatar.placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; font-weight: 800; color: var(--muted);
}
.leader-card .nm { font-weight: 700; font-size: clamp(15px, 1.6vw, 19px); }
.leader-card .ct {
  font-size: clamp(26px, 3.2vw, 40px); font-weight: 800; margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.leader-card .pct { color: var(--muted); font-size: 13px; }

/* Bar chart */
.bars { display: flex; flex-direction: column; gap: 16px; }
.bar-row { display: grid; grid-template-columns: 190px 1fr 90px; align-items: center; gap: 16px; }
.bar-row .bl { display: flex; align-items: center; gap: 10px; font-weight: 700; min-width: 0; }
.bar-row .bl .swatch { width: 14px; height: 14px; border-radius: 4px; flex: 0 0 auto; }
.bar-row .bl .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: clamp(14px,1.6vw,19px); }
.bar-track {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; height: 34px; overflow: hidden; position: relative;
}
.bar-fill {
  height: 100%; width: 0; border-radius: 999px;
  transition: width 700ms cubic-bezier(.22,.61,.36,1);
  min-width: 3px;
}
.bar-row .bc {
  text-align: right; font-weight: 800; font-size: clamp(18px, 2.2vw, 26px);
  font-variant-numeric: tabular-nums;
}
.results-foot { text-align: center; color: var(--muted); margin-top: 24px; font-size: 13px; }
.pulse-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); margin-right: 6px; vertical-align: middle;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(75,185,111,.5); }
  70% { box-shadow: 0 0 0 8px rgba(75,185,111,0); }
  100% { box-shadow: 0 0 0 0 rgba(75,185,111,0); }
}

@media (max-width: 720px) {
  .vote-grid { grid-template-columns: repeat(2, 1fr); }
  .leader-cards { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .leader-card { padding: 8px; }
  .leader-card .avatar { max-width: 100%; border-width: 2px; }
  .bar-row { grid-template-columns: 110px 1fr 56px; gap: 8px; }
}
@media (max-width: 460px) {
  .vote-grid { grid-template-columns: 1fr 1fr; }
  .leader-cards { gap: 6px; }
  .leader-card { padding: 6px; border-radius: 12px; }
  .leader-card .avatar { max-width: 100%; margin-bottom: 6px; border-width: 2px; border-radius: 10px; }
  .leader-card .crown { font-size: 18px; top: -10px; }
  .leader-card .pct { display: none; }
  .bar-row { grid-template-columns: 84px 1fr 40px; gap: 6px; }
  .bar-track { height: 26px; }
}

