/* =========================================================
   PSU Student President Election — Design System
   Palette   : Ink Navy / Ballot Gold / Paper / Slate / Signal Green
   Type      : Fraunces (display) + Inter (UI/body) + IBM Plex Mono (data)
   Signature : the "ballot stub" perforated card — used for role
               selection, candidate cards and the vote receipt.
   ========================================================= */

:root {
    --ink:        #1B2A4A;
    --ink-2:      #101B33;
    --ink-soft:   #2F4270;
    --gold:       #E8A33D;
    --gold-dark:  #C97F1E;
    --paper:      #F7F8FA;
    --white:      #FFFFFF;
    --slate:      #5B6478;
    --slate-light:#8B93A7;
    --line:       #E2E5EC;
    --green:      #2F9E63;
    --green-bg:   #E7F6EE;
    --red:        #D64545;
    --red-bg:     #FBEAEA;

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Menlo, monospace;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --shadow-sm: 0 1px 2px rgba(16, 27, 51, 0.06);
    --shadow-md: 0 8px 24px rgba(16, 27, 51, 0.08);
    --shadow-lg: 0 20px 48px rgba(16, 27, 51, 0.16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--paper);
    color: var(--ink);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--ink);
    margin: 0 0 .4em;
    letter-spacing: -0.01em;
}
h1 { font-size: clamp(2rem, 4vw, 2.9rem); font-weight: 600; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; }
p { margin: 0 0 1em; color: var(--slate); }
a { color: var(--ink-soft); text-decoration: none; }
a:hover { color: var(--gold-dark); }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.eyebrow {
    font-family: var(--font-mono);
    font-size: .72rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--gold-dark);
    font-weight: 600;
}

img { max-width: 100%; display: block; }

:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------------------------------------------------------
   Layout shells
--------------------------------------------------------- */
.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px;
}

