/* =========================================================
   Punjab CM Vote 2027 -- application styles
   ========================================================= */

:root {
  --bg-0:        #06081a;
  --bg-1:        #0d122e;
  --bg-2:        #161c45;
  --ink:         #f5f7ff;
  --ink-muted:   #aab1d6;
  --ink-faint:   #6b7196;
  --gold:        #f5b301;
  --gold-2:      #ffd54a;
  --saffron:     #f97316;
  --akali-blue:  #1d4ed8;
  --vote-red:    #ef4444;
  --vote-green:  #16a34a;
  --card-frame:  linear-gradient(180deg, #0e1545 0%, #1d2670 100%);
  --card-edge:   linear-gradient(180deg, #f5b301 0%, #b1730b 100%);
  --shadow-lg:   0 20px 50px -10px rgba(0,0,0,.6), 0 8px 20px -8px rgba(0,0,0,.5);
  --radius-lg:   18px;
  --radius-md:   12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: radial-gradient(1200px 800px at 50% -200px, #1a2470 0%, var(--bg-0) 60%) fixed;
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--ink-muted); }

/* ========================= Header ========================= */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(6, 8, 26, .85);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex; align-items: center; gap: 10px; color: var(--ink);
  font-weight: 800; letter-spacing: .2px;
}
.brand:hover { text-decoration: none; }
.brand img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; }
.brand__name { font-size: 17px; }

.nav { display: flex; align-items: center; gap: 16px; }
.nav a { color: var(--ink); font-weight: 500; }
.nav__user { color: var(--ink-muted); }
.nav__logout { display: inline; }

