/* =====================================================================
 * SISTEMA DE GESTIÓN ELECTORAL - SISTEMA DE DISEÑO VISUAL Y ESTILOS CSS
 * ===================================================================== */

:root {
    --bg-main: #fdfafb;
    --bg-card: #ffffff;
    --bg-card-hover: #fff5f7;
    --bg-header: #ab0033;
    --border-color: rgba(171, 0, 51, 0.2);
    --border-glow: rgba(171, 0, 51, 0.4);

    --text-primary: #2c2d2f;
    --text-secondary: #5a4b4f;
    --text-muted: #9c8a8d;

    --primary-red: #ab0033;
    --accent-red-light: rgba(171, 0, 51, 0.1);
    --accent-red-hover: #8a0029;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --shadow-card: 0 4px 20px -5px rgba(84, 86, 90, 0.1);
    --shadow-glow: 0 0 15px rgba(171, 0, 51, 0.15);
    --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
    --bg-main: #121212;
    --bg-card: #1e1e1e;
    --bg-card-hover: #2c2c2c;
    --bg-header: #8a0029;
    /* Un poco más oscuro para que resalte menos o mantener el rojo fuerte */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-glow: rgba(255, 255, 255, 0.2);

    --text-primary: #f0f0f0;
    --text-secondary: #c0c0c0;
    --text-muted: #a0a0a0;


    --primary-red: #d32f2f;
    --accent-red-light: rgba(211, 47, 47, 0.15);
    --accent-red-hover: #f44336;

    --shadow-card: 0 4px 20px -5px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 15px rgba(211, 47, 47, 0.2);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Navbar de Navegación */
.navbar {
    background: var(--bg-header);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0.85rem 1.5rem;
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.5px;
}

.brand-badge {
    background: #ffffff;
    color: var(--primary-red);
    padding: 0.4rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #ffffff;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Contenido Principal */
.main-container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
}

/* Header de Sección */
.section-header {
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--primary-red);
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Menú de Cards Interactivas (Index Grid) */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.menu-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem 1.75rem;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.menu-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: transparent;
    transition: background 0.3s ease;
}

.menu-card:hover {
    transform: translateY(-6px);
    background: var(--bg-card-hover);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-card), var(--shadow-glow);
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

.menu-card.mapa .card-icon {
    background: rgba(171, 0, 51, 0.1);
    color: var(--primary-red);
}

.menu-card.mapa::before {
    background: var(--primary-red);
}

.menu-card.usuarios .card-icon {
    background: rgba(171, 0, 51, 0.1);
    color: var(--primary-red);
}

.menu-card.usuarios::before {
    background: var(--primary-red);
}

.menu-card.dashboard .card-icon {
    background: rgba(171, 0, 51, 0.1);
    color: var(--primary-red);
}

.menu-card.dashboard::before {
    background: var(--primary-red);
}

.menu-card.participantes .card-icon {
    background: rgba(171, 0, 51, 0.1);
    color: var(--primary-red);
}

.menu-card.participantes::before {
    background: var(--primary-red);
}

.card-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.card-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-red);
}

.card-badge {
    background: rgba(84, 86, 90, 0.1);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
}

/* Tablas y Contenedores de Datos */
.table-container {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table-custom th {
    background: var(--primary-red);
    padding: 1rem 1.25rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff;
    border-bottom: 3px solid #8a0029;
}

.table-custom td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(171, 0, 51, 0.15);
    font-size: 0.9rem;
    vertical-align: middle;
}

.table-custom tbody tr:hover {
    background: var(--bg-card-hover);
}

/* Badges Territoriales */
.badge-territorial {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.55rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-seccion {
    background: rgba(171, 0, 51, 0.05);
    color: var(--primary-red);
    border: 1px solid rgba(171, 0, 51, 0.2);
}

.badge-distrito-l {
    background: rgba(171, 0, 51, 0.1);
    color: var(--primary-red);
    border: 1px solid rgba(171, 0, 51, 0.3);
}

.badge-distrito-f {
    background: rgba(171, 0, 51, 0.15);
    color: var(--primary-red);
    border: 1px solid rgba(171, 0, 51, 0.4);
}

.badge-municipio {
    background: rgba(171, 0, 51, 0.2);
    color: var(--primary-red);
    border: 1px solid rgba(171, 0, 51, 0.5);
}

/* Formularios y Botones */
.btn-custom {
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-red);
    color: #fff;
    box-shadow: 0 4px 10px rgba(171, 0, 51, 0.2);
}

.btn-primary:hover {
    background: #8a0029;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(171, 0, 51, 0.35);
}

.btn-danger {
    background: #ffffff;
    color: var(--primary-red);
    border: 1px solid var(--primary-red);
    box-shadow: 0 4px 10px rgba(171, 0, 51, 0.1);
}

.btn-danger:hover {
    background: var(--accent-red-light);
    color: var(--primary-red);
}

.btn-secondary {
    background: rgba(84, 86, 90, 0.1);
    color: var(--text-primary);
    font-weight: 700;
}

.btn-secondary:hover {
    background: rgba(84, 86, 90, 0.2);
}

.form-control,
.form-select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(171, 0, 51, 0.15);
}

/* Modales */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(84, 86, 90, 0.3);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

/* Adaptación Responsiva para Celulares y Tablets */
@media (max-width: 768px) {
    .navbar-container {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .section-title {
        font-size: 1.4rem;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .table-container {
        overflow-x: auto;
    }
}