.center-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.site-header {
    background: var(--ink);
    color: var(--white);
    padding: 18px 0;
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--white); }
.brand__mark {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(145deg, var(--gold), var(--gold-dark));
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-weight: 700; color: var(--ink-2);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text strong { font-family: var(--font-display); font-size: 1.05rem; }
.brand__text span { font-size: .74rem; color: #B9C2DA; letter-spacing: .04em; }

/* ---------------------------------------------------------
   Buttons
--------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--font-body); font-weight: 600; font-size: .95rem;
    padding: 12px 22px; border-radius: var(--radius-sm);
    border: 1px solid transparent; cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
    text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--white); }
.btn-primary:hover { background: var(--ink-soft); color: var(--white); }
.btn-gold { background: var(--gold); color: var(--ink-2); }
.btn-gold:hover { background: var(--gold-dark); color: var(--white); }
.btn-outline { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { background: var(--red); color: var(--white); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: .85rem; }

/* ---------------------------------------------------------
   Forms
--------------------------------------------------------- */
.field { margin-bottom: 18px; text-align: left; }
.field label {
    display: block; font-size: .8rem; font-weight: 600; color: var(--ink);
    margin-bottom: 6px; letter-spacing: .01em;
}
.field input[type="text"],
.field input[type="password"],
.field input[type="file"],
.field textarea,
.field select {
    width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
    border: 1.5px solid var(--line); font-family: var(--font-body); font-size: .95rem;
    background: var(--white); color: var(--ink); transition: border-color .15s ease;
}
.field input:focus, .field textarea:focus, .field select:focus {
    border-color: var(--ink-soft); outline: none;
}
.field-hint { font-size: .78rem; color: var(--slate-light); margin-top: 5px; }

/* ---------------------------------------------------------
   Alerts / badges
--------------------------------------------------------- */
.alert { padding: 13px 16px; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 18px; }
.alert-success { background: var(--green-bg); color: #1E7A4C; border: 1px solid #BFE7D3; }
.alert-error   { background: var(--red-bg); color: #A63333; border: 1px solid #F2C6C6; }
.alert-info    { background: #EAF0FF; color: var(--ink-soft); border: 1px solid #CFDCFA; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 100px; font-size: .72rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.badge-green { background: var(--green-bg); color: #1E7A4C; }
.badge-slate { background: var(--line); color: var(--slate); }
.badge-gold { background: #FBEBD2; color: var(--gold-dark); }

/* ---------------------------------------------------------
   SIGNATURE COMPONENT — Ballot Stub Card
   A ticket-shaped card with a perforated tear line and
   punch-hole notches, used for role selection, candidates,
   and the vote receipt.
--------------------------------------------------------- */
.stub {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: visible;
    border: 1px solid var(--line);
}
.stub__notch {
    position: absolute; width: 22px; height: 22px; background: var(--paper);
    border: 1px solid var(--line); border-radius: 50%; top: 50%; transform: translateY(-50%);
}
.stub__notch--left { left: -12px; }
.stub__notch--right { right: -12px; }
.stub__perf {
    border-top: 2px dashed var(--line);
    margin: 0;
}
.stub__top { padding: 26px 26px 20px; }
.stub__bottom { padding: 20px 26px 26px; }

/* ---------------------------------------------------------
   Role select (landing page)
--------------------------------------------------------- */
.hero {
    background: radial-gradient(1200px 400px at 15% -10%, #24365F 0%, var(--ink) 55%, var(--ink-2) 100%);
    color: var(--white);
    padding: 64px 0 90px;
    text-align: center;
}
.hero h1 { color: var(--white); }
.hero p.lead { color: #C7CFE5; max-width: 560px; margin: 0 auto 8px; font-size: 1.05rem; }

.role-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px;
    margin-top: -64px; padding-bottom: 40px;
}
@media (max-width: 860px) { .role-grid { grid-template-columns: 1fr; } }

.role-card { text-align: left; }
.role-card__icon {
    width: 46px; height: 46px; border-radius: 12px; margin-bottom: 14px;
    display: flex; align-items: center; justify-content: center;
    background: var(--paper); color: var(--ink-soft); font-size: 1.3rem;
}
.role-card h3 { margin-bottom: 6px; }
.role-card p { font-size: .9rem; margin-bottom: 18px; }

/* ---------------------------------------------------------
   Login card
--------------------------------------------------------- */
.login-shell { width: 100%; max-width: 420px; }
.login-shell .stub__top { padding-top: 34px; }
.login-header { text-align: center; margin-bottom: 22px; }
.login-header .eyebrow { display: block; margin-bottom: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--slate); margin-bottom: 18px; }

/* ---------------------------------------------------------
   App shell (admin / staff dashboards)
--------------------------------------------------------- */
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
@media (max-width: 900px) { .app-shell { grid-template-columns: 1fr; } .sidebar { display: none; } }

.sidebar {
    background: var(--ink-2); color: #C7CFE5; padding: 26px 18px;
    display: flex; flex-direction: column; gap: 4px;
}
.sidebar .brand { margin-bottom: 26px; }
.sidebar a {
    color: #C7CFE5; padding: 11px 14px; border-radius: 10px; font-size: .92rem; font-weight: 500;
    display: flex; align-items: center; gap: 10px;
}
.sidebar a:hover { background: rgba(255,255,255,.06); color: var(--white); }
.sidebar a.active { background: var(--gold); color: var(--ink-2); font-weight: 700; }
.sidebar .divider { height: 1px; background: rgba(255,255,255,.1); margin: 14px 0; }
.sidebar .logout { margin-top: auto; }

.main { padding: 30px 34px 60px; }
.main-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; flex-wrap: wrap; gap: 14px; }
.main-header .who { font-size: .85rem; color: var(--slate); }
.topbar-mobile { display: none; background: var(--ink); color: var(--white); padding: 14px 20px; align-items: center; justify-content: space-between; }
@media (max-width: 900px) { .topbar-mobile { display: flex; } }

/* ---------------------------------------------------------
   Stat cards
--------------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 30px; }
.stat-card {
    background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-md);
    padding: 20px 22px; box-shadow: var(--shadow-sm);
}
.stat-card .eyebrow { display: block; margin-bottom: 10px; }
.stat-card .value { font-family: var(--font-mono); font-size: 2rem; font-weight: 700; color: var(--ink); }
.stat-card .delta { font-size: .8rem; color: var(--slate-light); margin-top: 4px; }

.panel {
    background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-md);
    padding: 24px; box-shadow: var(--shadow-sm); margin-bottom: 26px;
}
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.panel-header h3 { margin: 0; }

/* ---------------------------------------------------------
   Tables
--------------------------------------------------------- */
table.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th {
    text-align: left; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .06em;
    text-transform: uppercase; color: var(--slate-light); padding: 10px 12px; border-bottom: 2px solid var(--line);
}
.data-table td { padding: 12px; border-bottom: 1px solid var(--line); color: var(--ink); }
.data-table tr:hover td { background: var(--paper); }
.table-scroll { overflow-x: auto; }

/* ---------------------------------------------------------
   Candidate ballot cards (voting page)
--------------------------------------------------------- */
.candidate-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; margin: 26px 0 30px; }

.ballot-option { cursor: pointer; }
.ballot-option input { position: absolute; opacity: 0; pointer-events: none; }
.ballot-option .stub {
    padding: 0; transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.ballot-option:hover .stub { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.ballot-option input:checked + .stub {
    border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232,163,61,.28), var(--shadow-md);
}
.candidate-photo {
    width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: linear-gradient(135deg, #E7ECF6, #F3F1EA);
}
.candidate-photo--placeholder { display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 2.4rem; color: var(--ink-soft); }
.candidate-body { padding: 18px 20px 8px; }
.candidate-body h3 { margin-bottom: 4px; }
.candidate-body .slogan { font-size: .87rem; color: var(--gold-dark); font-weight: 600; margin-bottom: 8px; }
.candidate-select-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; border-top: 2px dashed var(--line);
}
.radio-dot {
    width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line);
    display: flex; align-items: center; justify-content: center; transition: border-color .15s ease;
}
.radio-dot::after { content: ''; width: 11px; height: 11px; border-radius: 50%; background: var(--gold); opacity: 0; transition: opacity .1s ease; }
.ballot-option input:checked + .stub .radio-dot { border-color: var(--gold); }
.ballot-option input:checked + .stub .radio-dot::after { opacity: 1; }

/* ---------------------------------------------------------
   Vote receipt (confirmation) — the ballot stub, "stamped"
--------------------------------------------------------- */
.receipt { width: 100%; max-width: 460px; text-align: center; }
.receipt .stub__top { padding-top: 40px; }
.receipt-stamp {
    width: 74px; height: 74px; border-radius: 50%; margin: 0 auto 18px;
    background: var(--green-bg); color: var(--green); display: flex; align-items: center; justify-content: center;
    font-size: 2.1rem; border: 2px solid var(--green);
}
.receipt h1 { font-size: 1.5rem; margin-bottom: 6px; }
.receipt .voted-for { font-family: var(--font-display); font-size: 1.6rem; color: var(--ink); margin: 10px 0 4px; }
.receipt .timestamp { font-family: var(--font-mono); font-size: .78rem; color: var(--slate-light); }
.receipt-locked {
    margin-top: 22px; padding: 14px; border-radius: var(--radius-sm); background: var(--paper);
    font-size: .82rem; color: var(--slate); border: 1px dashed var(--line);
}

/* ---------------------------------------------------------
   Chart containers
--------------------------------------------------------- */
.chart-box { position: relative; height: 320px; }
.chart-box--sm { height: 240px; }

/* ---------------------------------------------------------
   Misc utilities
--------------------------------------------------------- */
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.text-center { text-align: center; }
.text-slate { color: var(--slate); }
.small { font-size: .82rem; }
.upload-drop {
    border: 2px dashed var(--line); border-radius: var(--radius-md); padding: 30px;
    text-align: center; background: var(--paper); color: var(--slate);
}
