/* ═══════════════════════════════════════════════════════════════
   E-Vote IKA 86 — Global Stylesheet
   Design: Bright Light Theme — Indigo & Amber
   ═══════════════════════════════════════════════════════════════ */

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

:root {
    /* Primary palette */
    --indigo-50:  #eef2ff;
    --indigo-100: #e0e7ff;
    --indigo-200: #c7d2fe;
    --indigo-400: #818cf8;
    --indigo-500: #6366f1;
    --indigo-600: #4f46e5;
    --indigo-700: #4338ca;
    --indigo-800: #3730a3;

    /* Amber accent */
    --amber-300: #fcd34d;
    --amber-400: #fbbf24;
    --amber-500: #f59e0b;
    --amber-glow: rgba(251,191,36,0.25);

    /* Semantic colours */
    --accent-green:  #059669;
    --accent-green-light: #d1fae5;
    --accent-red:    #dc2626;
    --accent-red-light: #fee2e2;
    --accent-blue:   #2563eb;
    --accent-blue-light: #dbeafe;

    /* Neutral */
    --white:      #ffffff;
    --gray-50:    #f8fafc;
    --gray-100:   #f1f5f9;
    --gray-200:   #e2e8f0;
    --gray-300:   #cbd5e1;
    --gray-400:   #94a3b8;
    --gray-500:   #64748b;
    --gray-600:   #475569;
    --gray-700:   #334155;
    --gray-800:   #1e293b;
    --gray-900:   #0f172a;

    /* Typography */
    --font: 'Inter', system-ui, -apple-system, sans-serif;

    /* Radius */
    --radius-sm:  8px;
    --radius-md:  14px;
    --radius-lg:  20px;
    --radius-xl:  28px;

    /* Shadows */
    --shadow-xs:  0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm:  0 2px 8px rgba(0,0,0,0.07);
    --shadow-md:  0 4px 20px rgba(0,0,0,0.09);
    --shadow-lg:  0 12px 40px rgba(0,0,0,0.12);
    --shadow-xl:  0 24px 64px rgba(0,0,0,0.14);
    --shadow-indigo: 0 8px 32px rgba(79,70,229,0.22);
    --shadow-amber:  0 8px 32px rgba(251,191,36,0.22);

    /* Transition */
    --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════════
   LANDING PAGE
══════════════════════════════════════════ */

.landing-bg {
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 15% 50%, rgba(99,102,241,0.12) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 20%, rgba(251,191,36,0.12) 0%, transparent 45%),
        linear-gradient(160deg, #eef2ff 0%, #f8fafc 50%, #fff7ed 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    position: relative;
    overflow: hidden;
}

.landing-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%234f46e508' stroke-width='1'%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3C/g%3E%3C/svg%3E") repeat;
    animation: bgShift 35s linear infinite;
    pointer-events: none;
}

@keyframes bgShift {
    0%   { transform: translate(0,0); }
    100% { transform: translate(60px,60px); }
}

.landing-card {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(99,102,241,0.15);
    border-radius: var(--radius-xl);
    padding: 3rem 2.5rem;
    max-width: 640px;
    width: 100%;
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.6) inset;
    position: relative;
    z-index: 1;
    animation: fadeUp 0.7s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}

.landing-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--indigo-50);
    border: 1px solid var(--indigo-200);
    border-radius: 50px;
    padding: 6px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--indigo-600);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.landing-title {
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--indigo-700) 0%, var(--indigo-500) 50%, var(--amber-400) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-subtitle {
    font-size: 1rem;
    color: var(--gray-500);
    margin-bottom: 2.5rem;
}

/* Result section */
.result-section {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    margin-bottom: 2rem;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.result-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-500);
}

.result-live {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-green);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-live::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.8); }
}

.candidate-item { margin-bottom: 1.25rem; }
.candidate-item:last-child { margin-bottom: 0; }

.candidate-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.candidate-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-800);
}

