/**
 * Estilos para Dashboard Admin - TURNO-PVU
 * Coordinación General - Vista de 15 centros
 */

/* ===== VARIABLES ===== */
:root {
    --color-verde: #2ecc71;
    --color-amarillo: #f39c12;
    --color-rojo: #e74c3c;
    --color-gris: #95a5a6;

    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-card: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #ecf0f1;

    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.15);
}

/* Modo oscuro */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-card: #2d2d2d;
    --text-primary: #ecf0f1;
    --text-secondary: #bdc3c7;
    --border-color: #34495e;

    --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: var(--shadow-md);
}

.header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.25rem;
}

.header .subtitle {
    font-size: 1rem;
    opacity: 0.95;
    margin-bottom: 0.5rem;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.user-info {
    font-size: 0.9rem;
    opacity: 0.9;
}

.btn-logout {
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

/* ===== NAVEGACIÓN POR PESTAÑAS ===== */
.tabs {
    background: var(--bg-primary);
    border-bottom: 2px solid var(--border-color);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.tabs .container {
    display: flex;
    gap: 0;
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    min-width: max-content;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

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

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: var(--bg-secondary);
}

/* ===== MAIN ===== */
.main {
    padding: 2rem 0;
    min-height: 70vh;
}

/* ===== VISTAS ===== */
.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

/* ===== KPIs CONSOLIDADOS ===== */
.kpis-section {
    margin-bottom: 2rem;
}

.kpis-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.kpis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.kpi-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 2px solid var(--border-color);
    transition: transform 0.2s;
}

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

.kpi-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.25rem;
}

.kpi-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== FILTROS ===== */
.filters-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.filter-group select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-group select:focus {
    outline: none;
    border-color: #667eea;
}

.btn-refresh {
    padding: 0.5rem 1.5rem;
    background: #667eea;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: auto;
}

.btn-refresh:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.auto-refresh {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

#countdown {
    font-weight: bold;
    color: #667eea;
}

/* ===== TABLA DE CENTROS ===== */
.centros-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.table-wrapper {
    overflow-x: auto;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.centros-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.centros-table thead {
    background: var(--bg-secondary);
}

.centros-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.centros-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.centros-table tbody tr {
    transition: background-color 0.2s;
}

.centros-table tbody tr:hover {
    background: var(--bg-secondary);
}

/* Semáforo de estado */
.estado-semaforo {
    font-size: 1.5rem;
    text-align: center;
}

.estado-verde { color: var(--color-verde); }
.estado-amarillo { color: var(--color-amarillo); }
.estado-rojo { color: var(--color-rojo); }
.estado-gris { color: var(--color-gris); }

/* Indicadores de progreso */
.progreso {
    font-weight: 600;
}

.progreso.verde { color: var(--color-verde); }
.progreso.amarillo { color: var(--color-amarillo); }
.progreso.rojo { color: var(--color-rojo); }

/* ===== REPORTES ===== */
.reportes-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.reporte-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    border-left: 4px solid #667eea;
}

.reporte-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.reporte-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.reporte-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.reporte-filters input[type="date"] {
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.btn-export {
    padding: 0.75rem 1.5rem;
    background: #2ecc71;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-export:hover {
    background: #27ae60;
    transform: translateY(-1px);
}

/* ===== USUARIOS Y CENTROS ===== */
.usuarios-section h2,
.admin-centros-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.btn-primary {
    padding: 0.75rem 1.5rem;
    background: #667eea;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 1.5rem;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.usuarios-table,
.admin-centros-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.usuarios-table thead,
.admin-centros-table thead {
    background: var(--bg-secondary);
}

.usuarios-table th,
.admin-centros-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.usuarios-table td,
.admin-centros-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-activo {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.badge-inactivo {
    background: rgba(149, 165, 166, 0.2);
    color: #95a5a6;
}

.badge-admin {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.badge-coordinador {
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
}

.badge-registrador {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.badge-aplicador {
    background: rgba(243, 156, 18, 0.2);
    color: #f39c12;
}

.btn-action {
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 0.5rem;
}

.btn-edit {
    background: #3498db;
    color: white;
}

.btn-edit:hover {
    background: #2980b9;
}

.btn-delete {
    background: #e74c3c;
    color: white;
}

.btn-delete:hover {
    background: #c0392b;
}

.btn-toggle {
    background: #95a5a6;
    color: white;
}

.btn-toggle:hover {
    background: #7f8c8d;
}

/* ===== MODALES ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-overlay p {
    color: white;
    margin-top: 1rem;
    font-size: 1.1rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .tabs .container {
        justify-content: flex-start;
    }

    .tab-btn {
        flex: none;
        font-size: 0.85rem;
        padding: 0.75rem 1rem;
    }

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

    .filters-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-refresh {
        margin-left: 0;
        width: 100%;
    }

    .centros-table {
        font-size: 0.8rem;
    }

    .centros-table th,
    .centros-table td {
        padding: 0.75rem 0.5rem;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
}

@media (max-width: 480px) {
    .kpis-grid {
        grid-template-columns: 1fr;
    }

    .kpi-value {
        font-size: 2rem;
    }
}
