/* ============================================================
   Science Lab — Wave Interference & Fourier Diffraction Styles
   ============================================================ */

/* --- Canvas Layout --- */
.canvas-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: stretch;
}

.canvas-group {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
}

.real-space-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-top: 10px;
}

.canvas-box-small {
    flex: 1;
    min-width: 120px;
    max-width: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.canvas-box-large {
    flex: 2.5;
    min-width: 220px;
    max-width: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.canvas-box-small canvas,
.canvas-box-large canvas,
.canvas-box-pattern canvas {
    width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.canvas-box-pattern {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: auto 0;
}

.canvas-box-pattern canvas { max-width: 256px; }

.canvas-title {
    margin-bottom: 12px;
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary-purple);
}

/* --- Data Dashboard (Diffraction) --- */
.data-dashboard {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    background: #fff;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    border-left: 5px solid var(--accent-teal);
    align-items: center;
}

.data-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.data-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.data-value {
    font-size: 1.3rem;
    font-family: monospace;
    font-weight: bold;
    color: var(--primary-purple);
    line-height: 1;
}

/* --- Diffraction: Manual Input Grid --- */
.manual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 8px;
}

.manual-grid input,
.manual-grid select { margin-bottom: 0; padding: 6px; font-size: 0.9rem; }

/* --- Interference: Legend --- */
.legend {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.leg-item { display: flex; align-items: center; gap: 5px; }

.color-box {
    width: 15px;
    height: 15px;
    border-radius: 3px;
}

/* --- Diffraction: extra helpers --- */
.field-label {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--text-muted);
    display: block;
    margin-bottom: 2px;
}

.btn-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.btn-row {
    display: flex;
    gap: 8px;
}

.divider {
    border: 0;
    border-top: 1px solid #eee;
    margin: 20px 0;
}

.section-heading {
    margin: 0 0 15px;
    font-size: 1.1rem;
    color: var(--primary-purple);
}

.dash-divider {
    width: 1px;
    height: 30px;
    background: #ddd;
}

.status-msg {
    color: var(--accent-magenta);
    font-weight: bold;
    text-align: right;
    font-size: 0.9rem;
}

.canvas-sublabel {
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.plus-sign {
    font-size: 1.8rem;
    font-weight: bold;
    color: #ccc;
    padding-bottom: 20px;
}

/* --- Interference: obs-guide (also used by web.css pattern) --- */
.obs-guide {
    background: #f0f7ff;
    padding: 15px;
    border-left: 4px solid var(--accent-teal);
    font-size: 0.85rem;
    border-radius: 4px;
}

.obs-guide ul {
    padding-left: 20px;
    margin-top: 5px;
    line-height: 1.6;
}

.wave-canvas {
    max-width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fafafa;
}

/* ── Fourier Camera ─────────────────────────────────────────── */
.fc-status {
    margin-top: 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    min-height: 1.4em;
}

.fc-spectrum-wrap {
    position: relative;
    width: 100%;
}

.fc-freq-label {
    position: absolute;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.7);
    text-align: center;
    pointer-events: none;
    line-height: 1.3;
    background: rgba(0,0,0,0.45);
    padding: 2px 5px;
    border-radius: 4px;
}

.fc-freq-centre {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.fc-freq-corner {
    bottom: 6px;
    right: 6px;
}


/* ── Wave Interference: theme-aware canvas + equal-height panels ── */
.wave-canvas {
    max-width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fafafa;
    transition: background 0.3s;
}

html[data-theme="dark"] .wave-canvas {
    background: #1a1535 !important;
    border-color: #3d2d5a;
}

/* ── Diffraction: right panel background follows theme ─────── */
.diffraction-visual-panel {
    transition: background 0.3s;
}

html[data-theme="dark"] .diffraction-visual-panel {
    background: #16102b !important;
}

html[data-theme="dark"] .diffraction-visual-panel .canvas-group {
    background: #1e1630;
}

/* ── Fourier Camera: spectrum fills viewport height ────────── */
.fc-spectrum-panel {
    display: flex;
    flex-direction: column;
}

.fc-canvas-wrap {
    /* Sizing is CSS-only via aspect-ratio in fourier-camera.html inline style.
       flex: none prevents the flex column from stretching this to panel height. */
    flex: none;
    position: relative;
    background: #111;
    border-radius: 6px;
    overflow: hidden;
}

#canvas {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 6px;
}

/* Controls panel below preview */
.fc-buttons-panel h3 {
    font-size: 0.95rem;
    margin: 0 0 10px;
}

/* Download button style */
#downloadBtn {
    width: 100%;
    font-size: 0.82rem;
    min-height: 40px;
}

/* Fourier Camera fc-main height */
.fc-main {
    min-height: calc(100vh - 100px);
    box-sizing: border-box;
}

.fc-spectrum-panel {
    min-height: 300px;
}
