/* ============================================================
   OPTICAL PYROMETER VIRTUAL LAB — STYLESHEET
   Professional Engineering Laboratory UI
   ============================================================ */

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --clr-primary: #1e3a5f;
    --clr-primary-light: #2563eb;
    --clr-primary-dark: #0f1d33;
    --clr-accent: #e67e22;
    --clr-accent-light: #f39c12;
    --clr-success: #00c853;
    --clr-warning: #ff9800;
    --clr-danger: #ef5350;
    --clr-bg: #f8f9fb;
    --clr-card: #ffffff;
    --clr-card-alt: #f4f6f8;
    --clr-border: #e2e6ea;
    --clr-text: #2d3436;
    --clr-text-secondary: #636e72;
    --clr-text-muted: #99a3a8;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --transition: 0.25s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--clr-bg);
    color: var(--clr-text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== HEADER ===== */
#lab-header {
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-dark));
    color: white;
    padding: 16px 28px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1600px;
    margin: 0 auto;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.lab-icon {
    flex-shrink: 0;
}

.header-text h1 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1.3;
}

.header-text .subtitle {
    font-size: 0.78rem;
    opacity: 0.7;
    font-weight: 400;
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-actions {
    display: flex;
    align-items: center;
}

.sim-theme-toggle-wrap {
    display: inline-flex;
    align-items: center;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.12);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.1);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--clr-success);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.status-badge.heating .status-dot {
    background: var(--clr-accent);
}

.status-badge.matched .status-dot {
    background: var(--clr-success);
    animation: none;
}

/* ===== OBJECTIVE BANNER ===== */
#objective-banner {
    background: #eef2ff;
    border-bottom: 1px solid #d4dbf5;
    padding: 10px 28px;
}

.objective-content {
    max-width: 1600px;
    margin: 0 auto;
    font-size: 0.85rem;
    color: var(--clr-primary);
}

.objective-content em {
    color: var(--clr-accent);
    font-weight: 600;
}

/* ===== MAIN WORKSPACE ===== */
#lab-workspace {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    max-width: 1600px;
    margin: 20px auto;
    padding: 0 20px;
}

/* ===== PANEL BASE ===== */
.panel {
    background: var(--clr-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--clr-border);
}

.panel-header {
    background: var(--clr-primary);
    color: white;
    padding: 12px 20px;
}

.panel-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.panel-body {
    padding: 16px;
}

/* ===== SETUP SVG ===== */
#setup-svg-container {
    background: linear-gradient(180deg, #fafafa 0%, #f0f0f0 100%);
    border-radius: var(--radius-sm);
    border: 1px solid var(--clr-border);
    padding: 8px;
    margin-bottom: 16px;
}

#labSetupSvg {
    width: 100%;
    height: auto;
    display: block;
}

.svg-label {
    font-family: var(--font-main);
}

/* ===== EYEPIECE SECTION ===== */
#eyepiece-section {
    margin-bottom: 16px;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--clr-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

#eyepiece-viewport {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(ellipse at center, #0a0a0a, #000);
    border-radius: var(--radius);
    padding: 20px;
    border: 2px solid #2a2a2a;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.5), var(--shadow-lg);
}

#eyepieceSvg {
    width: 280px;
    height: 280px;
    display: block;
}

.filament-status {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    color: #aaa;
    padding: 4px 14px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.08);
    white-space: nowrap;
    transition: var(--transition);
}

.filament-status.matched {
    background: rgba(0,200,83,0.2);
    color: var(--clr-success);
    border-color: rgba(0,200,83,0.3);
}

.filament-status.too-dim {
    color: #ff9800;
}

.filament-status.too-bright {
    color: #42a5f5;
}

.eyepiece-instruction {
    text-align: center;
    font-size: 0.78rem;
    color: var(--clr-text-secondary);
    margin-top: 10px;
    font-style: italic;
    line-height: 1.5;
}

/* ===== CONSTRUCTION VIEW ===== */
#construction-container {
    margin-bottom: 16px;
    background: #fafbfc;
    border-radius: var(--radius-sm);
    border: 1px solid var(--clr-border);
    padding: 16px;
    transition: var(--transition);
}

