/* ==========================================
   DASHBOARD VACUNACION - TEMA CLARO
   ========================================== */

:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --header-bg: #1e40af;
    --kpi-blue: #2563eb;
    --kpi-green: #16a34a;
    --kpi-orange: #ea580c;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
}

/* HEADER */
.app-header {
    background: var(--header-bg);
    color: white;
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

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

.app-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.update-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
}

/* MAIN CONTAINER */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* KPI CARDS */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    border-left: 4px solid transparent;
}

.kpi-blue {
    border-left-color: var(--kpi-blue);
}

.kpi-green {
    border-left-color: var(--kpi-green);
}

.kpi-orange {
    border-left-color: var(--kpi-orange);
}

.kpi-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* CARDS */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* TABLES */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th,
td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-main);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
}

tbody tr:hover {
    background: #f1f5f9;
}

/* CHARTS ROW */
.charts-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.chart-card {
    min-height: 300px;
    /* Removed max-height to allow flexibility if using scroll wrapper */
    display: flex;
    flex-direction: column;
}

.chart-scroll-wrapper {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    /* Firefox fix for flex items */
    position: relative;
}

.chart-card canvas {
    /* Canvas size will be controlled by JS for scrollable charts */
    width: 100% !important;
}

.chart-card-wide {
    min-height: 200px;
    max-height: 250px;
}

.chart-card-wide canvas {
    max-height: 200px !important;
}

/* REFRESH NOTICE */
.refresh-notice {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 1rem;
}

#countdown {
    font-weight: 600;
    color: var(--kpi-blue);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .kpi-row {
        grid-template-columns: 1fr;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

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

/* LOGIN OVERLAY */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(30, 64, 175, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-overlay.hidden {
    display: none;
}

.login-box {
    background: white;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 360px;
    width: 90%;
}

.login-box h2 {
    margin: 0 0 0.5rem;
    color: #1e40af;
}

.login-box p {
    color: #64748b;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.login-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
}

.login-box button {
    width: 100%;
    padding: 0.75rem;
    background: #1e40af;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.login-box button:hover {
    background: #1e3a8a;
}

.login-error {
    color: #dc2626;
    margin-top: 1rem;
    font-size: 0.85rem;
}