/* MAE Model Calibration Lab - Custom Styles */
/* Extends shared/css/main.css */

/* Professor Mode styles are centralized in shared/css/main.css */

/* Position Professor Mode toggle in hero header */
.hero-header .professor-mode-toggle {
    align-self: flex-start;
    margin-top: 0.5rem;
}

/* ===== Model Sections ===== */
.model-section {
    margin-bottom: 1.5rem;
}

.model-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--app-border, #e2e8f0);
}

.model-header h3 {
    margin: 0;
    color: var(--app-text, #1e293b);
    font-size: 1.15rem;
}

/* ===== Controls Grid ===== */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--app-text, #1e293b);
}

.param-name {
    font-size: 0.95rem;
}

.param-value {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 1rem;
    color: var(--app-accent, #2563eb);
    font-weight: 700;
    background: #eff6ff;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    min-width: 80px;
    text-align: center;
}

.slider-input-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider-input-row input[type="range"] {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #dbeafe, var(--app-accent, #2563eb));
    border-radius: 4px;
    outline: none;
}

.slider-input-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--app-accent, #2563eb);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.slider-input-row input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.5);
}

.slider-input-row input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--app-accent, #2563eb);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
}

.slider-input-row input[type="number"] {
    width: 100px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--app-border, #e2e8f0);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    text-align: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.slider-input-row input[type="number"]:focus {
    outline: none;
    border-color: var(--app-accent, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ===== Results Display ===== */
.results-display {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 10px;
    border-left: 4px solid var(--app-accent, #2563eb);
}

.equation-display {
    font-size: 1rem;
    color: var(--app-text, #1e293b);
}

.equation-display .dynamic-value {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-weight: 700;
    color: var(--app-accent, #2563eb);
    font-size: 1.1rem;
}

.mae-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mae-label {
    font-weight: 600;
    color: var(--app-muted, #64748b);
    font-size: 0.9rem;
}

.mae-display .mae-value {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--app-accent, #2563eb);
}

/* ===== Plot Container ===== */
.plot-container {
    width: 100%;
    height: 400px;
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
}

/* ===== Comparison Section ===== */
.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.comparison-intro {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--app-muted, #64748b);
}

.comparison-card {
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.comparison-card:hover {
    transform: translateY(-2px);
}

.comparison-card.linear {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 2px solid #93c5fd;
}

.comparison-card.quadratic {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #fbbf24;
}

.comparison-card h4 {
    margin: 0 0 1rem;
    font-size: 1rem;
    color: var(--app-text, #1e293b);
}

.comparison-row {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
    margin-bottom: 1rem;
}

.comparison-mae {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.comparison-mae.user-mae .mae-value {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--app-text, #1e293b);
}

.comparison-mae.optimal-mae .mae-value {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 1.25rem;
    font-weight: 500;
    color: #059669;
}

.comparison-mae .mae-label {
    font-size: 0.8rem;
    color: var(--app-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mae-gap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #cbd5e1;
    font-size: 0.85rem;
}

.mae-gap .gap-label {
    color: var(--app-muted, #64748b);
}

.mae-gap .gap-value {
    font-weight: 500;
}

.gap-excellent {
    color: #059669;
    font-weight: 600;
}

.gap-good {
    color: #0284c7;
}

.gap-room {
    color: #dc2626;
}

.comparison-card.winner .user-mae .mae-value {
    color: var(--app-success, #16a34a);
}

.comparison-verdict {
    text-align: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    font-weight: 500;
    color: var(--app-text, #1e293b);
}

.comparison-verdict.has-winner {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border: 1px solid #86efac;
}

/* ===== Concept Grid ===== */
.concept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.concept-item {
    padding: 1.25rem;
    background: #f8fafc;
    border-radius: 10px;
    border-left: 3px solid var(--app-accent, #2563eb);
}

.concept-item h4 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    color: var(--app-text, #1e293b);
}

.concept-item p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--app-muted, #64748b);
    line-height: 1.5;
}

/* ===== Guide Sections (for interpretation content) ===== */
.guide-section {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.guide-section:last-child {
    margin-bottom: 0;
}

.guide-section h5 {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    color: #1e40af;
}

.guide-section p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--app-text, #1e293b);
    line-height: 1.5;
}

/* ===== Callout Boxes ===== */
.callout-box {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.callout-box p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.callout-blue {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
}

.callout-blue p {
    color: #1e40af;
}

.callout-green {
    background: #f0fdf4;
    border-left: 4px solid #22c55e;
}

.callout-green p {
    color: #166534;
}

.callout-yellow {
    background: #fefce8;
    border-left: 4px solid #eab308;
}

.callout-yellow p {
    color: #854d0e;
}

/* ===== Equation Block ===== */
.equation-block {
    background: white;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    border: 1px solid var(--app-border, #e2e8f0);
    margin-bottom: 1rem;
}

.equation-block p {
    margin: 0 0 0.5rem;
    font-weight: 600;
    color: var(--app-text, #1e293b);
}

/* ===== Questions List ===== */
.questions-list {
    padding-left: 1.5rem;
}

.questions-list li {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: var(--app-text, #1e293b);
}

.questions-list li:last-child {
    margin-bottom: 0;
}

.questions-list strong {
    color: #1e40af;
}

/* ===== Interpretation Aid Styling ===== */
.interpretation-aid {
    margin-top: 1rem;
    background: #fafbfc;
    border: 1px solid var(--app-border, #e2e8f0);
    border-radius: 8px;
}

.interpretation-aid summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--app-text, #1e293b);
    user-select: none;
}

.interpretation-aid summary:hover {
    background: #f1f5f9;
}

.interpretation-content {
    padding: 0 1rem 1rem;
}

.interpretation-content ul {
    margin: 0;
    padding-left: 1.5rem;
}

.interpretation-content li {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.interpretation-content li:last-child {
    margin-bottom: 0;
}

/* ===== Intro Notes Styling ===== */
.intro-notes {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    margin-top: 1rem;
}

.intro-notes summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 600;
    color: #0369a1;
    user-select: none;
}

.intro-notes summary:hover {
    background: #e0f2fe;
}

.notes-content {
    padding: 0 1rem 1rem;
}

.notes-content p {
    margin: 0 0 0.75rem;
    line-height: 1.6;
}

.notes-content p:last-child {
    margin-bottom: 0;
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 768px) {
    .controls-grid {
        grid-template-columns: 1fr;
    }
    
    .results-display {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .mae-display {
        width: 100%;
        justify-content: center;
    }
    
    .comparison-grid {
        grid-template-columns: 1fr;
    }
    
    .plot-container {
        height: 300px;
    }
    
    .concept-grid {
        grid-template-columns: 1fr;
    }
    
    .param-value {
        min-width: 70px;
        font-size: 0.9rem;
    }
    
    .slider-input-row input[type="number"] {
        width: 80px;
    }
}

/* ===== Test Overview Section ===== */
.test-overview {
    margin-bottom: 1.5rem;
}

.test-overview h2 {
    margin-bottom: 1rem;
    color: #1e40af;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.instructions-section h2,
.model-section h2,
.comparison-section h2,
.questions-section h2,
.scenario-section h2 {
    margin-bottom: 1rem;
    color: #1e40af;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== Scenario Section ===== */
.scenario-section {
    margin-bottom: 1.5rem;
}

.scenario-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.scenario-controls label {
    font-weight: 600;
    color: var(--app-text, #1e293b);
}

.scenario-controls__input {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.scenario-controls__input select {
    flex: 1;
    min-width: 250px;
    padding: 0.6rem 1rem;
    border: 1px solid var(--app-border, #e2e8f0);
    border-radius: 6px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
}

.scenario-controls__input select:focus {
    outline: none;
    border-color: var(--app-accent, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.scenario-controls__input button.secondary {
    padding: 0.6rem 1.2rem;
    background: white;
    color: var(--app-accent, #2563eb);
    border: 1px solid var(--app-accent, #2563eb);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.scenario-controls__input button.secondary:hover:not(:disabled) {
    background: var(--app-accent, #2563eb);
    color: white;
}

.scenario-controls__input button.secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.scenario-description-container {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem;
    min-height: 100px;
}

.scenario-placeholder {
    color: #64748b;
    font-style: italic;
    margin: 0;
}

.scenario-description {
    line-height: 1.6;
}

.scenario-description h4 {
    margin: 0 0 0.75rem;
    color: var(--app-text, #1e293b);
    font-size: 1.05rem;
}

.scenario-description p {
    margin: 0 0 1rem;
    color: #475569;
}

.scenario-description .var-tag {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-family: 'SF Mono', monospace;
    font-size: 0.85rem;
    margin: 0 0.15rem;
}

.scenario-description .context-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.scenario-description .context-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #475569;
}

.scenario-description .context-item strong {
    color: var(--app-text, #1e293b);
    min-width: 80px;
}

/* ===== Dynamic Interpretation Styles ===== */
.dynamic-interpretation {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.interpretation-item {
    padding-bottom: 1rem;
    border-bottom: 1px dashed #e2e8f0;
}

.interpretation-item:last-of-type {
    padding-bottom: 0;
    border-bottom: none;
}

.interp-label {
    font-weight: 600;
    color: var(--app-accent, #2563eb);
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
}

.interpretation-item p {
    margin: 0;
    line-height: 1.6;
    color: #475569;
}

.interpretation-good {
    color: #059669;
    font-weight: 600;
}

.interpretation-ok {
    color: #d97706;
    font-weight: 600;
}

.interpretation-poor {
    color: #dc2626;
    font-weight: 600;
}

.interpretation-highlight {
    font-weight: 600;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

.interpretation-highlight.negative {
    background: #fee2e2;
    color: #b91c1c;
}

.interpretation-highlight.positive {
    background: #dcfce7;
    color: #166534;
}

.interpretation-note {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #fef3c7;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #92400e;
}

.interpretation-note em {
    font-style: normal;
}

/* Ensure callout boxes look good inside interpretation */
.interpretation-content .callout-box {
    margin-top: 1rem;
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 640px) {
    .scenario-controls__input {
        flex-direction: column;
    }
    
    .scenario-controls__input select {
        min-width: 100%;
    }
    
    .scenario-controls__input button.secondary {
        width: 100%;
    }
    
    .scenario-description .context-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Categorical Toggle & Controls ===== */
.categorical-toggle-container {
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.categorical-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.categorical-toggle input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 26px;
    background: #cbd5e1;
    border-radius: 13px;
    transition: background 0.25s ease;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transition: transform 0.25s ease;
}

.categorical-toggle input:checked + .toggle-slider {
    background: var(--app-accent, #2563eb);
}

.categorical-toggle input:checked + .toggle-slider::after {
    transform: translateX(22px);
}

.toggle-label {
    font-weight: 600;
    color: var(--app-text, #1e293b);
    font-size: 0.95rem;
}

/* Category Legend */
.category-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
}

.category-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #475569;
}

.category-legend-symbol {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid currentColor;
}

.category-legend-symbol.diamond {
    border-radius: 0;
    transform: rotate(45deg) scale(0.75);
}

.category-legend-symbol.square {
    border-radius: 2px;
}

/* Categorical Controls Section */
.categorical-controls {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed #cbd5e1;
}

.categorical-controls .control-group label .param-name {
    font-size: 0.9rem;
}

.categorical-controls .param-value {
    background: #fef3c7;
    color: #92400e;
}

/* Category-specific intercept value colors */
.param-value.cat-medium {
    background: #fff7ed;
    color: #c2410c;
}

.param-value.cat-large {
    background: #ecfdf5;
    color: #047857;
}