#construction-container.hidden {
    display: none;
}

#constructionSvg {
    width: 100%;
    height: auto;
    display: block;
}

/* ===== CONTROLS PANEL ===== */
#controls-panel .panel-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.control-group {
    background: var(--clr-card-alt);
    border-radius: var(--radius-sm);
    padding: 14px;
    border: 1px solid var(--clr-border);
}

.control-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--clr-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

/* ===== BUTTONS ===== */
.button-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn:not(:disabled):active {
    transform: translateY(0);
}

.btn-start {
    background: linear-gradient(135deg, #00c853, #00a843);
    color: white;
}

.btn-stop {
    background: linear-gradient(135deg, #ef5350, #d32f2f);
    color: white;
}

.btn-reset {
    background: linear-gradient(135deg, #546e7a, #455a64);
    color: white;
}

.btn-outline {
    background: white;
    color: var(--clr-primary);
    border: 1.5px solid var(--clr-primary-light);
}

.btn-outline:not(:disabled):hover {
    background: #eef2ff;
}

.btn-icon {
    font-size: 0.9rem;
}

/* ===== SLIDERS ===== */
.slider-wrapper {
    padding: 4px 0;
}

.slider-track-bg {
    padding: 4px 0;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.slider-brightness {
    background: linear-gradient(90deg, #333 0%, #ff9800 50%, #ffeb3b 100%);
}

.slider-temp {
    background: linear-gradient(90deg, #b71c1c 0%, #ff5722 30%, #ff9800 60%, #ffeb3b 100%);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--clr-primary-light);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: var(--transition);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(37,99,235,0.3);
}

.slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--clr-primary-light);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    cursor: pointer;
}

.slider-info {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--clr-text-muted);
}

.slider-current {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--clr-primary);
    font-family: var(--font-mono);
}

.brightness-bar {
    height: 6px;
    background: #e8e8e8;
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
}

.brightness-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    background: linear-gradient(90deg, #ff9800, #ffeb3b);
    transition: width 0.1s ease;
}

/* ===== LIVE READINGS ===== */
.readings-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reading-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--clr-border);
    transition: var(--transition);
}

.reading-card.highlight {
    border-color: var(--clr-primary-light);
    background: #f0f5ff;
}

.reading-card.matched {
    border-color: var(--clr-success);
    background: #e8f5e9;
    animation: flash-success 0.5s ease;
}

@keyframes flash-success {
    0%, 100% { background: #e8f5e9; }
    50% { background: #c8e6c9; }
}

.reading-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.reading-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.reading-label {
    font-size: 0.72rem;
    color: var(--clr-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.reading-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--clr-primary);
    font-family: var(--font-mono);
}

/* ===== STATUS PANEL ===== */
.status-panel {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--clr-border);
    min-height: 56px;
    transition: var(--transition);
}

.status-panel.heating {
    border-color: var(--clr-accent);
    background: #fff8f0;
}

.status-panel.ready {
    border-color: var(--clr-primary-light);
    background: #f0f5ff;
}

.status-panel.matched {
    border-color: var(--clr-success);
    background: #e8f5e9;
}

.status-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    line-height: 1;
}

.status-message {
    font-size: 0.82rem;
    color: var(--clr-text-secondary);
    line-height: 1.5;
}

.progress-container {
    position: relative;
    height: 22px;
    background: #e8e8e8;
    border-radius: 11px;
    overflow: hidden;
    margin-top: 8px;
    display: none;
}

.progress-container.visible {
    display: block;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--clr-accent), var(--clr-warning));
    border-radius: 11px;
    transition: width 0.3s ease;
}

.progress-label {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--clr-text-secondary);
    font-family: var(--font-mono);
}

/* ===== BOTTOM PANEL ===== */
#bottom-panel {
    max-width: 1600px;
    margin: 0 auto 30px;
    padding: 0 20px;
}

