:root {
    --primary: #1B2A4A;
    --primary-dark: #111D35;
    --primary-light: #2C4270;
    --accent: #C4A24E;
    --accent-light: #D4B76A;
    --accent-muted: #E8D9A8;
    --bg: #F7F3ED;
    --bg-cream: #F0EAE0;
    --surface: #FFFFFF;
    --text-dark: #1B2A4A;
    --text-body: #3D4A5C;
    --text-light: #6B7A8D;
    --border: #E2DDD4;
    --border-light: #EDE8E0;
    --shadow-sm: 0 1px 3px rgba(27, 42, 74, 0.06);
    --shadow-md: 0 4px 12px rgba(27, 42, 74, 0.08);
    --shadow-lg: 0 8px 24px rgba(27, 42, 74, 0.10);
    --transition: all 0.25s ease;
    --font-heading: 'Poppins', system-ui, -apple-system, sans-serif;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg);
    color: var(--text-body);
    line-height: 1.6;
}

/* === Brand Logo === */
.brand {
    display: inline-block;
    margin-bottom: 1.5rem;
    text-decoration: none;
}
.brand-logo {
    height: 22px;
    width: auto;
    filter: invert(1);
    opacity: 0.9;
    transition: opacity 0.2s;
}
.brand:hover .brand-logo { opacity: 1; }

/* === Header === */
header {
    background: linear-gradient(165deg, #1E3050 0%, var(--primary-dark) 60%, #0D1520 100%);
    color: var(--surface);
    padding: 3rem 2rem 2.5rem;
    text-align: left;
    position: relative;
    overflow: hidden;
}
header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(135deg, transparent 30%, rgba(196, 162, 78, 0.04) 60%, rgba(196, 162, 78, 0.08) 100%);
    pointer-events: none;
}
header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-light), transparent);
}
.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 0.5rem;
    position: relative;
    z-index: 1;
}
header h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 0.6rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--accent-light);
}
header p {
    color: #B8C1D0;
    font-size: 0.95rem;
    max-width: 600px;
    font-weight: 400;
    line-height: 1.7;
}
.last-updated {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: rgba(184, 193, 208, 0.5);
    font-style: italic;
    letter-spacing: 0.02em;
}

/* === Layout === */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    position: relative;
    z-index: 10;
}
.layout-grid {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 1.75rem;
    align-items: start;
}
/* === Filter Toggle Button (hidden on desktop) === */
.filter-toggle {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.filter-toggle:hover {
    background: var(--bg-cream);
    border-color: var(--accent);
}
.filter-toggle-icon {
    font-size: 1.1rem;
    line-height: 1;
}

/* === Sidebar === */
.filter-sidebar {
    background: var(--surface);
    padding: 0;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    position: sticky;
    top: 1rem;
    max-height: 95vh;
    overflow-y: auto;
}
.sidebar-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
}
.sidebar-header h3 {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.search-box { padding: 1rem 1.25rem 0.75rem; }
.search-box input {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: var(--font-sans);
    color: var(--text-dark);
    background: var(--bg);
    outline: none;
    transition: var(--transition);
}
.search-box input:focus {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(196, 162, 78, 0.12);
}
.search-box input::placeholder {
    color: var(--text-light);
    font-size: 0.82rem;
}

.filter-group {
    margin: 0;
    border-bottom: 1px solid var(--border-light);
    padding: 0.85rem 1.25rem;
}
.filter-group:last-child { border-bottom: none; }
.filter-group-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}
.filter-group-header h4 {
    margin-bottom: 0;
    font-family: var(--font-heading);
    font-size: 0.72rem;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.select-all-btn {
    font-size: 0.68rem;
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}
.select-all-btn:hover { color: var(--primary); text-decoration: underline; }
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.3rem;
    font-size: 0.82rem;
    color: var(--text-body);
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
    width: 0.9rem;
    height: 0.9rem;
    accent-color: var(--primary);
    cursor: pointer;
}

/* === Top bar === */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    background: var(--surface);
    padding: 0.75rem 1.15rem;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}
.sort-select {
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--text-body);
    background: var(--bg);
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}
.sort-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(196, 162, 78, 0.12);
}
.view-toggles {
    display: flex;
    gap: 0.25rem;
    background: var(--bg);
    padding: 0.15rem;
    border-radius: 5px;
}
.view-btn {
    padding: 0.4rem 0.85rem;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.78rem;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}
.view-btn.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* === Cards === */
.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 1.15rem;
}
.card {
    background: var(--surface);
    border-radius: 8px;
    padding: 1.35rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent), var(--accent-light));
    opacity: 0;
    transition: opacity 0.3s ease;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border);
}
.card:hover::before { opacity: 1; }
.card-header { margin-bottom: 0.85rem; }
.card h3 {
    font-family: var(--font-heading);
    color: var(--primary);
    font-size: 1.05rem;
    margin-bottom: 0.55rem;
    font-weight: 600;
    line-height: 1.35;
}

