:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --success: #0d8043;
    --warning: #e37400;
    --bg: #f8f9fa;
    --card-bg: #ffffff;
    --text: #202124;
    --text-light: #5f6368;
    --border: #dadce0;
    --radius: 8px;
}

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

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

header {
    background: var(--primary);
    color: white;
    padding: 2rem;
    text-align: center;
}

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

header .subtitle {
    opacity: 0.9;
    font-size: 1rem;
}

main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Search Section — dropdown-only layout */
.search-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.dropdown-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.dropdown-row .filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.filter-group select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.dropdown-row button {
    padding: 0.6rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    height: fit-content;
}

.dropdown-row button:hover {
    background: var(--primary-dark);
}

.dropdown-row button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
}

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

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

/* Results / Content Output */
.results-section {
    margin-top: 1.5rem;
}

.content-output {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.content-header {
    background: var(--primary);
    color: white;
    padding: 1.5rem 2rem;
}

.content-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.content-header .content-level {
    opacity: 0.9;
    font-size: 0.95rem;
}

.content-section {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
}

.content-section:last-of-type {
    border-bottom: none;
}

.content-section h3 {
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.content-section p {
    color: var(--text);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

/* Key Concepts */
.concepts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.concept-item {
    background: #f1f3f4;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    border-left: 4px solid var(--primary);
}

/* Quiz Table */
.quiz-table,
.sources-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.quiz-table th,
.sources-table th {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 500;
}

.quiz-table td,
.sources-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.quiz-table tr:nth-child(even),
.sources-table tr:nth-child(even) {
    background: #f8f9fa;
}

.quiz-table tr:hover,
.sources-table tr:hover {
    background: #e8f0fe;
}

.sources-table a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.sources-table a:hover {
    text-decoration: underline;
}

.sources-intro {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Resource Lists (images, models, videos, simulations) */
.resource-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.resource-item {
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}

.resource-item a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.resource-item a:hover {
    text-decoration: underline;
}

.resource-meta {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.resource-description {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.25rem;
    margin-bottom: 0;
}

/* Content Footer */
.content-footer {
    background: #f1f3f4;
    padding: 1rem 2rem;
    text-align: center;
}

.content-footer p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0;
}

/* Error */
.error-section {
    background: #fce8e6;
    border: 1px solid #f5c6cb;
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    color: #c5221f;
    margin-top: 1rem;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-light);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

footer p {
    margin-bottom: 0.25rem;
}

/* Responsive */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.4rem;
    }

    .dropdown-row {
        flex-direction: column;
    }

    .dropdown-row .filter-group {
        min-width: 100%;
    }

    .content-section {
        padding: 1rem;
    }

    .content-header {
        padding: 1rem;
    }

    .quiz-table,
    .sources-table {
        font-size: 0.8rem;
    }

    .quiz-table th,
    .quiz-table td,
    .sources-table th,
    .sources-table td {
        padding: 0.5rem;
    }
}

@media (max-width: 768px) {
    .quiz-table,
    .sources-table {
        display: block;
        overflow-x: auto;
    }
}
