/* =============================================
   School Voting System — Clean White Theme
   Fully Responsive: Mobile → Desktop
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300..900;1,14..32,300..900&display=swap');

/* ── CSS VARIABLES ───────────────────────────── */
:root {
    --primary:       #2563eb;
    --primary-light: #dbeafe;
    --primary-dark:  #1d4ed8;
    --primary-faint: #eff6ff;

    --success:       #059669;
    --success-light: #d1fae5;
    --success-faint: #ecfdf5;

    --warning:       #d97706;
    --warning-light: #fef3c7;

    --purple:        #7c3aed;
    --purple-light:  #ede9fe;

    --danger:        #dc2626;
    --danger-light:  #fee2e2;

    --dark:          #0f172a;
    --gray-900:      #111827;
    --gray-700:      #374151;
    --gray-600:      #4b5563;
    --gray-500:      #6b7280;
    --gray-400:      #9ca3af;
    --gray-300:      #d1d5db;
    --gray-200:      #e5e7eb;
    --gray-100:      #f3f4f6;
    --gray-50:       #f9fafb;

    --bg:            #f1f5f9;
    --white:         #ffffff;

    --card-radius:   16px;
    --radius-sm:     10px;
    --radius-xs:     8px;

    --shadow-xs:  0 1px 2px rgba(0,0,0,.05);
    --shadow-sm:  0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
    --shadow:     0 4px 16px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
    --shadow-lg:  0 10px 40px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.06);
    --shadow-xl:  0 20px 60px rgba(0,0,0,.12);

    --sidebar-w: 260px;
    --topbar-h:  64px;

    --transition: .2s ease;
}

/* ── GLOBAL ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--gray-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100dvh;
}

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

a { text-decoration: none; color: inherit; }

/* ══════════════════════════════════════════════
   LANDING PAGE
══════════════════════════════════════════════ */
.landing-page {
    background: var(--bg);
}

.landing-hero {
    min-height: 100dvh;
    background: linear-gradient(160deg, #eff6ff 0%, #f0f9ff 40%, #fafafa 100%);
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.landing-hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #7c3aed, var(--success));
    z-index: 2;
}

.landing-hero::after {
    content: '';
    position: absolute;
    top: -120px; right: -120px;
    width: 480px; height: 480px;
    background: radial-gradient(circle, rgba(37,99,235,.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 50% at 15% 80%, rgba(37,99,235,.05) 0%, transparent 70%),
        radial-gradient(ellipse 40% 60% at 85% 20%, rgba(124,58,237,.04) 0%, transparent 70%);
    pointer-events: none;
}

.school-badge {
    width: 76px; height: 76px;
    background: linear-gradient(135deg, var(--primary), #1d4ed8);
    border-radius: 22px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 2rem; color: white;
    box-shadow: 0 8px 28px rgba(37,99,235,.28);
    margin: 0 auto;
    flex-shrink: 0;
}

.landing-hero-title {
    font-size: clamp(1.75rem, 5vw, 3rem);
    font-weight: 900;
    color: var(--dark);
    line-height: 1.1;
    letter-spacing: -.025em;
}

.landing-hero-sub {
    font-size: clamp(.9rem, 2vw, 1.15rem);
    color: var(--gray-500);
    font-weight: 500;
}

/* Status pill */
.landing-status-pill {
    display: inline-flex; align-items: center; gap: .4rem;
    background: white;
    border: 1.5px solid var(--gray-200);
    border-radius: 999px;
    padding: .35rem 1rem;
    font-size: .8rem;
    color: var(--gray-700);
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}
.landing-status-pill .dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--success);
    animation: pulse-dot 2s infinite;
    flex-shrink: 0;
}
.landing-status-pill .dot.closed { background: var(--gray-400); animation: none; }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .5; transform: scale(.75); }
}