/* === Badges === */
.badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.65rem; }
.badge {
    padding: 0.2rem 0.55rem;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.badge.tier-1 { background: #FBF6E9; color: #8B6914; border: 1px solid var(--accent-muted); }
.badge.tier-2 { background: #EEF1F8; color: var(--primary); border: 1px solid #D6DCE9; }
.badge.tier-3 { background: #F3F2EF; color: #5A6270; border: 1px solid #E2DDD4; }
.badge.stem { background: #EDF7F0; color: #1B6B3A; border: 1px solid #C1E4CB; }
.badge.elig { background: #FDF2F0; color: #8B3A2F; border: 1px solid #F0D4CF; }

.cat-summer-research { background: #E8EDF8; color: #2B3F72; border: 1px solid #CEDAF0; }
.cat-stem-competition { background: #E5F5EC; color: #1B5E3A; border: 1px solid #B8E0C8; }
.cat-award { background: #FBF6E9; color: #8B6914; border: 1px solid #E8D9A8; }
.cat-science-olympiad { background: #F5E8F0; color: #7A2E5A; border: 1px solid #E4C7D9; }
.cat-essay-competition { background: #E8F1F8; color: #1A5276; border: 1px solid #C4D9EA; }
.cat-math-science-summer-camp { background: #EDE8F5; color: #4A2D82; border: 1px solid #D6CCE8; }
.cat-academic-enrichment { background: #F8EDE2; color: #8B4513; border: 1px solid #EDD8C4; }
.cat-business-innovation { background: #E4F2F0; color: #1A5E56; border: 1px solid #B8DDD6; }
.cat-virtual-remote { background: #F0EDE8; color: #5A4E3A; border: 1px solid #DDD6C8; }
.cat-academic-competition { background: #EBE8F0; color: #3A2D5A; border: 1px solid #D0CAE0; }
.cat-journal-publication { background: #F0E8F0; color: #5E2D6B; border: 1px solid #D6C0DC; }
.cat-other { background: #F3F2EF; color: #4A4A4A; border: 1px solid #E2DDD4; }

/* === Card body === */
.card-body {
    flex: 1;
    font-size: 0.84rem;
    color: var(--text-body);
    margin-bottom: 1.1rem;
}
.info-row {
    margin-bottom: 0.4rem;
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
}
.info-label {
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    width: 80px;
    font-size: 0.78rem;
}
.notes {
    margin-top: 0.75rem;
    padding: 0.65rem;
    background: var(--bg);
    border-radius: 5px;
    border-left: 3px solid var(--accent);
    font-size: 0.78rem;
    font-style: italic;
    color: var(--text-light);
    line-height: 1.5;
}

/* === Card footer === */
.card-footer { margin-top: auto; }
.btn {
    display: inline-block;
    width: 100%;
    padding: 0.6rem 1.25rem;
    background: var(--primary);
    color: var(--surface);
    text-decoration: none;
    border-radius: 5px;
    text-align: center;
    font-weight: 600;
    font-size: 0.82rem;
    transition: var(--transition);
    letter-spacing: 0.02em;
}
.btn:hover {
    background: var(--primary-light);
}

/* === Table === */
.table-container {
    width: 100%;
    overflow-x: auto;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: none;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    min-width: 1100px;
}
.data-table th, .data-table td {
    padding: 0.8rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-body);
    vertical-align: top;
}
.data-table th {
    background: var(--bg-cream);
    font-weight: 600;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    color: var(--primary);
    position: sticky;
    top: 0;
    z-index: 5;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.data-table tr:hover td { background: #FDFBF7; }
.data-table td.col-name {
    font-weight: 600;
    color: var(--primary);
    min-width: 180px;
    font-family: var(--font-heading);
}
.data-table td.col-tier { white-space: nowrap; }
.data-table td.col-deadline { min-width: 140px; }
.data-table .notes-small {
    font-size: 0.74rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}
.data-table .sm-btn {
    padding: 0.3rem 0.65rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.74rem;
    display: inline-block;
    white-space: nowrap;
    transition: var(--transition);
}
.data-table .sm-btn:hover { background: var(--primary-light); }

/* === Loading indicator === */
.loading-indicator {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
}
.loading-indicator p {
    margin-top: 1rem;
    color: var(--text-light);
    font-size: 0.85rem;
}
.loading-bar {
    width: 180px;
    height: 2px;
    background: var(--border-light);
    border-radius: 2px;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
}
.loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 2px;
    animation: loading-slide 1.2s ease-in-out infinite;
}
@keyframes loading-slide {
    0% { left: -40%; }
    100% { left: 100%; }
}

/* === Footer === */
footer {
    background: var(--primary-dark);
    color: rgba(255, 255, 255, 0.5);
    padding: 2rem;
    margin-top: 3rem;
}
.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}
.footer-brand {
    margin-bottom: 0.75rem;
}
.footer-logo {
    height: 18px;
    opacity: 0.6;
}
.footer-brand:hover .footer-logo { opacity: 0.8; }
.footer-brand-old {
    letter-spacing: 0.35em;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}
.footer-brand .brand-ivy {
    font-family: var(--font-heading);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
}
.footer-brand .brand-prep {
    font-family: var(--font-heading);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.45);
}
footer p {
    font-size: 0.78rem;
    line-height: 1.6;
}
.footer-note {
    margin-top: 0.5rem;
    font-size: 0.72rem !important;
    color: rgba(255, 255, 255, 0.3);
}
.footer-disclaimer {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.25);
}

.hidden { display: none !important; }
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3.5rem;
    background: var(--surface);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 0.95rem;
    border: 1px dashed var(--border);
    width: 100%;
}

/* === Filter Overlay (hidden on desktop) === */
.filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(27, 42, 74, 0.4);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.filter-overlay.open {
    display: block;
    opacity: 1;
}

/* === Tablet: 901px - 1100px === */
@media (max-width: 1100px) {
    .layout-grid {
        grid-template-columns: 220px 1fr;
        gap: 1.25rem;
    }
    .grid-view {
        grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    }
}

/* === Mobile / Small Tablet: 900px and below === */
@media (max-width: 900px) {
    /* Layout */
    .layout-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Header */
    header {
        padding: 2rem 1.25rem 1.75rem;
    }
    header h1 {
        font-size: 1.5rem;
    }
    header p {
        font-size: 0.85rem;
    }
    .brand-logo {
        height: 18px;
    }
    .brand {
        margin-bottom: 1rem;
    }

    /* Container */
    .container {
        padding: 0 1rem;
        margin: 1.25rem auto;
    }

    /* Filter toggle visible */
    .filter-toggle {
        display: flex;
    }

    /* Sidebar slides in from left */
    .filter-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        max-height: 100vh;
        border-radius: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-lg);
        overflow-y: auto;
    }
    .filter-sidebar.open {
        transform: translateX(0);
    }

    /* Hide table view on mobile */
    #btnTable { display: none; }

    /* Top bar wraps */
    .top-bar {
        flex-wrap: wrap;
        gap: 0.6rem;
        padding: 0.6rem 0.85rem;
    }

    /* Grid cards single column */
    .grid-view {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    /* Table horizontal scroll */
    .table-container {
        border-radius: 6px;
        -webkit-overflow-scrolling: touch;
    }
    .data-table {
        min-width: 900px;
    }

    /* Card adjustments */
    .card {
        padding: 1.1rem;
    }
    .card h3 {
        font-size: 0.95rem;
    }
    .card-body {
        font-size: 0.8rem;
    }

    /* Footer */
    footer {
        padding: 1.5rem 1rem;
        margin-top: 2rem;
    }
    footer p {
        font-size: 0.72rem;
    }
    .footer-note {
        font-size: 0.68rem !important;
    }
    .footer-disclaimer {
        font-size: 0.68rem;
    }
    .footer-logo {
        height: 16px;
    }
}

/* === Small phones: 480px and below === */
@media (max-width: 480px) {
    /* Header */
    header {
        padding: 1.5rem 1rem 1.25rem;
    }
    header h1 {
        font-size: 1.25rem;
        margin-bottom: 0.4rem;
    }
    header p {
        font-size: 0.8rem;
        line-height: 1.5;
    }
    .brand-logo {
        height: 16px;
    }
    .brand {
        margin-bottom: 0.75rem;
    }

    /* Container */
    .container {
        padding: 0 0.75rem;
        margin: 1rem auto;
    }

    /* Top bar stacks vertically */
    .top-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.6rem 0.75rem;
    }
    .top-bar > div:last-child {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .sort-select {
        flex: 1;
        min-width: 0;
        font-size: 0.78rem;
    }
    .view-toggles {
        flex-shrink: 0;
    }
    .view-btn {
        padding: 0.35rem 0.65rem;
        font-size: 0.72rem;
    }

    /* Cards */
    .card {
        padding: 1rem;
    }
    .card h3 {
        font-size: 0.9rem;
    }
    .badge {
        font-size: 0.55rem;
        padding: 0.15rem 0.4rem;
    }
    .info-label {
        width: 70px;
        font-size: 0.72rem;
    }
    .card-body {
        font-size: 0.78rem;
    }
    .notes {
        font-size: 0.72rem;
        padding: 0.5rem;
    }
    .btn {
        padding: 0.55rem 1rem;
        font-size: 0.78rem;
    }

    /* Sidebar narrower on small phones */
    .filter-sidebar {
        width: 260px;
    }
    .sidebar-header h3 {
        font-size: 0.8rem;
    }
    .filter-group-header h4 {
        font-size: 0.68rem;
    }
    .checkbox-label {
        font-size: 0.78rem;
    }
    .search-box input {
        font-size: 0.8rem;
        padding: 0.6rem 0.75rem;
    }

    /* Footer */
    footer {
        padding: 1.25rem 0.75rem;
        margin-top: 1.5rem;
    }
    .footer-content {
        padding: 0 0.25rem;
    }
    .footer-logo {
        height: 14px;
    }
    footer p {
        font-size: 0.68rem;
    }
    .footer-note,
    .footer-disclaimer {
        font-size: 0.62rem !important;
    }

    /* No results */
    .no-results {
        padding: 2rem 1rem;
        font-size: 0.85rem;
    }
}

/* Prevent body scroll when filter panel is open */
body.filter-open {
    overflow: hidden;
}