.tab-navigation {
    display: flex;
    gap: 4px;
    background: var(--clr-card);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 6px 6px 0;
    border: 1px solid var(--clr-border);
    border-bottom: none;
    overflow-x: auto;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    background: transparent;
    font-family: var(--font-main);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--clr-text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn:hover {
    background: var(--clr-card-alt);
    color: var(--clr-primary);
}

.tab-btn.active {
    background: var(--clr-primary);
    color: white;
}

.tab-icon {
    font-size: 1rem;
}

.tab-content {
    display: none;
    background: var(--clr-card);
    border-radius: 0 0 var(--radius) var(--radius);
    border: 1px solid var(--clr-border);
    border-top: 2px solid var(--clr-primary);
    padding: 20px;
    min-height: 300px;
    box-shadow: var(--shadow-sm);
}

.tab-content.active {
    display: block;
}

/* ===== OBSERVATION TABLE ===== */
.table-container {
    overflow-x: auto;
}

#observationTable,
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

#observationTable th,
.comparison-table th {
    background: var(--clr-primary);
    color: white;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

#observationTable td,
.comparison-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--clr-border);
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

#observationTable tr:nth-child(even),
.comparison-table tr:nth-child(even) {
    background: var(--clr-card-alt);
}

#observationTable tr:hover,
.comparison-table tr:hover {
    background: #eef2ff;
}

.empty-row td {
    text-align: center;
    color: var(--clr-text-muted);
    font-style: italic;
    padding: 30px;
    font-family: var(--font-main);
}

/* Row animation */
@keyframes row-slide-in {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.observation-row-new {
    animation: row-slide-in 0.4s ease;
}

/* ===== CHART ===== */
.chart-wrapper {
    position: relative;
    height: 350px;
    max-height: 400px;
}

.chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ===== WORKING PRINCIPLE ===== */
.principle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.principle-card {
    background: var(--clr-card-alt);
    border-radius: var(--radius-sm);
    padding: 18px;
    border: 1px solid var(--clr-border);
}

.principle-card.wide {
    grid-column: 1 / -1;
}

.principle-card.featured {
    border-color: var(--clr-accent);
    background: #fffbf5;
}

.principle-card h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--clr-primary);
    margin-bottom: 10px;
}

.principle-card p {
    font-size: 0.84rem;
    color: var(--clr-text-secondary);
    margin-bottom: 8px;
    line-height: 1.6;
}

.principle-card ul, .principle-card ol {
    padding-left: 18px;
    font-size: 0.83rem;
    color: var(--clr-text-secondary);
    line-height: 1.7;
}

.principle-card li {
    margin-bottom: 4px;
}

.principle-cases {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.case {
    padding: 10px 14px;
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--clr-border);
}

.case-header {
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 4px;
    padding: 3px 10px;
    border-radius: 4px;
    display: inline-block;
}

.case-dark {
    background: #333;
    color: #ff9800;
}

.case-bright {
    background: #fff3e0;
    color: #e65100;
}

.case-match {
    background: #e8f5e9;
    color: #2e7d32;
}

.case p {
    margin-bottom: 0;
    font-size: 0.8rem;
}

/* ===== APPLICATIONS ===== */
.applications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.app-card {
    background: var(--clr-card-alt);
    border-radius: var(--radius-sm);
    padding: 18px;
    border: 1px solid var(--clr-border);
    transition: var(--transition);
}

.app-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--clr-primary-light);
}

.app-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.app-card h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--clr-primary);
    margin-bottom: 6px;
}

.app-card p {
    font-size: 0.8rem;
    color: var(--clr-text-secondary);
    line-height: 1.5;
}

/* ===== FOOTER ===== */
#lab-footer {
    text-align: center;
    padding: 18px;
    background: var(--clr-primary-dark);
    color: rgba(255,255,255,0.5);
    font-size: 0.78rem;
    margin-top: 20px;
}

/* ===== HIDDEN UTILITY ===== */
.hidden {
    display: none !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
    #lab-workspace {
        grid-template-columns: 1fr;
    }
    #controls-panel {
        order: -1;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    .header-left {
        flex-direction: column;
    }
    .header-text h1 {
        font-size: 1.1rem;
    }
    #eyepieceSvg {
        width: 240px;
        height: 240px;
    }
    .principle-grid {
        grid-template-columns: 1fr;
    }
    .tab-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
}

