/* =================================================================
   assets/public.css — Car Show Public Pages
   Shared styles for index.php, vote.php, and results.php.
   Uses the same CSS variable tokens as admin.css so both sides
   of the site respond identically to theme/dark-mode changes.

   Structure:
     1.  CSS Variables  (light + dark mode — mirrors admin.css)
     2.  Base           (body, a, headings)
     3.  Layout         (.card, .grid, .info-box)
     4.  Alert/Status   (green, yellow, red boxes + named aliases)
     5.  Forms          (label, input, select, button)
     6.  Typography     (.muted, .footer)
     7.  Shared atoms   (.class-card, .code)
     8.  Responsive     (≤700 px)
================================================================= */

/* ── 1. CSS Variables ─────────────────────────────────────────── */

:root {
    --bg:              #e8eaed;
    --card-bg:         #ffffff;
    --soft-bg:         #f3f4f6;
    --border:          #d1d5db;
    --text:            #111827;
    --text-muted:      #6b7280;
    --link:            #2563eb;

    --green-bg:        #f0fdf4;
    --green-border:    #86efac;
    --green-text:      #15803d;

    --yellow-bg:       #fefce8;
    --yellow-border:   #fde68a;
    --yellow-text:     #854d0e;

    --red-bg:          #fef2f2;
    --red-border:      #fca5a5;
    --red-text:        #991b1b;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:              #0f172a;
        --card-bg:         #1e293b;
        --soft-bg:         #293548;
        --border:          #334155;
        --text:            #f1f5f9;
        --text-muted:      #94a3b8;
        --link:            #60a5fa;

        --green-bg:        #052e16;
        --green-border:    #166534;
        --green-text:      #86efac;

        --yellow-bg:       #1c1400;
        --yellow-border:   #713f12;
        --yellow-text:     #fde68a;

        --red-bg:          #1c0606;
        --red-border:      #7f1d1d;
        --red-text:        #fca5a5;
    }
}

/* ── 2. Base ──────────────────────────────────────────────────── */

body {
    font-family: 'Segoe UI', system-ui, Arial, sans-serif;
    max-width: 900px;
    margin: 20px auto;
    padding: 16px 16px 48px;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: var(--link);
}

h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 10px;
}

h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 12px;
}

h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 8px;
}

/* ── 3. Layout ────────────────────────────────────────────────── */

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px 20px;
    margin-bottom: 18px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

/* Event info tiles on index.php */
.info-box {
    background: var(--soft-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px;
}

.info-box strong {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

/* ── 4. Alert / Status boxes ──────────────────────────────────── */

/* Green — voting open, success, results final */
.status-open,
.message,
.final-box {
    background: var(--green-bg);
    border: 1px solid var(--green-border);
    color: var(--green-text);
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 14px;
}

/* Yellow — voting closed, warning, result pending */
.status-closed,
.warning,
.status-box {
    background: var(--yellow-bg);
    border: 1px solid var(--yellow-border);
    color: var(--yellow-text);
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 14px;
}

/* Red — errors */
.error {
    background: var(--red-bg);
    border: 1px solid var(--red-border);
    color: var(--red-text);
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 14px;
}

/* ── 5. Forms ─────────────────────────────────────────────────── */

label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text);
}

input,
select {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 16px;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 5px;
    line-height: 1.4;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--link);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

select {
    min-height: 44px;
    cursor: pointer;
}

button {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-family: inherit;
    font-weight: 600;
    background: var(--soft-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
    line-height: 1.4;
}

button:hover {
    background: var(--border);
}

/* ── 6. Typography ────────────────────────────────────────────── */

.muted {
    color: var(--text-muted);
    font-size: 14px;
}

.footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 24px;
}

/* ── 7. Shared atoms ──────────────────────────────────────────── */

/* Section divider between ballot classes on vote.php */
.class-card {
    border-top: 1px solid var(--border);
    padding-top: 14px;
    margin-top: 14px;
}