.candidate-pct {
    font-size: 1rem;
    font-weight: 800;
    color: var(--indigo-600);
}

.progress-track {
    height: 10px;
    background: var(--gray-200);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-fill.color-1 { background: linear-gradient(90deg, #4338ca, #6366f1); }
.progress-fill.color-2 { background: linear-gradient(90deg, #d97706, #fbbf24); }
.progress-fill.color-3 { background: linear-gradient(90deg, #059669, #34d399); }
.progress-fill.color-4 { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.progress-fill.color-5 { background: linear-gradient(90deg, #dc2626, #f87171); }

.result-total {
    text-align: center;
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.result-total strong { color: var(--gray-600); }

/* ── Buttons ── */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--indigo-600), var(--indigo-500));
    color: #fff;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: var(--shadow-indigo);
    letter-spacing: 0.03em;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 36px rgba(79,70,229,0.35);
    background: linear-gradient(135deg, var(--indigo-700), var(--indigo-600));
}

.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.75rem 1.5rem;
    background: var(--gray-100);
    color: var(--gray-700);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--gray-200);
    border-color: var(--gray-300);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 1rem;
    background: var(--accent-red-light);
    color: var(--accent-red);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(220,38,38,0.25);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-danger:hover {
    background: #fecaca;
    border-color: rgba(220,38,38,0.4);
}

.btn-success {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 1rem;
    background: var(--accent-green-light);
    color: var(--accent-green);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(5,150,105,0.25);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-success:hover { background: #a7f3d0; }

/* ── Auth / Login Page ── */

.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 30% 60%, rgba(99,102,241,0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 20%, rgba(251,191,36,0.1) 0%, transparent 40%),
        linear-gradient(150deg, #eef2ff 0%, #f8fafc 60%, #fff7ed 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    font-family: var(--font);
}

.auth-card {
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(99,102,241,0.15);
    border-radius: var(--radius-xl);
    padding: 2.75rem 2.25rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.7) inset;
    animation: fadeUp 0.6s ease both;
}

.auth-logo { text-align: center; margin-bottom: 2rem; }

.auth-logo-icon {
    width: 68px;
    height: 68px;
    background: linear-gradient(135deg, var(--indigo-600), var(--indigo-400));
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-indigo);
}

.auth-logo-title {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--indigo-700), var(--indigo-500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-logo-sub {
    font-size: 0.85rem;
    color: var(--gray-400);
    margin-top: 4px;
}

.form-group { margin-bottom: 1.25rem; }

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.form-control {
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    color: var(--gray-800);
    font-family: var(--font);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--indigo-500);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
    background: #fff;
}

.form-control::placeholder { color: var(--gray-300); }

.form-control.is-invalid { border-color: var(--accent-red); }

.invalid-feedback {
    color: var(--accent-red);
    font-size: 0.8rem;
    margin-top: 0.4rem;
}

/* ── Voting Page ── */

.vote-body {
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 20% 80%, rgba(99,102,241,0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(251,191,36,0.08) 0%, transparent 40%),
        linear-gradient(145deg, #f0f4ff 0%, #f8fafc 60%, #fef9f0 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
}

.vote-card {
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(99,102,241,0.12);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    max-width: 580px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: fadeUp 0.6s ease both;
}

.vote-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.vote-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--indigo-700), var(--indigo-500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.vote-header p { color: var(--gray-500); font-size: 0.9rem; }

/* candidate list style (legacy) */
.candidate-option { display: block; position: relative; margin-bottom: 1rem; cursor: pointer; }

.candidate-option input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }

.candidate-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.candidate-option input[type="radio"]:checked + .candidate-card {
    border-color: var(--indigo-500);
    background: var(--indigo-50);
    box-shadow: 0 0 0 1px rgba(99,102,241,0.2);
}

.candidate-card:hover {
    border-color: var(--indigo-300);
    background: var(--indigo-50);
}

.candidate-avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--indigo-100), var(--indigo-200));
    border: 2px solid var(--indigo-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--indigo-600);
    flex-shrink: 0;
    overflow: hidden;
}

.candidate-avatar img { width: 100%; height: 100%; object-fit: cover; }

.candidate-details { flex: 1; }

.candidate-card-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.candidate-card-desc {
    font-size: 0.8rem;
    color: var(--gray-500);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.candidate-radio-indicator {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    flex-shrink: 0;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.candidate-option input[type="radio"]:checked + .candidate-card .candidate-radio-indicator {
    border-color: var(--indigo-500);
    background: var(--indigo-500);
}

.candidate-option input[type="radio"]:checked + .candidate-card .candidate-radio-indicator::after {
    content: '✓';
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
}

/* ── Modal ── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.45);
    backdrop-filter: blur(6px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal-box {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9) translateY(16px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal-box { transform: scale(1) translateY(0); }

.modal-icon { font-size: 3rem; margin-bottom: 1rem; }

.modal-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
}

.modal-text { color: var(--gray-500); font-size: 0.95rem; margin-bottom: 1.75rem; line-height: 1.6; }

.modal-candidate-name { color: var(--indigo-600); font-weight: 700; }

.modal-actions { display: flex; gap: 0.75rem; }

.modal-actions .btn-secondary { flex: 1; justify-content: center; }
.modal-actions .btn-primary   { flex: 2; }

/* ── Success Page ── */

.success-card { text-align: center; padding: 3rem 2rem; }

.success-icon {
    width: 96px; height: 96px;
    background: linear-gradient(135deg, rgba(5,150,105,0.12), rgba(5,150,105,0.04));
    border: 2px solid rgba(5,150,105,0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 1.5rem;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.3s both;
}

@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.success-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent-green);
    margin-bottom: 0.75rem;
}

.success-text {
    color: var(--gray-500);
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 2rem;
}

/* ── Alerts ── */

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    font-weight: 500;
}

.alert-success {
    background: var(--accent-green-light);
    border: 1px solid rgba(5,150,105,0.25);
    color: var(--accent-green);
}

.alert-error {
    background: var(--accent-red-light);
    border: 1px solid rgba(220,38,38,0.25);
    color: var(--accent-red);
}

.alert-warning {
    background: #fef3c7;
    border: 1px solid rgba(245,158,11,0.3);
    color: #d97706;
}

.alert-info {
    background: var(--accent-blue-light);
    border: 1px solid rgba(37,99,235,0.2);
    color: var(--accent-blue);
}

/* ── Closed Page ── */

.closed-icon { font-size: 4rem; margin-bottom: 1.5rem; display: block; text-align: center; }

/* ── Voter Navbar ── */

.voter-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(99,102,241,0.12);
    box-shadow: 0 2px 16px rgba(99,102,241,0.08);
    padding: 0.9rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.voter-nav-brand {
    font-size: 1rem;
    font-weight: 800;
    color: var(--indigo-600);
}

.voter-nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--gray-500);
}

.voter-nav-user span { color: var(--gray-700); font-weight: 500; }

.voter-nav-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--indigo-500), var(--indigo-400));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    border: 2px solid var(--indigo-200);
}

.voter-nav .logout-btn {
    background: var(--accent-red-light);
    border: 1px solid rgba(220,38,38,0.25);
    color: var(--accent-red);
    padding: 0.35rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: var(--transition);
}

.voter-nav .logout-btn:hover { background: #fecaca; }

.vote-page-wrapper {
    padding-top: 72px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── app-body (default) ── */
.app-body {
    background: linear-gradient(145deg, #f0f4ff 0%, #f8fafc 60%, #fef9f0 100%);
    min-height: 100vh;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .landing-card, .auth-card, .vote-card { padding: 2rem 1.25rem; }
    .modal-actions { flex-direction: column; }
    .voter-nav { padding: 0.75rem 1rem; }
}