@media (max-width: 500px) {
    .button-row {
        flex-direction: column;
    }
    .tab-navigation {
        flex-wrap: wrap;
    }
}

/* ===== ANIMATION KEYFRAMES ===== */
@keyframes glow-pulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.15); }
}

@keyframes furnace-shimmer {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* ================= ENHANCED RESPONSIVE MEDIA QUERIES ================= */

/* Tablet */
@media screen and (max-width: 1024px) {
    #lab-workspace {
        grid-template-columns: 1fr;
        padding: 0 12px;
        margin: 12px auto;
        gap: 14px;
    }
}

/* Mobile Portrait */
@media screen and (max-width: 767px) and (orientation: portrait) {
    #lab-workspace {
        display: flex;
        flex-direction: column;
        padding: 0 8px;
        margin: 8px auto;
        gap: 10px;
    }
    .svg-viewport svg, #eyepieceSvg {
        width: 100% !important;
        height: auto !important;
        max-height: 50vh;
    }
    /* Touch-friendly targets */
    .btn, button, select, input[type="range"], .tab-btn {
        min-height: 44px;
        font-size: 16px !important;
    }
    .button-row {
        flex-direction: column;
    }
    .tab-navigation {
        flex-wrap: wrap;
    }
    .header-content {
        flex-direction: column;
        gap: 8px;
    }
    .header-left {
        flex-direction: column;
    }
    .header-text h1 {
        font-size: 1rem;
    }
}

/* Mobile Landscape */
@media screen and (max-width: 950px) and (orientation: landscape) {
    #lab-workspace {
        display: grid;
        grid-template-columns: 1.2fr 0.8fr;
        gap: 10px;
        padding: 0 8px;
        margin: 8px auto;
    }
}

/* ============================================================
   DARK THEME STYLING & PROFESSIONAL LABORATORY PALETTE
   ============================================================ */
html[data-theme="dark"],
html.dark {
    --clr-primary: #38bdf8;
    --clr-primary-light: #60a5fa;
    --clr-primary-dark: #0f172a;
    --clr-bg: #080d18;
    --clr-card: #0f172a;
    --clr-card-alt: #141e33;
    --clr-border: #1e293b;
    --clr-text: #f8fafc;
    --clr-text-secondary: #94a3b8;
    --clr-text-muted: #64748b;
    color-scheme: dark;
}

html[data-theme="dark"] body,
html.dark body {
    background: var(--clr-bg);
    color: var(--clr-text);
}

/* Header in dark mode */
html[data-theme="dark"] #lab-header,
html.dark #lab-header {
    background: linear-gradient(135deg, #0f1d35 0%, #080d18 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Objective Banner in dark mode */
html[data-theme="dark"] #objective-banner,
html.dark #objective-banner {
    background: #0f172a !important;
    border-bottom: 1px solid #1e293b !important;
}

html[data-theme="dark"] .objective-content,
html.dark .objective-content {
    color: #94a3b8 !important;
}

html[data-theme="dark"] .objective-content strong,
html.dark .objective-content strong {
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .objective-content em,
html.dark .objective-content em {
    color: #f97316 !important;
}

/* Canvas & Apparatus in dark mode */
html[data-theme="dark"] #setup-svg-container,
html.dark #setup-svg-container {
    background: linear-gradient(180deg, #0b111e 0%, #060a12 100%) !important;
    border-color: #1e293b !important;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.6) !important;
}

html[data-theme="dark"] .pyro-bench,
html.dark .pyro-bench {
    fill: #131b2e !important;
    stroke: #1e293b !important;
}

html[data-theme="dark"] .pyro-bench-trim,
html.dark .pyro-bench-trim {
    fill: #1e293b !important;
}

html[data-theme="dark"] .svg-label,
html.dark .svg-label {
    fill: #cbd5e1 !important;
}

html[data-theme="dark"] .pyro-metal-label,
html.dark .pyro-metal-label {
    fill: #94a3b8 !important;
}

/* Eyepiece section in dark mode */
html[data-theme="dark"] .section-title,
html.dark .section-title {
    color: #38bdf8 !important;
}

html[data-theme="dark"] .eyepiece-instruction,
html.dark .eyepiece-instruction {
    color: #94a3b8 !important;
}

/* Internal Construction View in dark mode */
html[data-theme="dark"] #construction-container,
html.dark #construction-container {
    background: #0b111e !important;
    border-color: #1e293b !important;
}

