/**
 * Estilos para Panel Público - TURNO-PVU
 * FASE 7: Sin frameworks, CSS vanilla
 */

/* ===== VARIABLES ===== */
:root {
    --color-disponible: #2ecc71;
    --color-ultimos: #f39c12;
    --color-agotado: #e74c3c;
    --color-sin-turno: #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);
}

/* ===== RESET ===== */
* {
    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: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

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

.header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

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

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

/* ===== CONTROLES ===== */
.controls {
    background: var(--bg-primary);
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

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

.filter-group label {
    font-weight: 600;
    font-size: 0.9rem;
}

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

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

.btn-refresh,
.btn-theme {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 6px;
    background: #667eea;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.btn-refresh:hover,
.btn-theme:hover {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-theme {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
}

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

/* ===== RESUMEN ===== */
.summary {
    padding: 2rem 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

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

.summary-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);
}

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

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

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

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

/* ===== GRID DE CENTROS ===== */
.centros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* ===== TARJETA DE CENTRO ===== */
.centro-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border-left: 6px solid var(--color-disponible);
    transition: all 0.3s;
}

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

.centro-card.estado-DISPONIBLE {
    border-left-color: var(--color-disponible);
}

.centro-card.estado-ULTIMOS_TURNOS {
    border-left-color: var(--color-ultimos);
}

.centro-card.estado-AGOTADO {
    border-left-color: var(--color-agotado);
}

.centro-card.estado-SIN_TURNO {
    border-left-color: var(--color-sin-turno);
}

.centro-header {
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.centro-nombre {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.centro-municipio {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.centro-estado {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.estado-DISPONIBLE {
    background: rgba(46, 204, 113, 0.2);
    color: var(--color-disponible);
}

.estado-ULTIMOS_TURNOS {
    background: rgba(243, 156, 18, 0.2);
    color: var(--color-ultimos);
}

.estado-AGOTADO {
    background: rgba(231, 76, 60, 0.2);
    color: var(--color-agotado);
}

.estado-SIN_TURNO {
    background: rgba(149, 165, 166, 0.2);
    color: var(--color-sin-turno);
}

.centro-inventario {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.inventario-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.inventario-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.inventario-valor {
    font-weight: bold;
    font-size: 1rem;
}

.badge-srp { color: #e74c3c; }
.badge-sr { color: #8e44ad; }
.badge-vph { color: #e67e22; }

.centro-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* ===== ESTADOS ESPECIALES ===== */
.empty-state,
.loading-state,
.error-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-icon,
.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    border: 4px solid var(--border-color);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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

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

/* ===== FOOTER ===== */
.footer {
    background: var(--bg-card);
    color: var(--text-secondary);
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
}

.footer p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.footer strong {
    color: var(--text-primary);
}

.footer-note {
    font-size: 0.85rem;
    opacity: 0.8;
}

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

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

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

    .filter-group select {
        width: 100%;
    }

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

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

/* ===== ANIMACIONES ===== */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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