:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --primary-color: #38bdf8;
    --secondary-color: #818cf8;
    --accent-color: #f472b6;
    --text-color: #f8fafc;
    --text-muted: #cbd5e1;
    /* Lighter for better contrast on dark bg */
    --success-color: #22c55e;
    --danger-color: #ef4444;
}

/* Global contrast improvements */
.text-muted {
    color: var(--text-muted) !important;
}

label,
.form-label {
    color: var(--text-color) !important;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.table text-muted {
    color: var(--text-muted) !important;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
}

/* Form controls styling for dark theme */
.form-control {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color) !important;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
}

.form-control:focus {
    background-color: rgba(0, 0, 0, 0.4) !important;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(56, 189, 248, 0.15);
    color: var(--text-color) !important;
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.card {
    background-color: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    color: var(--text-color);
    border-radius: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    filter: brightness(1.1);
}

.qr-container {
    background: white;
    padding: 1rem;
    border-radius: 1rem;
    display: inline-block;
}

.code-display {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 3rem;
    letter-spacing: 0.5rem;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
    color: var(--primary-color);
    font-weight: 800;
}

.vote-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

@media (min-width: 576px) {
    .vote-grid {
        grid-template-columns: repeat(5, 1fr);
        max-width: 600px;
    }
}

.vote-btn {
    aspect-ratio: 1;
    font-size: 1.5rem;
    font-weight: bold;
    border-radius: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background-color: var(--card-bg);
    color: var(--text-color);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.vote-btn:hover {
    border-color: var(--primary-color);
    background-color: rgba(56, 189, 248, 0.1);
}

.vote-btn.selected {
    background-color: var(--primary-color);
    color: var(--bg-color);
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.result-bar-container {
    height: 1rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 9999px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.result-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.5s ease-out;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* SplashScreen */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.8s ease, visibility 0.8s;
}

#splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.splash-logo {
    font-size: 3.5rem;
    font-weight: 800;
    animation: splashPulse 2s infinite ease-in-out;
}

@keyframes splashPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

.splash-loader {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(56, 189, 248, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-top: 2rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Mobile First Adjustments */
@media (max-width: 576px) {
    .display-1 {
        font-size: calc(3rem + 2vw);
    }

    .display-4 {
        font-size: calc(2rem + 2vw);
    }

    .code-display {
        font-size: 2.2rem;
        letter-spacing: 0.3rem;
    }

    .card {
        padding: 1.5rem !important;
    }

    .navbar-brand {
        font-size: 1.5rem !important;
    }
}

.voter-count-badge {
    animation: pulse 2s infinite;
}

.bg-gradient {
    background: linear-gradient(135deg, var(--card-bg), #1e293b, #0f172a);
}

.extra-small {
    font-size: 0.75rem;
    letter-spacing: 0.05rem;
}

@media (min-width: 768px) {
    .border-end-md {
        border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
    }
}