/* ========================= Buttons ========================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; user-select: none;
  font-family: inherit; font-weight: 700; line-height: 1;
  padding: 12px 18px; border-radius: 12px;
  font-size: 15px;
  transition: transform .08s ease, box-shadow .15s ease, opacity .15s ease, background .15s ease;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--sm  { padding: 8px 12px;  font-size: 13px; border-radius: 10px; }
.btn--xs  { padding: 5px 9px;   font-size: 12px; border-radius: 8px;  }
.btn--block { display: flex; width: 100%; }

.btn--primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #1a1300;
  box-shadow: 0 6px 20px -6px rgba(245,179,1,.6);
}
.btn--primary:hover { background: linear-gradient(180deg, #ffe066, var(--gold)); }
.btn--ghost {
  background: rgba(255,255,255,.08); color: var(--ink);
  border: 1px solid rgba(255,255,255,.14);
}
.btn--ghost:hover { background: rgba(255,255,255,.14); }
.btn--ok  { background: var(--vote-green); color: #fff; }
.btn--err { background: var(--vote-red);   color: #fff; }

.btn--cta {
  background: linear-gradient(180deg, #ffe169, var(--gold));
  color: #1a1300; padding: 16px 28px;
  font-size: 18px; letter-spacing: .5px;
  border-radius: 14px;
  box-shadow: 0 12px 40px -12px rgba(245,179,1,.7);
}
.btn__arrow { font-size: 22px; transform: translateY(-1px); }

.btn--vote {
  width: 100%;
  background: linear-gradient(180deg, #fff, #f1f1f1);
  color: #0a0a0a;
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 800;
  letter-spacing: .3px;
}
.btn--vote .accent { color: var(--vote-red); }
.btn--vote.is-voted {
  background: var(--accent);
  color: #fff;
  cursor: default;
}
.btn--vote:disabled { opacity: .55; cursor: not-allowed; }

.btn--provider { color: #fff; padding: 12px 14px; }
.btn--google   { background: #1f1f1f; }
.btn--google:hover { background: #2a2a2a; }
.btn--apple    { background: #000; }
.btn--apple:hover { background: #1f1f1f; }

/* ========================= Flash ========================= */
.flash-stack { padding: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.flash {
  padding: 12px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
}
.flash--ok   { background: rgba(22,163,74,.15);  border-color: rgba(22,163,74,.45);  color: #b6f3c7; }
.flash--err  { background: rgba(239,68,68,.15);  border-color: rgba(239,68,68,.45);  color: #ffc1c1; }
.flash--info { background: rgba(59,130,246,.15); border-color: rgba(59,130,246,.45); color: #c5d9ff; }

/* ========================= Hero ========================= */
.hero {
  position: relative;
  min-height: 360px;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-align: center;
}
.hero__inner {
  padding: 64px 20px 48px;
}
.hero__kicker {
  display: inline-block;
  font-weight: 900; letter-spacing: 2px;
  font-size: 13px; color: var(--gold-2);
  background: rgba(245,179,1,.12);
  border: 1px solid rgba(245,179,1,.4);
  padding: 6px 12px; border-radius: 999px;
  margin-bottom: 18px;
}
.hero__title {
  font-size: clamp(28px, 4.6vw, 56px);
  margin: 0 auto 14px;
  font-weight: 900;
  background: linear-gradient(180deg, #ffe169 0%, var(--gold) 60%, #b97f0a 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 24px rgba(245,179,1,.18);
  max-width: 1000px;
  line-height: 1.05;
}
.hero__subtitle {
  color: var(--ink-muted); font-size: 18px; margin: 0 auto 14px;
  max-width: 720px;
}
.hero__voted {
  margin-top: 18px;
  display: inline-block;
  padding: 10px 18px;
  background: rgba(22,163,74,.18);
  border: 1px solid rgba(22,163,74,.55);
  color: #d3f9dd;
  border-radius: 999px; font-weight: 600;
}

/* ========================= Candidate cards ========================= */
.candidates { padding: 48px 20px 96px; }
.candidates__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}
@media (max-width: 980px) { .candidates__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .candidates__grid { grid-template-columns: 1fr; } }

.card-candidate {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 4px;
  background: var(--card-edge);
  box-shadow: var(--shadow-lg);
  transition: transform .15s ease;
}
.card-candidate:hover { transform: translateY(-4px); }
.card-candidate.is-selected {
  box-shadow: 0 0 0 3px var(--accent), var(--shadow-lg);
}

.card-candidate__frame {
  position: relative;
  background: var(--card-frame);
  border-radius: 14px;
  padding: 16px 14px 16px;
  text-align: center;
  overflow: hidden;
  /* decorative side gold "pillars" reminiscent of the source poster */
  background-image:
    linear-gradient(180deg, rgba(245,179,1,.5), rgba(245,179,1,0)) ,
    var(--card-frame);
  background-size: 100% 6px, 100% 100%;
  background-repeat: no-repeat, no-repeat;
  background-position: top, center;
}
.card-candidate__frame::before,
.card-candidate__frame::after {
  content: '';
  position: absolute; top: 8px; bottom: 8px; width: 6px;
  background: linear-gradient(180deg, #ffd54a, #b1730b);
  border-radius: 4px;
  opacity: .9;
}
.card-candidate__frame::before { left: 6px; }
.card-candidate__frame::after  { right: 6px; }

.card-candidate__name-pa {
  font-family: 'Noto Sans Gurmukhi', system-ui, sans-serif;
  color: var(--gold-2);
  font-weight: 900; font-size: 19px; line-height: 1.15;
  margin-bottom: 4px;
  text-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.card-candidate__title {
  color: #fff; font-size: 12px; font-weight: 600;
  letter-spacing: .3px;
  opacity: .9;
  margin-bottom: 8px;
}
.card-candidate__photo {
  position: relative;
  margin: 6px auto 10px;
  width: 100%;
  aspect-ratio: 1 / 1.05;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(180deg, #fff5d3, #ecbe49);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.15);
}
.card-candidate__photo img {
  width: 100%; height: 100%; object-fit: cover;
}
.card-candidate__name-en {
  color: #fff; font-weight: 700; font-size: 14px;
  margin-bottom: 8px;
  opacity: .95;
}
.card-candidate__stats { margin: 6px 0 12px; }
.bar {
  width: 100%; height: 8px; background: rgba(255,255,255,.12);
  border-radius: 999px; overflow: hidden;
}
.bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent, var(--gold)), color-mix(in srgb, var(--accent, var(--gold)) 60%, white));
  transition: width .6s ease;
}
.stats-row {
  display: flex; justify-content: space-between;
  margin-top: 6px;
  font-size: 12px; color: var(--ink-muted);
}
.stats-row .pct { color: var(--gold-2); font-weight: 700; }

/* ========================= CTA row ========================= */
.cta-row {
  margin-top: 40px;
  display: flex; align-items: center; gap: 24px;
  justify-content: center; flex-wrap: wrap;
}
.cta-row__question {
  font-family: 'Noto Sans Gurmukhi', system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(22px, 3vw, 36px);
  background: linear-gradient(180deg, #fff, #d8d8e8);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.totals {
  text-align: center; color: var(--ink-muted);
  margin-top: 28px;
}

/* ========================= Auth ========================= */
.auth { padding: 48px 20px; display: flex; justify-content: center; }
.auth__card {
  width: 100%; max-width: 460px;
  background: linear-gradient(180deg, rgba(28,36,86,.9), rgba(13,18,46,.9));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}
.auth__card--wide { max-width: 720px; }
.auth__card h1 { margin: 0 0 6px; font-size: 26px; }
.auth__divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--ink-faint); font-size: 13px; margin: 22px 0;
}
.auth__divider::before, .auth__divider::after {
  content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.08);
}
.auth__providers { display: flex; flex-direction: column; gap: 10px; }
.auth__providers--top { margin-top: 18px; }
.auth__footer { color: var(--ink-muted); margin-top: 18px; text-align: center; font-size: 14px; }

/* ========================= Forms ========================= */
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.form--grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.form__submit { grid-column: 1 / -1; margin-top: 8px; }
@media (max-width: 540px) { .form--grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: 13px; color: var(--ink-muted); font-weight: 500; }
.field input, .field select, .field textarea {
  background: rgba(255,255,255,.05);
  color: var(--ink);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  outline: none;
  transition: border-color .15s ease, background .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--gold);
  background: rgba(255,255,255,.08);
}
.field--check { flex-direction: row; align-items: center; gap: 8px; }
.field__phone {
  display: flex; align-items: stretch;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px; overflow: hidden;
}
.field__phone-dial {
  display: inline-flex; align-items: center;
  padding: 0 12px;
  background: rgba(255,255,255,.06);
  color: var(--gold-2); font-weight: 700;
  border-right: 1px solid rgba(255,255,255,.08);
  min-width: 64px; justify-content: center;
}
.field__phone input {
  border: 0; background: transparent; flex: 1;
  padding: 10px 12px; outline: none; color: var(--ink);
}

/* ========================= Footer ========================= */
.site-footer {
  margin-top: 80px; padding: 28px 0 40px;
  border-top: 1px solid rgba(255,255,255,.06);
  color: var(--ink-faint); font-size: 14px; text-align: center;
}

/* ========================= Results ========================= */
.results { padding: 40px 20px; }
.results__list { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-direction: column; gap: 12px; }
.results__row {
  display: grid;
  grid-template-columns: 56px 1fr 130px;
  gap: 16px; align-items: center;
  padding: 14px 18px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
}
.results__row img { width: 56px; height: 56px; object-fit: cover; border-radius: 50%; }
.results__name { font-weight: 700; margin-bottom: 8px; }
.results__numbers { text-align: right; }
.results__numbers .pct { font-size: 22px; font-weight: 900; color: var(--accent, var(--gold-2)); }
.results__numbers .votes { font-size: 12px; color: var(--ink-muted); }

/* ========================= Admin ========================= */
.admin-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  padding: 28px 20px 80px;
}
@media (max-width: 880px) { .admin-shell { grid-template-columns: 1fr; } }