/* Voter code / vehicle number display */
.code {
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Extra top spacing utility (replaces inline style="margin-top:...") */
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }


/* ── Countdown Timer ──────────────────────────────────────────── */

.countdown-wrap {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
    .countdown-wrap {
        border-top-color: rgba(255, 255, 255, 0.1);
    }
}

.countdown-heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 10px;
    opacity: 0.75;
}

.countdown {
    display: flex;
    gap: 8px;
	justify-content: center;
	
}

.cd-tile {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 10px 4px;
    text-align: center;
    flex: 1;
    max-width: 76px;
}

@media (prefers-color-scheme: dark) {
    .cd-tile {
        background: rgba(255, 255, 255, 0.12);
    }
}

.cd-num {
    display: block;
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.cd-unit {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-top: 4px;
    opacity: 0.7;
}

@media (max-width: 380px) {
    .cd-num  { font-size: 20px; }
    .cd-tile { padding: 8px 2px; }
}

/* ── 8. Responsive ────────────────────────────────────────────── */

@media (max-width: 700px) {
    h1 {
        font-size: 24px;
    }

    body {
        margin: 10px auto;
        padding: 12px 12px 32px;
    }

    .card {
        padding: 14px;
    }
}

/* ── Live tally strip ─────────────────────────────────────────── */

.tally-strip {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    padding: 8px 0 14px;
}

.tally-strip strong {
    color: var(--text);
    font-weight: 700;
}

.tally-sep {
    margin: 0 10px;
    opacity: 0.35;
}

/* ── Already-voted device warning ─────────────────────────────── */

.voted-warning {
    background: var(--yellow-bg);
    border: 1px solid var(--yellow-border);
    color: var(--yellow-text);
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.voted-warning button {
    width: auto;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 0;
    flex-shrink: 0;
    white-space: nowrap;
}

/* ── Public Navigation Bar ──────────────────────────────────── */

.public-nav {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 18px;
}

.public-nav-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    gap: 12px;
}

.public-nav-brand {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.public-nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.nav-link {
    display: inline-block;
    padding: 6px 9px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: var(--link);
    white-space: nowrap;
    transition: background 0.1s;
}

.nav-link:hover  { background: var(--soft-bg); text-decoration: none; }
.nav-link-active { background: var(--soft-bg); color: var(--text); }
.nav-link-dim    { color: var(--text-muted); opacity: 0.55; }

/* ── Shared footer nav ───────────────────────────────────────── */

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px 6px;
    margin-bottom: 6px;
}

.footer-sep { color: var(--text-muted); opacity: 0.4; }

.footer-admin {
    text-align: center;
    margin-top: 4px;
    font-size: 12px;
    opacity: 0.6;
}

/* ── Trophy / Awards page ─────────────────────────────────────── */

.awards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.award-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

.award-trophy-img img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 6px;
    background: var(--soft-bg);
}

.award-trophy-placeholder {
    font-size: 60px;
    line-height: 1;
}

.award-class-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    background: var(--soft-bg);
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: 12px;
}

.award-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.award-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.45;
}

.award-winner {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--green-border);
    width: 100%;
    background: var(--green-bg);
    border-radius: 6px;
    padding: 10px;
}

.award-winner-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--green-text);
    margin-bottom: 4px;
}

.award-winner-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.award-vehicle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
}

.award-winner-photo {
    margin-top: 10px;
}

.award-winner-photo img {
    width: 100%;
    max-width: 180px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--border);
}

.award-pending {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

.awards-section-heading {
    font-size: 20px;
    font-weight: 700;
    margin: 8px 0 14px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

/* ── Responsive adjustments ──────────────────────────────────── */

@media (max-width: 700px) {
    .public-nav-inner {
        height: auto;
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 12px 8px;
        gap: 6px;
    }

    .public-nav-links {
        flex-wrap: wrap;
        gap: 2px;
    }

    .nav-link {
        font-size: 12px;
        padding: 5px 7px;
    }

    .awards-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
}
