:root {
    /* Colores principales - paleta indigo/violet moderna */
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #a5b4fc;
    --secondary: #7c3aed;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    
    /* Colores de fondo */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    /* Colores de texto */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-light: #94a3b8;
    --text-white: #ffffff;
    
    /* Sombras */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.07);
    --shadow-md: 0 4px 12px -1px rgba(79, 70, 229, 0.12);
    --shadow-lg: 0 20px 40px -8px rgba(79, 70, 229, 0.18);
    --shadow-xl: 0 30px 60px -10px rgba(79, 70, 229, 0.22);
    
    /* Bordes */
    --border-color: #e2e8f0;
    --border-radius: 0.75rem;
    --border-radius-lg: 1.25rem;
}

/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
}

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.main-content {
    padding: 2rem 0;
}

/* Navbar — glassmorphism premium */
.navbar {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(79, 70, 229, 0.1);
    box-shadow: 0 4px 24px -4px rgba(79, 70, 229, 0.1);
    padding: 0.85rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: box-shadow 0.3s;
}

.navbar-brand {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Cards — premium con hover */
.card {
    background-color: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(226, 232, 240, 0.8);
    margin-bottom: 1.5rem;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(79,70,229,0.04), rgba(124,58,237,0.04));
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* Botones — modernos con gradiente */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.1rem;
    border-radius: 0.65rem;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s ease;
    border: none;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--text-white);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.45);
    filter: brightness(1.05);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline {
    background-color: transparent;
    border: 1.5px solid currentColor;
}

.btn-outline-primary {
    color: var(--primary);
    border-color: rgba(79,70,229,0.4);
    background: rgba(79,70,229,0.04);
}

.btn-outline-primary:hover {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--text-white);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* Formularios */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--bg-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* Alertas */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #dcfce7;
    color: var(--success);
}

.alert-warning {
    background-color: #fef9c3;
    color: var(--warning);
}

.alert-danger {
    background-color: #fee2e2;
    color: var(--danger);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-primary {
    background-color: var(--primary-light);
    color: var(--primary-dark);
}

.badge-success {
    background-color: #dcfce7;
    color: var(--success);
}

.badge-warning {
    background-color: #fef9c3;
    color: var(--warning);
}

/* Utilidades */
.text-center { text-align: center; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1rem; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }

/* Demo Banner — moderno */
.demo-banner {
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    color: var(--text-white);
    text-align: center;
    padding: 0.6rem 1rem;
    font-weight: 500;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Iconos Material */
.material-icons {
    font-size: 1.25rem;
    vertical-align: middle;
}

/* Estilos para imágenes de candidatos */
.candidate-image {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1.5rem;
    border: 3px solid var(--border-color);
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.candidate-card {
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    background-color: var(--bg-tertiary);
}

.candidate-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.15);
    border-color: var(--primary);
}

.candidate-card:hover .candidate-image {
    border-color: var(--primary);
    transform: scale(1.05);
}

.candidate-radio:checked + .candidate-image {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.candidate-radio:focus + .candidate-image {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.candidate-card .card-body {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    padding: 2rem 1.5rem;
}

.candidate-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.candidate-radio:checked + .candidate-image {
    border-color: var(--primary);
    transform: scale(1.05);
}

.candidate-radio:checked ~ .card-title {
    color: var(--primary);
}

.candidate-radio:focus + .candidate-image {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

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

.candidatos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 1rem;
}

.candidate-icon {
    font-size: 48px;
    color: var(--text-secondary);
}

/* Versión mini para tablas */
.candidato-mini-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/* Estilos para la tarjeta de candidato */
.candidato-card {
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.candidato-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.candidato-info {
    margin-top: 1rem;
}

.candidato-info h6 {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.candidato-info p {
    color: var(--text-secondary);
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* Footer moderno */
footer.footer, .footer {
    background: linear-gradient(135deg, #0f172a, #1e1b4b);
    color: rgba(255,255,255,0.7);
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: 3rem;
    font-size: 0.875rem;
}

footer.footer a, .footer a {
    color: var(--primary-light);
    text-decoration: none;
}

/* Page header con gradiente */
.page-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 60%, #9333ea 100%);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem 2rem;
    margin-bottom: 2rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
}

.page-header h1, .page-header h2 {
    color: white;
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: rgba(255,255,255,0.8);
    margin: 0;
}

/* Stat cards modernos */
.stat-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-top: 0.4rem;
}

/* Formularios mejorados */
.form-control {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1.5px solid var(--border-color);
    border-radius: 0.65rem;
    background-color: var(--bg-primary);
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* Badge de resultado/estado */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.8rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.active   { background: #d1fae5; color: #065f46; }
.status-badge.pending  { background: #fef3c7; color: #92400e; }
.status-badge.closed   { background: #f1f5f9; color: #475569; }
.status-badge.winner   { background: linear-gradient(135deg, #4f46e5, #7c3aed); color: white; }

/* Animaciones de entrada */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeInUp 0.5s ease-out forwards;
}

.animate-fade-in-1 { animation-delay: 0.1s; opacity: 0; }
.animate-fade-in-2 { animation-delay: 0.2s; opacity: 0; }
.animate-fade-in-3 { animation-delay: 0.3s; opacity: 0; }

/* Table mejorada */
table {
    width: 100%;
    border-collapse: collapse;
}

table thead th {
    background: linear-gradient(135deg, rgba(79,70,229,0.06), rgba(124,58,237,0.06));
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.9rem 1rem;
    border-bottom: 2px solid rgba(79,70,229,0.15);
}

table tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

table tbody tr:hover td {
    background: rgba(79,70,229,0.025);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }
    
    .navbar-nav {
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    
    .card {
        margin: 0.25rem 0;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .candidate-image {
        width: 80px;
        height: 80px;
    }

    .candidato-mini-img {
        width: 32px;
        height: 32px;
    }

    .page-header {
        padding: 1.5rem 1rem;
    }
}