.admin-nav {
  position: sticky; top: 80px; align-self: start;
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
}
.admin-nav__title { font-size: 12px; letter-spacing: 2px; color: var(--ink-faint); margin-bottom: 8px; text-transform: uppercase; }
.admin-nav a {
  display: block; padding: 10px 12px; border-radius: 10px;
  color: var(--ink); font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.admin-nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.admin-nav a.is-active { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #1a1300; }
.admin-nav__back { margin-top: 14px; color: var(--ink-muted) !important; }
.admin-main h1 { margin-top: 0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin: 18px 0 28px;
}
.stat {
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px; padding: 18px; text-align: left;
}
.stat__num   { font-size: 28px; font-weight: 900; }
.stat__label { color: var(--ink-muted); font-size: 13px; margin-top: 4px; }
.stat--ok     { border-color: rgba(22,163,74,.5); }
.stat--warn   { border-color: rgba(245,179,1,.5); }
.stat--err    { border-color: rgba(239,68,68,.5); }
.stat--accent { border-color: rgba(29,78,216,.5); }

.card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
}
.card legend { padding: 0 8px; color: var(--gold-2); font-weight: 700; }

.preview-row { display: grid; grid-template-columns: 1fr 2fr; gap: 14px; margin-bottom: 14px; }
.preview-img { background: #fff2; border-radius: 8px; max-height: 80px; }
.preview-img--wide { max-height: 120px; width: 100%; object-fit: cover; }

/* Admin filters & table */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input[type=text], .filters select {
  background: rgba(255,255,255,.05);
  color: var(--ink);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: 8px 10px;
}

.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid rgba(255,255,255,.07); }
.table {
  width: 100%; border-collapse: collapse; min-width: 920px;
}
.table th, .table td {
  text-align: left; padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  font-size: 14px; vertical-align: middle;
}
.table thead th {
  background: rgba(255,255,255,.04);
  color: var(--ink-muted);
  font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
}
.table tbody tr:hover { background: rgba(255,255,255,.03); }
.table .actions { display: flex; gap: 4px; flex-wrap: wrap; }
.inline { display: inline; }

.pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  font-size: 12px; font-weight: 600; text-transform: capitalize;
}
.pill--active  { background: rgba(22,163,74,.18); border-color: rgba(22,163,74,.5); color: #b6f3c7; }
.pill--pending { background: rgba(245,179,1,.18); border-color: rgba(245,179,1,.5); color: #ffe39a; }
.pill--blocked { background: rgba(239,68,68,.18); border-color: rgba(239,68,68,.5); color: #ffc1c1; }

.pagination { display: flex; gap: 6px; margin-top: 16px; }
.pagination a {
  padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,.06);
  color: var(--ink); border: 1px solid rgba(255,255,255,.1);
}
.pagination a.is-active { background: var(--gold); color: #1a1300; }

.cand-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.cand-edit { border-top: 4px solid var(--accent, var(--gold)); }
.cand-edit__head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.cand-edit__head img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; }
.cand-edit__actions { margin-top: 10px; }

/* ---- Vote adjustment tools (admin -> candidates) ---- */
.vote-tools {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px dashed rgba(255,255,255,.12);
}
.vote-tools__title {
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-muted); margin-bottom: 6px;
}
.vote-tools__numbers {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 13px; margin-bottom: 8px;
}
.vote-tools__numbers .pos { color: #4ade80; }
.vote-tools__numbers .neg { color: #f87171; }
.vote-tools__row {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  margin-top: 6px;
}
.vote-tools__row input[type="number"] {
  width: 90px; padding: 6px 8px; border-radius: 8px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12);
  color: var(--ink);
}

/* ---- Vote badge in users table ---- */
.vote-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: color-mix(in srgb, var(--accent, #888) 18%, transparent);
  color: #fff;
  border: 1px solid color-mix(in srgb, var(--accent, #888) 50%, transparent);
}
.small { font-size: 11px; }

/* ---- Modal (used by user edit form) ---- */
.modal[hidden] { display: none !important; }
.modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(4, 6, 24, .72);
  backdrop-filter: blur(4px);
}
.modal__panel {
  position: relative; z-index: 1;
  width: min(720px, 100%); max-height: calc(100vh - 40px); overflow: auto;
  background: var(--card-frame);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  color: var(--ink);
}
.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.modal__head h3 { margin: 0; font-size: 18px; }
.modal__x {
  background: none; border: 0; color: var(--ink-muted);
  font-size: 24px; line-height: 1; cursor: pointer; padding: 4px 8px;
}
.modal__x:hover { color: var(--ink); }
.modal__body { padding: 18px 20px 20px; }
.modal__actions {
  grid-column: 1 / -1;
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 8px;
}
.field--full { grid-column: 1 / -1; }

.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: 80px; margin: 0; color: var(--gold-2); }