html[data-theme="dark"] .const-title,
html.dark .const-title {
    fill: #38bdf8 !important;
}

html[data-theme="dark"] .const-main-tube,
html.dark .const-main-tube {
    fill: #141e33 !important;
    stroke: #2a3f5f !important;
}

html[data-theme="dark"] .const-battery rect,
html.dark .const-battery rect {
    fill: #1e293b !important;
    stroke: #334155 !important;
}

html[data-theme="dark"] .const-battery text,
html.dark .const-battery text {
    fill: #94a3b8 !important;
}

html[data-theme="dark"] .const-rheostat rect,
html.dark .const-rheostat rect {
    fill: #1e293b !important;
    stroke: #334155 !important;
}

html[data-theme="dark"] .const-meter circle,
html.dark .const-meter circle {
    fill: #1e293b !important;
    stroke: #38bdf8 !important;
}

html[data-theme="dark"] .const-meter text,
html.dark .const-meter text {
    fill: #38bdf8 !important;
}

html[data-theme="dark"] .const-meter-label,
html.dark .const-meter-label {
    fill: #94a3b8 !important;
}

html[data-theme="dark"] .const-wire,
html.dark .const-wire {
    stroke: #64748b !important;
}

html[data-theme="dark"] .const-label,
html.dark .const-label {
    fill: #94a3b8 !important;
}

html[data-theme="dark"] .const-circuit-title,
html.dark .const-circuit-title {
    fill: #38bdf8 !important;
}

html[data-theme="dark"] .const-observer-label,
html.dark .const-observer-label {
    fill: #cbd5e1 !important;
}

