/* ============================================
   VAPA Persistence Dashboard - Styles
   Val Verde Unified School District
   ============================================ */

/* CSS Custom Properties */
:root {
    --blue: #2D5587;
    --blue-light: rgba(45, 85, 135, 0.1);
    --gold: #FFCC4D;
    --gold-light: rgba(255, 204, 77, 0.3);
    --text-primary: #1a1a1a;
    --text-secondary: #6c757d;
    --text-muted: #495057;
    --bg-page: #f8f9fa;
    --bg-card: #ffffff;
    --border: #e9ecef;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-gold: 0 4px 16px rgba(255, 204, 77, 0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

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

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

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: var(--bg-card);
    padding: 60px 40px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    text-align: center;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--gold) 0%, var(--blue) 100%);
}

.logo {
    width: 120px;
    height: 120px;
    display: inline-block;
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

h1 {
    font-size: 2.5em;
    font-weight: 300;
    color: var(--blue);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.subtitle {
    font-size: 1.1em;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Navigation */
nav {
    background: var(--bg-card);
    padding: 15px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

nav button {
    padding: 12px 28px;
    background: var(--bg-page);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

nav button:hover {
    background: var(--bg-card);
    border-color: var(--gold);
    color: var(--blue);
    transform: translateY(-2px);
}

nav button.active {
    background: linear-gradient(135deg, var(--gold) 0%, #FFD666 100%);
    border-color: var(--gold);
    color: var(--blue);
    font-weight: 600;
    box-shadow: var(--shadow-gold);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--blue);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 0.8s linear infinite;
}

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

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s;
}

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

/* Hero Stats */
.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 25px 20px;
    text-align: center;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    border-color: var(--gold);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(255, 204, 77, 0.15);
}

.stat-number {
    font-size: 2.8em;
    font-weight: 300;
    color: var(--blue);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.95em;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-change {
    font-size: 0.85em;
    margin-top: 6px;
    font-weight: 600;
}

.stat-change.positive {
    color: #28a745;
}

.stat-change.negative {
    color: #dc3545;
}

.stat-change.neutral {
    color: var(--text-secondary);
}

/* Chart Containers */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.chart-container {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-sm);
}

.chart-container.full-width {
    margin-bottom: 30px;
}

.chart-title {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--blue);
    margin-bottom: 20px;
    text-align: center;
}

.chart-wrapper {
    position: relative;
    height: 350px;
}

.chart-wrapper.tall {
    height: 500px;
}

/* Filter Controls */
.filter-control {
    margin-bottom: 20px;
    text-align: center;
}

.filter-control label {
    font-weight: 600;
    color: var(--blue);
    margin-right: 10px;
}

.filter-control select {
    padding: 8px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95em;
    font-family: inherit;
    cursor: pointer;
    background: var(--bg-card);
    color: var(--text-muted);
    transition: all 0.3s;
}

.filter-control select:hover {
    border-color: var(--gold);
}

.filter-control select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-light);
}

/* Feeder and School selectors (larger) */
#feederSelector {
    padding: 12px 24px;
    font-size: 1.1em;
    color: var(--blue);
    font-weight: 500;
    min-width: 350px;
}

#schoolSelector {
    padding: 12px 24px;
    font-size: 1.1em;
    color: var(--blue);
    font-weight: 500;
    min-width: 350px;
}

/* Heatmap Styles */
.heatmap-container {
    overflow-x: auto;
    max-width: 100%;
}

.heatmap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.heatmap-table th,
.heatmap-table td {
    padding: 14px 10px;
    text-align: center;
    border: 1px solid var(--border);
}

.heatmap-table th {
    background: var(--bg-page);
    color: var(--blue);
    font-weight: 600;
    font-size: 0.95em;
}

.heatmap-table th:first-child {
    text-align: left;
    padding-left: 16px;
    min-width: 140px;
}

.heatmap-table tbody th {
    text-align: left;
    background: var(--bg-page);
    font-weight: 600;
    color: var(--text-muted);
    padding-left: 16px;
}

.heatmap-cell {
    font-weight: 600;
    transition: transform 0.2s;
}

.heatmap-cell:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
    position: relative;
}

.heatmap-legend {
    margin-top: 12px;
    padding: 10px;
    background: var(--bg-page);
    border-radius: var(--radius-sm);
    font-size: 0.85em;
    color: var(--text-muted);
    text-align: center;
}

/* COVID Panel */
.covid-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 10px 0;
}

.covid-card {
    background: var(--bg-page);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
}

.covid-card.highlight {
    background: #fff3cd;
    border: 2px solid #ffc107;
}

.covid-card h4 {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.covid-card .covid-value {
    font-size: 2em;
    font-weight: 300;
    color: var(--blue);
}

.covid-card .covid-detail {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* Switching Stats */
.switching-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.switching-stat {
    background: var(--bg-page);
    border-radius: var(--radius-sm);
    padding: 15px;
    text-align: center;
}

.switching-stat .switching-value {
    font-size: 1.8em;
    font-weight: 300;
    color: var(--blue);
}

.switching-stat .switching-label {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Cohort Checkboxes */
.cohort-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

.cohort-checkboxes label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-page);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
}

.cohort-checkboxes label:hover {
    border-color: var(--gold);
}

.cohort-checkboxes label.checked {
    background: var(--gold);
    border-color: var(--gold);
    font-weight: 600;
}

.cohort-checkboxes input[type="checkbox"] {
    accent-color: var(--blue);
}

/* Recruitment Tables */
.recruit-search-input {
    padding: 8px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95em;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-muted);
    transition: all 0.3s;
    min-width: 250px;
}

.recruit-search-input:hover {
    border-color: var(--gold);
}

.recruit-search-input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-light);
}

#recruitmentHSSelector {
    padding: 12px 24px;
    font-size: 1.1em;
    color: var(--blue);
    font-weight: 500;
    min-width: 350px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    cursor: pointer;
    background: var(--bg-card);
    transition: all 0.3s;
}

#recruitmentHSSelector:hover {
    border-color: var(--gold);
}

#recruitmentHSSelector:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-light);
}

.recruit-table-wrapper {
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

.recruit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.recruit-table th {
    position: sticky;
    top: 0;
    background: var(--blue);
    color: #fff;
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
    white-space: nowrap;
    z-index: 5;
}

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

.recruit-table tbody tr:hover {
    background: var(--blue-light);
}

.recruit-table tbody tr:nth-child(even) {
    background: var(--bg-page);
}

.recruit-table tbody tr:nth-child(even):hover {
    background: var(--blue-light);
}

.recruit-disc-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
    margin: 1px 2px;
    color: #fff;
}

.recruit-table-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-style: italic;
}

.recruit-count-badge {
    display: inline-block;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.8em;
    color: var(--text-secondary);
    margin-left: 8px;
}

/* Responsive */
@media (max-width: 1024px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }

    .covid-panel {
        grid-template-columns: 1fr;
    }

    .switching-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    h1 { font-size: 1.8em; }
    .subtitle { font-size: 0.95em; }

    .hero-stats {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 12px;
    }

    .stat-number { font-size: 2.2em; }
    .chart-container { padding: 20px; }

    nav button {
        padding: 10px 18px;
        font-size: 0.85em;
    }

    #schoolSelector {
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container { padding: 10px; }
    header { padding: 40px 20px; }
    .hero-stats { grid-template-columns: 1fr; }

    .switching-stats {
        grid-template-columns: 1fr;
    }
}