/* Landing cards */
.landing-card {
    background: var(--white);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow);
    height: 100%;
    display: flex; flex-direction: column;
    border: 1.5px solid var(--gray-100);
    transition: transform var(--transition), box-shadow var(--transition);
    position: relative;
    overflow: hidden;
}
.landing-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 20px 20px 0 0;
}
.landing-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-vote::before    { background: linear-gradient(90deg, var(--success), #10b981); }
.card-results::before { background: linear-gradient(90deg, var(--primary), #3b82f6); }
.card-admin::before   { background: linear-gradient(90deg, var(--purple), #a78bfa); }
.card-closed::before  { background: linear-gradient(90deg, var(--gray-300), var(--gray-200)); }

.card-icon {
    width: 56px; height: 56px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.1rem;
    flex-shrink: 0;
}
.card-vote    .card-icon { background: var(--success-light); color: var(--success); }
.card-results .card-icon { background: var(--primary-light); color: var(--primary); }
.card-admin   .card-icon { background: var(--purple-light);  color: var(--purple); }
.card-closed  .card-icon { background: var(--gray-100);      color: var(--gray-500); }

.card-title { font-size: 1.2rem; font-weight: 800; color: var(--dark); margin-bottom: .35rem; }
.card-desc  { font-size: .875rem; color: var(--gray-500); flex: 1; line-height: 1.55; }

.stat-row   { display: flex; align-items: baseline; gap: .4rem; margin: .85rem 0; }
.stat-num   { font-size: 2rem; font-weight: 900; color: var(--dark); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--gray-500); font-weight: 500; }

/* Action buttons */
.btn-vote    { background: var(--success); border-color: var(--success); color: white; font-weight: 600; }
.btn-vote:hover { background: #047857; border-color: #047857; color: white; }
.btn-results { background: var(--primary); border-color: var(--primary); color: white; font-weight: 600; }
.btn-results:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; }
.btn-admin   { background: var(--purple); border-color: var(--purple); color: white; font-weight: 600; }
.btn-admin:hover { background: #6d28d9; border-color: #6d28d9; color: white; }

.landing-footer {
    display: flex; align-items: center; justify-content: center; gap: .5rem;
    margin-top: 2.5rem;
    font-size: .78rem;
    color: var(--gray-400);
    font-weight: 500;
    flex-wrap: wrap;
    text-align: center;
}


/* ══════════════════════════════════════════════
   ADMIN LAYOUT — Sidebar + Topbar
══════════════════════════════════════════════ */
.admin-wrapper {
    display: flex;
    min-height: 100dvh;
    background: var(--bg);
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--white);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; height: 100%;
    z-index: 200;
    overflow-y: auto;
    border-right: 1.5px solid var(--gray-200);
    box-shadow: var(--shadow-xs);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    overscroll-behavior: contain;
}

.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,23,42,.45);
    backdrop-filter: blur(2px);
    z-index: 199;
    opacity: 0;
    transition: opacity .3s;
}
.sidebar-overlay.show { display: block; opacity: 1; }

.sidebar-logo {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1.5px solid var(--gray-100);
    display: flex; align-items: center; gap: .8rem;
    flex-shrink: 0;
}
.sidebar-logo .logo-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--primary), #1d4ed8);
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem; color: white;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(37,99,235,.22);
}
.sidebar-logo .logo-text { font-weight: 800; font-size: .95rem; color: var(--dark); line-height: 1.2; }
.sidebar-logo .logo-sub  { font-size: .7rem; color: var(--gray-500); font-weight: 500; margin-top: 1px; }

.sidebar-nav { padding: .75rem 0; flex: 1; }
.sidebar-nav .nav-section {
    font-size: .64rem; font-weight: 700; letter-spacing: .1em;
    text-transform: uppercase; color: var(--gray-400);
    padding: .85rem 1.25rem .25rem;
}
.sidebar-nav a {
    display: flex; align-items: center; gap: .7rem;
    padding: .6rem 1.25rem;
    color: var(--gray-700); text-decoration: none;
    font-size: .85rem; font-weight: 500;
    border-left: 3px solid transparent;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    margin: .03rem 0;
    border-radius: 0;
}
.sidebar-nav a:hover {
    background: var(--gray-50);
    color: var(--primary);
    border-left-color: var(--primary-light);
}
.sidebar-nav a.active {
    background: var(--primary-faint);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}
.sidebar-nav a i { width: 17px; text-align: center; flex-shrink: 0; font-size: .95em; }
.sidebar-nav a .bi-box-arrow-up-right { margin-left: auto; font-size: .7em; opacity: .6; }

.sidebar-footer {
    padding: .75rem 1.25rem;
    border-top: 1.5px solid var(--gray-100);
    flex-shrink: 0;
}
.sidebar-footer a {
    display: flex; align-items: center; gap: .6rem;
    color: var(--gray-500); font-size: .82rem; text-decoration: none;
    font-weight: 500;
    padding: .5rem .6rem;
    border-radius: var(--radius-xs);
    transition: background var(--transition), color var(--transition);
    border-left: 3px solid transparent;
}
.sidebar-footer a:hover { background: var(--danger-light); color: var(--danger); }

/* ── Main content ── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex; flex-direction: column;
    min-width: 0;
    transition: margin-left .3s cubic-bezier(.4,0,.2,1);
}

/* ── Topbar ── */
.topbar {
    background: var(--white);
    padding: 0 1.5rem;
    height: var(--topbar-h);
    border-bottom: 1.5px solid var(--gray-200);
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 100;
    box-shadow: var(--shadow-xs);
    gap: 1rem;
}
.topbar-left  { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }
.topbar-title { font-size: 1.05rem; font-weight: 800; color: var(--dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub   { font-size: .72rem; color: var(--gray-500); font-weight: 500; margin-top: 1px; }

/* Hamburger */
.sidebar-toggle {
    display: none;
    background: none; border: none;
    font-size: 1.25rem; color: var(--gray-700);
    cursor: pointer; padding: .3rem;
    line-height: 1;
    border-radius: var(--radius-xs);
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--gray-100); color: var(--dark); }

/* ── Page body ── */
.page-body {
    padding: 1.5rem;
    flex: 1;
}

/* Breadcrumb / page headings */
.page-heading {
    margin-bottom: 1.25rem;
}
.page-heading h4 {
    font-size: 1.1rem; font-weight: 800; color: var(--dark); margin: 0;
}


/* ══════════════════════════════════════════════
   STAT CARDS
══════════════════════════════════════════════ */
.stat-card {
    background: var(--white);
    border-radius: var(--card-radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 1rem;
    border: 1.5px solid var(--gray-100);
    border-left: 4px solid var(--primary);
    transition: transform var(--transition), box-shadow var(--transition);
    overflow: hidden;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card.green  { border-left-color: var(--success); }
.stat-card.purple { border-left-color: var(--purple); }
.stat-card.gold   { border-left-color: var(--warning); }

.stat-icon {
    width: 50px; height: 50px; border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; flex-shrink: 0;
}
.stat-card          .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-card.green    .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card.purple   .stat-icon { background: var(--purple-light);  color: var(--purple); }
.stat-card.gold     .stat-icon { background: var(--warning-light); color: var(--warning); }

.stat-value { font-size: 1.85rem; font-weight: 900; line-height: 1; color: var(--dark); }
.stat-label { font-size: .76rem; color: var(--gray-500); margin-top: .15rem; font-weight: 500; }


/* ══════════════════════════════════════════════
   TABLES
══════════════════════════════════════════════ */
.data-table-wrap {
    background: var(--white);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    border: 1.5px solid var(--gray-100);
    overflow: hidden;
}
.data-table-wrap .table-header {
    padding: 1rem 1.25rem;
    border-bottom: 1.5px solid var(--gray-100);
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: .6rem;
}
.data-table-wrap .table-header h5 {
    margin: 0; font-weight: 700; font-size: .9rem; color: var(--dark);
}
.data-table-wrap .table { margin: 0; font-size: .875rem; }
.data-table-wrap .table th {
    font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--gray-500); font-weight: 600;
    background: var(--gray-50);
    border-top: none; padding: .7rem 1.25rem;
    white-space: nowrap;
}
.data-table-wrap .table td {
    vertical-align: middle;
    padding: .8rem 1.25rem;
    border-color: var(--gray-100);
}
.data-table-wrap .table tbody tr:hover { background: var(--gray-50); }
.data-table-wrap .table tbody tr:last-child td { border-bottom: none; }


/* ══════════════════════════════════════════════
   FORM CARD
══════════════════════════════════════════════ */
.form-card {
    background: var(--white);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1.5px solid var(--gray-100);
}
.form-card h5, .form-card h6 {
    font-weight: 700; color: var(--dark);
    margin-bottom: 1rem;
}


/* ══════════════════════════════════════════════
   BADGES
══════════════════════════════════════════════ */
.badge-school   { background: var(--primary-light); color: #1d4ed8; font-weight: 600; }
.badge-category { background: var(--purple-light);  color: #6d28d9; font-weight: 600; }
.badge-open     { background: var(--success-light); color: #065f46; font-weight: 600; }
.badge-closed   { background: var(--danger-light);  color: #991b1b; font-weight: 600; }


/* ══════════════════════════════════════════════
   ADMIN LOGIN PAGE
══════════════════════════════════════════════ */
.login-page {
    background: linear-gradient(160deg, #eff6ff 0%, #f0f9ff 50%, #f8fafc 100%);
    min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem 1rem;
    position: relative;
}
.login-page::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #7c3aed);
}

.login-card {
    background: var(--white);
    border-radius: 22px;
    padding: 2.5rem 2.25rem;
    width: 100%; max-width: 420px;
    box-shadow: var(--shadow-xl);
    border: 1.5px solid var(--gray-100);
}

.login-logo {
    text-align: center; margin-bottom: 1.75rem;
}
.login-logo .icon {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--primary), #1d4ed8);
    border-radius: 17px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.75rem; color: white;
    margin-bottom: .8rem;
    box-shadow: 0 8px 24px rgba(37,99,235,.27);
}
.login-logo h4 { font-weight: 800; color: var(--dark); font-size: 1.25rem; margin-bottom: .2rem; }
.login-logo p  { color: var(--gray-500); font-size: .85rem; margin: 0; }

/* Input groups */
.login-card .form-control,
.login-card .form-select {
    border-color: var(--gray-200);
    border-radius: var(--radius-sm);
    padding: .65rem 1rem;
    font-size: .92rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}


/* ══════════════════════════════════════════════
   VOTE PAGE
══════════════════════════════════════════════ */
.vote-page {
    background: var(--bg);
    min-height: 100dvh;
}

.vote-header {
    background: var(--white);
    padding: 1rem 1.5rem;
    text-align: center;
    border-bottom: 1.5px solid var(--gray-200);
    box-shadow: var(--shadow-xs);
    position: sticky; top: 0; z-index: 40;
}
.vote-header::before {
    content: '';
    display: block;
    height: 3px;
    margin: -1rem -1.5rem 1rem;
    background: linear-gradient(90deg, var(--primary), #7c3aed, var(--success));
}
.vote-header h1 {
    color: var(--dark); font-size: clamp(1.1rem, 3vw, 1.5rem); font-weight: 800; margin: 0;
}
.vote-header p  { color: var(--gray-500); margin: .25rem 0 0; font-size: .85rem; }

.position-section { margin-bottom: 2rem; }

.position-title {
    font-size: .8rem; font-weight: 700; color: var(--gray-700);
    text-transform: uppercase; letter-spacing: .08em;
    padding: .65rem 1rem;
    background: var(--white);
    border-radius: var(--radius-sm);
    margin-bottom: .9rem;
    border: 1.5px solid var(--gray-200);
    border-left: 4px solid var(--primary);
    display: flex; align-items: center; flex-wrap: wrap; gap: .4rem;
    box-shadow: var(--shadow-xs);
}

.candidate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: .85rem;
}

/* Candidate cards */
.candidate-card {
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: 15px;
    padding: 1.35rem .9rem;
    text-align: center;
    cursor: pointer;
    transition: all .18s ease;
    user-select: none;
    box-shadow: var(--shadow-xs);
    -webkit-tap-highlight-color: transparent;
}
.candidate-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(37,99,235,.11);
    transform: translateY(-2px);
}
.candidate-card.selected {
    background: var(--primary-faint);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37,99,235,.13), var(--shadow-sm);
    transform: translateY(-2px);
}

.candidate-photo {
    width: 82px; height: 82px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--gray-200);
    margin: 0 auto .75rem;
    display: block;
    transition: border-color var(--transition);
}
.candidate-card.selected .candidate-photo { border-color: var(--primary); }

.candidate-photo-placeholder {
    width: 82px; height: 82px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
    border: 3px solid var(--gray-200);
    margin: 0 auto .75rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; color: var(--gray-400);
}
.candidate-card.selected .candidate-photo-placeholder { border-color: var(--primary); color: var(--primary); }

.candidate-name  { color: var(--dark); font-weight: 700; font-size: .88rem; margin: 0; }
.candidate-class { color: var(--gray-500); font-size: .76rem; margin-top: .15rem; font-weight: 500; }

.selected-check {
    color: var(--primary); font-size: 1.15rem; margin-top: .45rem;
    display: none;
}
.candidate-card.selected .selected-check { display: block; }

/* Submit bar */
.vote-submit-bar {
    position: sticky; bottom: 0;
    background: linear-gradient(0deg, rgba(255,255,255,1) 60%, rgba(255,255,255,0));
    padding: 1.25rem 1.5rem 1.5rem;
    text-align: center;
}
.vote-submit-bar .btn-vote {
    font-size: 1rem; padding: .8rem 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(5,150,105,.28);
    width: 100%; max-width: 380px;
}


/* ══════════════════════════════════════════════
   CONFIRM MODAL
══════════════════════════════════════════════ */
.confirm-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center; justify-content: center;
    padding: 1rem;
}
.confirm-overlay.show { display: flex; }

.confirm-box {
    background: var(--white);
    border-radius: 22px;
    padding: 2rem;
    max-width: 480px; width: 100%;
    box-shadow: var(--shadow-xl);
    border: 1.5px solid var(--gray-100);
    animation: modal-in .22s cubic-bezier(.175,.885,.32,1.275);
    max-height: 90dvh;
    overflow-y: auto;
}
@keyframes modal-in {
    from { opacity: 0; transform: scale(.92) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.confirm-box h4 { color: var(--dark); font-weight: 800; margin-bottom: .35rem; font-size: 1.1rem; }
.confirm-box p  { color: var(--gray-500); font-size: .86rem; margin-bottom: .9rem; }

.confirm-candidate {
    display: flex; align-items: center; gap: .85rem;
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: 11px; padding: .75rem .9rem;
    margin: .5rem 0;
}
.confirm-name  { color: var(--dark); font-weight: 700; font-size: .88rem; }
.confirm-pos   { color: var(--gray-500); font-size: .76rem; font-weight: 500; }


/* ══════════════════════════════════════════════
   THANK YOU SCREEN
══════════════════════════════════════════════ */
.thankyou-page {
    background: var(--bg);
    min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem;
}

.thankyou-card {
    background: var(--white);
    border-radius: 26px;
    text-align: center;
    padding: 3rem 2rem;
    max-width: 440px; width: 100%;
    box-shadow: var(--shadow-xl);
    border: 1.5px solid var(--gray-100);
}

.thankyou-icon {
    width: 96px; height: 96px;
    background: linear-gradient(135deg, var(--success), #10b981);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.8rem; color: white;
    margin: 0 auto 1.5rem;
    box-shadow: 0 10px 28px rgba(5,150,105,.28);
    animation: pop .45s cubic-bezier(.175,.885,.32,1.275);
}
@keyframes pop {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.thankyou-card h2 {
    color: var(--dark); font-size: 1.75rem; font-weight: 900; margin-bottom: .5rem;
}
.thankyou-card p  { color: var(--gray-500); font-size: .95rem; }

.countdown-ring {
    display: inline-flex; align-items: center; gap: .4rem;
    background: var(--warning-light);
    color: var(--warning);
    font-size: .95rem; font-weight: 700;
    padding: .5rem 1.15rem;
    border-radius: 999px;
    margin-top: 1.5rem;
}


/* ══════════════════════════════════════════════
   RESULTS PAGE
══════════════════════════════════════════════ */
.results-page {
    background: var(--bg);
    min-height: 100dvh;
    color: var(--dark);
}

.results-header {
    background: var(--white);
    text-align: center;
    padding: 1.1rem 1.5rem;
    border-bottom: 1.5px solid var(--gray-200);
    box-shadow: var(--shadow-xs);
    position: sticky; top: 0; z-index: 40;
}
.results-header::before {
    content: '';
    display: block;
    height: 4px;
    margin: -1.1rem -1.5rem 1.1rem;
    background: linear-gradient(90deg, var(--primary), #7c3aed, var(--warning));
}
.results-header h1 {
    font-size: clamp(1.1rem, 3vw, 1.8rem);
    font-weight: 900;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--dark);
    margin: .2rem 0 0;
}

.live-dot {
    display: inline-block; width: 9px; height: 9px;
    background: var(--success); border-radius: 50%;
    margin-right: .35rem;
    animation: pulse-dot 1.5s infinite;
}
.live-label {
    font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
    font-weight: 700; color: var(--success);
    vertical-align: middle;
}

.results-footer {
    text-align: center;
    padding: .85rem 1rem;
    border-top: 1.5px solid var(--gray-200);
    color: var(--gray-400);
    font-size: .76rem;
    background: var(--white);
    font-weight: 500;
}

/* Results grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
    padding: 1.5rem;
}

.result-block {
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: 18px;
    padding: 1.5rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
}
.result-block:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.result-pos-title {
    text-align: center;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-bottom: 1.25rem;
    padding-bottom: .75rem;
    border-bottom: 1.5px solid var(--gray-100);
}

.bar-chart-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1.25rem;
    min-height: 160px;
    padding-bottom: .4rem;
}

.bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 130px;
    gap: .25rem;
}

.vote-count-above {
    font-size: 1.3rem; font-weight: 900; color: var(--dark);
}
.bar-wrap { width: 100%; display: flex; justify-content: center; }
.bar {
    width: 52px; min-height: 4px;
    border-radius: 7px 7px 0 0;
    background: linear-gradient(180deg, #60a5fa 0%, var(--primary) 100%);
    transition: height 1.2s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 -2px 8px rgba(37,99,235,.18);
}
.bar.is-leader {
    background: linear-gradient(180deg, #fbbf24 0%, var(--warning) 100%);
    box-shadow: 0 -2px 14px rgba(217,119,6,.3);
}
.bar-base {
    width: 100%; height: 2px;
    background: var(--gray-200);
    margin-bottom: .4rem;
    border-radius: 1px;
}

.cand-photo {
    width: 54px; height: 54px; border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--gray-200);
}
.cand-photo.is-leader-photo { border-color: var(--warning); }
.cand-photo-placeholder {
    width: 54px; height: 54px; border-radius: 50%;
    background: var(--gray-100);
    border: 3px solid var(--gray-200);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; color: var(--gray-400);
}

.cand-name { font-size: .8rem; font-weight: 700; color: var(--dark); text-align: center; }
.cand-pct  { font-size: .72rem; color: var(--gray-500); font-weight: 500; }
.leader-badge { font-size: .78rem; margin-top: .2rem; font-weight: 600; }

.loading-spinner {
    display: flex; align-items: center; justify-content: center;
    min-height: 200px; color: var(--gray-400);
}

#statusBar {
    text-align: center; padding: .5rem 1rem;
    font-size: .8rem; font-weight: 600;
    background: var(--danger-light); color: var(--danger);
    border-bottom: 1.5px solid #fca5a5;
}


/* ══════════════════════════════════════════════
   PHOTO PREVIEW
══════════════════════════════════════════════ */
.photo-preview-wrap img {
    width: 72px; height: 72px; border-radius: 50%;
    object-fit: cover; border: 2px solid var(--gray-200);
    margin-top: .4rem;
}


/* ══════════════════════════════════════════════
   ALERTS
══════════════════════════════════════════════ */
.alert {
    border-radius: 11px;
    border: none;
    font-weight: 500;
    font-size: .875rem;
    padding: .75rem 1rem;
}
.alert-success { background: var(--success-light); color: #065f46; }
.alert-danger  { background: var(--danger-light);  color: #991b1b; }
.alert-warning { background: var(--warning-light); color: #92400e; }


/* ══════════════════════════════════════════════
   GENERAL FORM CONTROLS
══════════════════════════════════════════════ */
.form-control, .form-select {
    border-color: var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: .88rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-label {
    font-weight: 600; font-size: .82rem; color: var(--gray-700);
    margin-bottom: .35rem;
}
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: .875rem;
    transition: all var(--transition);
}
.btn-primary {
    background: var(--primary); border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-dark); border-color: var(--primary-dark);
}
.btn-sm { border-radius: var(--radius-xs); font-size: .8rem; }


/* ══════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
══════════════════════════════════════════════ */

/* Large tablet: ≤ 1100px */
@media (max-width: 1100px) {
    :root { --sidebar-w: 240px; }
    .results-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

/* Tablet / large mobile: ≤ 768px */
@media (max-width: 768px) {
    :root { --topbar-h: 58px; }

    /* Sidebar goes off-canvas */
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
        box-shadow: var(--shadow-xl);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: flex; align-items: center; justify-content: center; }

    .topbar { padding: 0 1rem; }
    .page-body { padding: 1rem; }

    /* Vote page */
    .vote-header { padding: .85rem 1rem; }
    .candidate-grid {
        grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
        gap: .65rem;
    }
    .candidate-card { padding: 1.1rem .75rem; }
    .candidate-photo,
    .candidate-photo-placeholder { width: 70px; height: 70px; font-size: 1.75rem; }
    .vote-submit-bar { padding: 1rem 1rem 1.25rem; }
    .vote-submit-bar .btn-vote { max-width: 100%; }

    /* Results */
    .results-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: .9rem;
    }
    .bar-chart-container { gap: .9rem; min-height: 130px; }
    .bar { width: 40px; }

    /* Landing */
    .landing-card { padding: 1.5rem 1.25rem; }
    .school-badge { width: 62px; height: 62px; font-size: 1.7rem; }

    /* Confirm modal */
    .confirm-box { padding: 1.5rem; border-radius: 18px; }

    /* Tables */
    .data-table-wrap .table th,
    .data-table-wrap .table td { padding: .65rem .9rem; }
    .data-table-wrap .table { font-size: .82rem; }

    /* Stat cards */
    .stat-value { font-size: 1.6rem; }
}

/* Small mobile: ≤ 500px */
@media (max-width: 500px) {
    .candidate-grid { grid-template-columns: repeat(2, 1fr); }
    .candidate-card { padding: 1rem .6rem; }
    .candidate-photo,
    .candidate-photo-placeholder { width: 64px; height: 64px; font-size: 1.6rem; }

    .stat-card { flex-direction: column; align-items: flex-start; gap: .6rem; padding: 1rem; }
    .stat-icon { width: 42px; height: 42px; font-size: 1.1rem; border-radius: 11px; }
    .stat-value { font-size: 1.5rem; }

    .landing-hero-title { font-size: 1.6rem; }
    .landing-card { padding: 1.25rem 1rem; }
    .card-title { font-size: 1.1rem; }
    .stat-num { font-size: 1.75rem; }

    .login-card { padding: 1.75rem 1.25rem; }
    .thankyou-card { padding: 2.25rem 1.25rem; }
    .thankyou-icon { width: 80px; height: 80px; font-size: 2.3rem; }
    .thankyou-card h2 { font-size: 1.5rem; }

    /* Results */
    .result-block { padding: 1.1rem; }
    .bar-chart-container { gap: .6rem; min-height: 110px; }
    .bar { width: 34px; }
    .cand-photo, .cand-photo-placeholder { width: 46px; height: 46px; font-size: 1.2rem; }
    .vote-count-above { font-size: 1.1rem; }
    .cand-name { font-size: .74rem; }
}

/* Large screens */
@media (min-width: 1400px) {
    :root { --sidebar-w: 270px; }
    .results-grid { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 1.5rem; }
    .bar { width: 60px; }
    .vote-count-above { font-size: 1.5rem; }
    .page-body { padding: 2rem; }
}

/* Print */
@media print {
    .sidebar, .sidebar-overlay, .topbar, .vote-submit-bar { display: none !important; }
    .main-content { margin-left: 0; }
    .results-grid { grid-template-columns: repeat(2, 1fr); }
    .result-block { box-shadow: none; border: 1px solid var(--gray-200); }
}

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