/* Panels in dark mode */
html[data-theme="dark"] .panel,
html.dark .panel {
    background: #0f172a !important;
    border-color: #1e293b !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] .panel-header,
html.dark .panel-header {
    background: #131d31 !important;
    border-bottom: 1px solid #1e293b !important;
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .control-group,
html.dark .control-group {
    background: #141e33 !important;
    border-color: #1e293b !important;
}

html[data-theme="dark"] .control-title,
html.dark .control-title {
    color: #38bdf8 !important;
}

html[data-theme="dark"] .btn-outline,
html.dark .btn-outline {
    background: #162033 !important;
    color: #38bdf8 !important;
    border-color: #2563eb !important;
}

html[data-theme="dark"] .btn-outline:not(:disabled):hover,
html.dark .btn-outline:not(:disabled):hover {
    background: #1e293b !important;
    color: #60a5fa !important;
}

html[data-theme="dark"] .slider-current,
html.dark .slider-current {
    color: #38bdf8 !important;
}

html[data-theme="dark"] .slider-info,
html.dark .slider-info {
    color: #64748b !important;
}

html[data-theme="dark"] .brightness-bar,
html.dark .brightness-bar {
    background: #1e293b !important;
}

/* Readings & Cards in dark mode */
html[data-theme="dark"] .reading-card,
html.dark .reading-card {
    background: #141e33 !important;
    border-color: #1e293b !important;
}

html[data-theme="dark"] .reading-card.highlight,
html.dark .reading-card.highlight {
    background: rgba(56, 189, 248, 0.12) !important;
    border-color: #38bdf8 !important;
}

html[data-theme="dark"] .reading-card.matched,
html.dark .reading-card.matched {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: #10b981 !important;
}

html[data-theme="dark"] .reading-value,
html.dark .reading-value {
    color: #f8fafc !important;
}

html[data-theme="dark"] .reading-label,
html.dark .reading-label {
    color: #94a3b8 !important;
}

/* Status Panel in dark mode */
html[data-theme="dark"] .status-panel,
html.dark .status-panel {
    background: #141e33 !important;
    border-color: #1e293b !important;
}

html[data-theme="dark"] .status-panel.heating,
html.dark .status-panel.heating {
    background: rgba(230, 126, 34, 0.12) !important;
    border-color: #e67e22 !important;
}

html[data-theme="dark"] .status-panel.ready,
html.dark .status-panel.ready {
    background: rgba(56, 189, 248, 0.12) !important;
    border-color: #38bdf8 !important;
}

html[data-theme="dark"] .status-panel.matched,
html.dark .status-panel.matched {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: #10b981 !important;
}

html[data-theme="dark"] .status-message,
html.dark .status-message {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .progress-container,
html.dark .progress-container {
    background: #1e293b !important;
}

html[data-theme="dark"] .progress-label,
html.dark .progress-label {
    color: #94a3b8 !important;
}

/* Tabs & Observation Table in dark mode */
html[data-theme="dark"] .tab-navigation,
html.dark .tab-navigation {
    background: #0f172a !important;
    border-color: #1e293b !important;
}

html[data-theme="dark"] .tab-btn,
html.dark .tab-btn {
    color: #94a3b8 !important;
}

html[data-theme="dark"] .tab-btn:hover,
html.dark .tab-btn:hover {
    background: #141e33 !important;
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .tab-btn.active,
html.dark .tab-btn.active {
    background: #2563eb !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .tab-content,
html.dark .tab-content {
    background: #0f172a !important;
    border-color: #1e293b !important;
    border-top-color: #2563eb !important;
}

html[data-theme="dark"] #observationTable th,
html[data-theme="dark"] .comparison-table th,
html.dark #observationTable th,
html.dark .comparison-table th {
    background: #131d31 !important;
    color: #93c5fd !important;
    border-bottom: 1px solid #1e293b !important;
}

html[data-theme="dark"] #observationTable td,
html[data-theme="dark"] .comparison-table td,
html.dark #observationTable td,
html.dark .comparison-table td {
    border-bottom: 1px solid #1e293b !important;
    color: #cbd5e1 !important;
}

html[data-theme="dark"] #observationTable tr:nth-child(even),
html[data-theme="dark"] .comparison-table tr:nth-child(even),
html.dark #observationTable tr:nth-child(even),
html.dark .comparison-table tr:nth-child(even) {
    background: #141e33 !important;
}

html[data-theme="dark"] #observationTable tr:hover,
html[data-theme="dark"] .comparison-table tr:hover,
html.dark #observationTable tr:hover,
html.dark .comparison-table tr:hover {
    background: #1e293b !important;
}

html[data-theme="dark"] .empty-row td,
html.dark .empty-row td {
    color: #64748b !important;
}

/* Theory & Application Cards in dark mode */
html[data-theme="dark"] .principle-card,
html.dark .principle-card {
    background: #141e33 !important;
    border-color: #1e293b !important;
}

html[data-theme="dark"] .principle-card h4,
html.dark .principle-card h4 {
    color: #38bdf8 !important;
}

html[data-theme="dark"] .principle-card p,
html[data-theme="dark"] .principle-card ul,
html[data-theme="dark"] .principle-card ol,
html.dark .principle-card p,
html.dark .principle-card ul,
html.dark .principle-card ol {
    color: #94a3b8 !important;
}

html[data-theme="dark"] .principle-card.featured,
html.dark .principle-card.featured {
    background: rgba(230, 126, 34, 0.1) !important;
    border-color: #e67e22 !important;
}

html[data-theme="dark"] .case,
html.dark .case {
    background: #0f172a !important;
    border-color: #1e293b !important;
}

html[data-theme="dark"] .app-card,
html.dark .app-card {
    background: #141e33 !important;
    border-color: #1e293b !important;
}

html[data-theme="dark"] .app-card h4,
html.dark .app-card h4 {
    color: #38bdf8 !important;
}

html[data-theme="dark"] .app-card p,
html.dark .app-card p {
    color: #94a3b8 !important;
}

html[data-theme="dark"] #lab-footer,
html.dark #lab-footer {
    background: #060911 !important;
    color: #64748b !important;
    border-top: 1px solid #1e293b !important;
}
