/* =============================================
   Color Theory Teacher — style.css
   Clean educational design-textbook aesthetic
   ============================================= */

:root {
    --bg: #f8f9fa;
    --surface: #ffffff;
    --border: #e9ecef;
    --text: #1a1a2e;
    --muted: #6c757d;
    --primary: #4361ee;
    --primary-h: #3a4fd0;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    --header-h: 54px;
}

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

html {
    font-size: 14px;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ── */
.site-header {
    height: var(--header-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    box-shadow: var(--shadow);
}

.header-inner {
    height: 100%;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 1.3rem;
}

.header-tabs {
    display: flex;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

.tab {
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--muted);
    transition: all 0.18s;
}

.tab.active,
.tab:hover {
    background: rgba(67, 97, 238, 0.08);
    color: var(--primary);
    border-color: rgba(67, 97, 238, 0.2);
}

.header-actions {
    flex-shrink: 0;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-h);
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.3);
}

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--muted);
}

.btn-outline:hover {
    color: var(--text);
    border-color: var(--primary);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.76rem;
}

/* ── Tab Panels ── */
.tab-panel {
    display: none;
    flex: 1;
}

.tab-panel.active {
    display: flex;
    flex-direction: column;
}

/* ── Explore Grid ── */
.explore-grid {
    display: grid;
    grid-template-columns: 280px 1fr 1fr;
    gap: 16px;
    padding: 16px;
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.panel-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 12px;
}

/* ── Wheel Panel ── */
.wheel-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wheel-wrapper {
    position: relative;
    width: 260px;
    height: 260px;
    cursor: crosshair;
}

#color-wheel {
    border-radius: 50%;
    box-shadow: var(--shadow);
}

.wheel-pointer {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: top 0.12s, left 0.12s;
}

/* ── HSL Sliders ── */
.hsl-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slider-row {
    display: grid;
    grid-template-columns: 90px 1fr 40px;
    gap: 8px;
    align-items: center;
}

.slider-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
}

.slider {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.hue-slider {
    background: linear-gradient(to right, hsl(0, 70%, 50%), hsl(30, 70%, 50%), hsl(60, 70%, 50%), hsl(120, 70%, 50%), hsl(180, 70%, 50%), hsl(240, 70%, 50%), hsl(300, 70%, 50%), hsl(360, 70%, 50%));
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.slider-val {
    font-size: 0.78rem;
    color: var(--muted);
    text-align: right;
}

/* ── Scheme Picker ── */
.scheme-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.scheme-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.scheme-options {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.scheme-opt {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 10px;
    font-family: inherit;
    font-size: 0.73rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--muted);
    transition: all 0.18s;
}

.scheme-opt.active,
.scheme-opt:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ── Color Blindness ── */
.cb-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cb-select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    font-family: inherit;
    font-size: 0.8rem;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

/* ── Scheme Panel ── */
.scheme-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.scheme-explanation {
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.6;
    background: rgba(67, 97, 238, 0.05);
    border: 1px solid rgba(67, 97, 238, 0.12);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.color-swatch-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.color-swatch {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.18s;
    flex-shrink: 0;
}

.color-swatch:hover {
    transform: scale(1.05);
}

.swatch-label {
    font-size: 0.68rem;
    font-family: monospace;
    color: var(--muted);
}

.swatch-role {
    font-size: 0.65rem;
    color: var(--muted);
    text-align: center;
}

.export-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.export-tabs {
    display: flex;
    gap: 4px;
}

.exp-tab {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    padding: 5px 12px;
    font-family: inherit;
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--muted);
}

.exp-tab.active {
    background: var(--surface);
    border-bottom-color: var(--surface);
    color: var(--primary);
    border-color: var(--border);
}

.export-code {
    background: #1e2030;
    color: #cdd6f4;
    padding: 12px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) var(--radius-sm);
    font-size: 0.72rem;
    font-family: monospace;
    overflow-x: auto;
    white-space: pre;
    min-height: 80px;
    line-height: 1.6;
    border: 1px solid var(--border);
}

/* ── UI Mockup ── */
.mockup-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mockup {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    font-size: 0.82rem;
    transition: all 0.3s ease;
}

.mock-nav {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mock-logo {
    font-weight: 800;
    font-size: 1rem;
}

.mock-nav-links {
    display: flex;
    gap: 14px;
    font-size: 0.78rem;
}

.mock-hero {
    padding: 28px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.mock-hero h1 {
    font-size: 1.2rem;
    font-weight: 800;
}

.mock-hero p {
    font-size: 0.78rem;
    opacity: 0.85;
    max-width: 260px;
    line-height: 1.5;
}

.mock-cta {
    padding: 8px 20px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.8rem;
}

.mock-cards-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
}

.mock-card {
    padding: 14px 10px;
    text-align: center;
}

.mock-card-icon {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.mock-card-label {
    font-size: 0.72rem;
    font-weight: 600;
}

/* ── Quiz ── */
.quiz-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.quiz-card {
    width: 100%;
    max-width: 560px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--shadow);
}

.quiz-score-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quiz-score {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
}

.quiz-streak {
    font-size: 0.82rem;
    color: #f59e0b;
}

.quiz-q {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5;
}

.quiz-swatches {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.quiz-swatch {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.quiz-opt {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    font-family: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.18s;
}

.quiz-opt:hover {
    border-color: var(--primary);
}

.quiz-opt.correct {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.08);
}

.quiz-opt.wrong {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.quiz-feedback {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
}

.quiz-feedback.correct {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.quiz-feedback.wrong {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* ── Extract ── */
.extract-wrapper {
    flex: 1;
    display: flex;
    gap: 24px;
    padding: 24px;
    align-items: flex-start;
}

.extract-upload {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

.drop-area {
    width: 300px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    color: var(--muted);
    transition: border-color 0.2s;
}

.drop-area.drag-over {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.04);
}

.drop-icon {
    font-size: 2.5rem;
}

#extract-img {
    max-width: 300px;
    border-radius: var(--radius-sm);
}

.extract-results {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.extract-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.extract-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ext-swatch-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ext-swatch {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.18s;
}

.ext-swatch:hover {
    transform: scale(1.1);
}

.ext-swatch-hex {
    font-size: 0.65rem;
    font-family: monospace;
    color: var(--muted);
}

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 18px;
    right: 18px;
    background: var(--text);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    font-size: 0.82rem;
    z-index: 999;
    opacity: 0;
    transform: translateY(6px);
    transition: all 0.25s;
    pointer-events: none;
    max-width: 280px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ── Responsive ── */
@media (max-width: 1000px) {
    .explore-grid {
        grid-template-columns: 260px 1fr;
    }

    .mockup-panel {
        display: none;
    }
}

@media (max-width: 680px) {
    .explore-grid {
        grid-template-columns: 1fr;
    }

    .header-tabs {
        gap: 2px;
    }

    .tab {
        padding: 5px 8px;
        font-size: 0.72rem;
    }
}