:root {
    --primary-color: #6B21A8;
    --primary-light: #A855F7;
    --primary-dark: #581C87;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f7ff;
    --bg-card: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius: 12px;
    --transition: 0.2s ease;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0f0f23;
        --bg-secondary: #1a1a2e;
        --bg-card: #16213e;
        --text-primary: #f3f4f6;
        --text-secondary: #9ca3af;
        --border-color: #374151;
    }
}

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

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

a { color: var(--primary-color); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Visible keyboard focus everywhere */
:focus-visible {
    outline: 3px solid var(--primary-light);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    z-index: 100;
    transition: top var(--transition);
}
.skip-link:focus { top: 0; }

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: white;
    padding: 3rem 1rem;
    text-align: center;
}
header h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); margin-bottom: 0.5rem; }
header p { opacity: 0.95; font-size: 1.1rem; max-width: 640px; margin: 0 auto; }

/* Stats Grid (home hero) */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    max-width: 800px;
    margin: 2rem auto 0;
}
.stat-card {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
}
.stat-number { font-size: 1.75rem; font-weight: 700; }
.stat-label { font-size: 0.85rem; opacity: 0.9; }

/* Controls */
.controls { max-width: 1200px; margin: -1.5rem auto 2rem; padding: 0 1rem; }
.search-box { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 1.5rem; }
.search-input-wrap { position: relative; margin-bottom: 1rem; }
.search-input-wrap svg {
    position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
    width: 20px; height: 20px; color: var(--text-secondary);
}
#search {
    width: 100%; padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--border-color); border-radius: 8px;
    font-size: 1rem; background: var(--bg-primary); color: var(--text-primary);
    transition: border-color var(--transition);
}
#search:focus { outline: none; border-color: var(--primary-color); }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.filter-group h3 { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 0.5rem; font-weight: 600; }
.filter-options { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Filter chips are real buttons now (keyboard accessible) */
.filter-chip {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.6rem 0.9rem;            /* larger touch target (>=44px tall) */
    min-height: 44px;
    background: var(--bg-secondary); border: 1px solid var(--border-color);
    border-radius: 20px; font-size: 0.875rem; font-family: inherit;
    color: var(--text-primary); cursor: pointer; transition: all var(--transition);
}
.filter-chip:hover { border-color: var(--primary-color); }
.filter-chip[aria-pressed="true"] {
    background: var(--primary-color); color: white; border-color: var(--primary-color);
}

.results-count { text-align: center; color: var(--text-secondary); margin: 1rem 0; font-size: 0.9rem; }

/* Main */
main { max-width: 1200px; margin: 0 auto; padding: 0 1rem 3rem; }
#schools-container { display: grid; gap: 2rem; }

.state-card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.state-header {
    width: 100%; background: var(--bg-secondary); padding: 1rem 1.5rem;
    border: none; border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
    font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.state-header h2 { font-size: 1.25rem; display: flex; align-items: center; gap: 0.5rem; }
.state-count { background: var(--primary-color); color: white; padding: 0.25rem 0.75rem; border-radius: 20px; font-size: 0.875rem; }
.state-header .toggle-icon { font-size: 1.5rem; color: var(--primary-color); display: none; }

.schools-list { padding: 1rem 1.5rem; }
.school-item { padding: 1rem 0; border-bottom: 1px solid var(--border-color); }
.school-item:last-child { border-bottom: none; }
.school-name { font-weight: 600; font-size: 1.1rem; margin-bottom: 0.25rem; }
.school-name a { color: var(--text-primary); }
.school-name a:hover { color: var(--primary-color); }
.school-meta { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.875rem; color: var(--text-secondary); }
.school-meta span { display: inline-flex; align-items: center; gap: 0.25rem; }

.badge { display: inline-block; padding: 0.125rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.badge-msn { background: #dbeafe; color: #1e40af; }
.badge-dnp { background: #fef3c7; color: #b45309; }
.badge-certificate, .badge-cert { background: #d1fae5; color: #065f46; }
.badge-online, .badge-format { background: #ede9fe; color: #6b21a8; }

/* FAQ */
.faq-section { max-width: 800px; margin: 3rem auto; padding: 0 1rem; }
.faq-section h2 { text-align: center; margin-bottom: 2rem; font-size: 1.75rem; }
.faq-item { background: var(--bg-card); border-radius: var(--radius); margin-bottom: 1rem; box-shadow: var(--shadow); overflow: hidden; }
.faq-question {
    width: 100%; padding: 1.25rem; cursor: pointer;
    display: flex; justify-content: space-between; align-items: center;
    font-weight: 600; font: inherit; font-weight: 600;
    background: var(--bg-card); color: inherit; border: none; text-align: left;
}
.faq-question:hover { background: var(--bg-secondary); }
.faq-question .faq-icon { font-size: 1.5rem; color: var(--primary-color); margin-left: 1rem; }
.faq-answer { padding: 0 1.25rem; max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease; }
.faq-question[aria-expanded="true"] + .faq-answer { padding: 0 1.25rem 1.25rem; max-height: 600px; }

/* State page */
.breadcrumb { max-width: 1000px; margin: 1rem auto; padding: 0 1rem; font-size: 0.875rem; color: var(--text-secondary); }
.breadcrumb a { color: var(--text-secondary); }
.state-page main { max-width: 1000px; }
.state-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.state-stat { background: var(--bg-card); padding: 1rem; border-radius: 8px; text-align: center; border: 1px solid var(--border-color); }
.state-stat .num { font-size: 1.5rem; font-weight: 700; color: var(--primary-color); }
.state-stat .label { font-size: 0.8rem; color: var(--text-secondary); }
.school-card { background: var(--bg-card); border-radius: 12px; padding: 1.5rem; margin-bottom: 1rem; border: 1px solid var(--border-color); }
.school-card .school-name { font-size: 1.25rem; }
.cta { background: var(--primary-color); color: #fff; padding: 0.75rem 1.5rem; border-radius: 8px; display: inline-block; margin-top: 1rem; min-height: 44px; }
.cta:hover { opacity: 0.9; text-decoration: none; }
.info { background: var(--bg-card); border-radius: 12px; padding: 1.5rem; margin: 2rem 0; border: 1px solid var(--border-color); }
.info h2 { margin-bottom: 1rem; font-size: 1.25rem; }
.info p + p { margin-top: 0.75rem; }
.lead { font-size: 1.05rem; }
.nearby-states { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.nearby-states a { background: var(--bg-secondary); border: 1px solid var(--border-color); padding: 0.4rem 0.8rem; border-radius: 20px; font-size: 0.875rem; }
.verify-note { font-size: 0.8rem; color: var(--text-secondary); font-style: italic; margin-top: 0.5rem; }

/* Footer */
footer { background: var(--bg-secondary); padding: 2rem 1rem; text-align: center; color: var(--text-secondary); font-size: 0.875rem; }
footer a { color: var(--text-secondary); }
footer p + p { margin-top: 0.4rem; }

/* Feedback widget */
.feedback { max-width: 800px; margin: 2rem auto; padding: 1.25rem; text-align: center; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius); }
.feedback h3 { font-size: 1rem; margin-bottom: 0.75rem; }
.feedback-btns { display: inline-flex; gap: 0.5rem; }
.feedback-btn { min-height: 44px; padding: 0.5rem 1.25rem; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-card); color: var(--text-primary); font: inherit; cursor: pointer; }
.feedback-btn:hover { border-color: var(--primary-color); }
.feedback-comment { margin-top: 1rem; display: none; }
.feedback-comment.show { display: block; }
.feedback-comment textarea { width: 100%; max-width: 500px; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: 8px; font: inherit; background: var(--bg-card); color: var(--text-primary); }
.feedback-comment button { margin-top: 0.5rem; min-height: 44px; padding: 0.5rem 1.25rem; background: var(--primary-color); color: #fff; border: none; border-radius: 8px; font: inherit; cursor: pointer; }
.feedback-honeypot { position: absolute; left: -9999px; }
.feedback-thanks { display: none; color: var(--primary-color); font-weight: 600; }

/* Modal */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; }
.modal.active { display: flex; }
.modal-content { background: var(--bg-card); padding: 2rem; border-radius: var(--radius); max-width: 400px; width: 90%; }
.modal-content h3 { margin-bottom: 1rem; }
.shortcut { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid var(--border-color); }
.shortcut kbd { background: var(--bg-secondary); padding: 0.25rem 0.5rem; border-radius: 4px; font-family: monospace; }
.modal-close { width: 100%; padding: 0.6rem; min-height: 44px; cursor: pointer; margin-top: 1rem; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-secondary); color: var(--text-primary); font: inherit; }

.no-results { text-align: center; padding: 3rem; color: var(--text-secondary); }
.no-results h3 { margin-bottom: 0.5rem; }

/* Mobile accordion for home state cards */
@media (max-width: 768px) {
    .state-header .toggle-icon { display: inline; }
    .state-card .schools-list { max-height: 0; overflow: hidden; padding: 0 1.5rem; }
    .state-card.expanded .schools-list { max-height: none; padding: 1rem 1.5rem; }
}
@media (min-width: 769px) {
    .state-header { cursor: default; }
}
