/* ============================================================
   Experiment 8 Simulator — Stylesheet
   ============================================================ */

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

:root {
    --primary: #1a237e;
    --primary-light: #3949ab;
    --accent: #1a73e8;
    --bg: #f0f2f5;
    --surface: #ffffff;
    --border: #dadce0;
    --text: #202124;
    --text-sec: #5f6368;
    --success: #34a853;
    --warning: #ea8600;
    --danger: #d93025;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
}

html { font-size: 14px; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ---- Header ---- */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 18px 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.header h1 { font-size: 1.4rem; font-weight: 600; letter-spacing: -0.3px; }
.header p { font-size: 0.85rem; opacity: 0.85; margin-top: 3px; }

/* ---- Simulator Layout ---- */
.simulator {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 0;
    max-width: 1600px;
    margin: 0 auto;
    min-height: calc(100vh - 80px);
}

/* ---- Controls Panel ---- */
.controls {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 16px;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
    position: sticky;
    top: 0;
}

.control-group {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.control-group:last-of-type { border-bottom: none; }
.control-group h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    margin-bottom: 10px;
    font-weight: 700;
}

.controls label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-sec);
    margin-bottom: 10px;
}
.controls label span {
    float: right;
    font-weight: 600;
    color: var(--accent);
    font-family: 'Consolas', 'Courier New', monospace;
}

.controls input[type="range"] {
    width: 100%;
    margin-top: 4px;
    accent-color: var(--accent);
}
.controls select {
    width: 100%;
    margin-top: 4px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.82rem;
    background: var(--surface);
}

.run-btn {
    width: 100%;
    padding: 10px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 14px;
}
.run-btn:hover { background: #1557b0; }
.run-btn:disabled { background: #9aa0a6; cursor: wait; }

/* ---- Info Panel ---- */
.info-panel {
    background: #f8f9fa;
    border-radius: var(--radius);
    padding: 10px;
    border: 1px solid var(--border);
}
.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 0.78rem;
    border-bottom: 1px solid #eee;
}
.info-item:last-child { border-bottom: none; }
.info-label { color: var(--text-sec); }
.info-value {
    font-family: 'Consolas', 'Courier New', monospace;
    font-weight: 600;
    color: var(--primary);
}

/* ---- Main Content ---- */
.main-content {
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

/* ---- Tab Bar ---- */
.tab-bar {
    display: flex;
    gap: 4px;
    background: var(--surface);
    padding: 4px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 14px;
    flex-shrink: 0;
}
.tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-sec);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.tab:hover { background: #e8f0fe; color: var(--accent); }
.tab.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 1px 3px rgba(26,115,232,0.3);
}

/* ---- Tab Content ---- */
.tab-content { display: none; flex: 1; min-height: 0; }
.tab-content.active { display: flex; flex-direction: column; }
.observations-tab.active { display: block; }

/* ---- Plot Grids ---- */
.plot-grid {
    display: grid;
    gap: 12px;
    flex: 1;
    min-height: 0;
}
.plot-grid.two-col {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}
.plot-grid.eye-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 2fr 1fr;
}

.plot-wrapper {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 4px;
    display: flex;
    align-items: stretch;
    min-height: 200px;
}
.plot-wrapper canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ---- Observations ---- */
.observations {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 18px;
    margin-top: 14px;
    flex-shrink: 0;
    max-height: 300px;
    overflow-y: auto;
}
.observations-tab .observations {
    height: 100%;
    max-height: none;
    margin-top: 0;
}
.observations h3 {
    font-size: 0.9rem;
    color: var(--primary);
    margin-bottom: 8px;
    position: sticky;
    top: 0;
    background: var(--surface);
    padding-bottom: 4px;
}
.observations h4 {
    font-size: 0.85rem;
    color: var(--primary-light);
    margin: 10px 0 6px 0;
}
.observations p {
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-sec);
    margin-bottom: 6px;
}
.observations ul {
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--text-sec);
    margin-left: 18px;
    margin-bottom: 6px;
}
.observations hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 10px 0;
}
.observations b { color: var(--text); }
.obs-hint {
    color: var(--text-sec);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.obs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    margin: 8px 0;
}
.obs-table th, .obs-table td {
    padding: 6px 10px;
    border: 1px solid var(--border);
    text-align: left;
}
.obs-table th {
    background: #f8f9fa;
    color: var(--primary);
    font-weight: 600;
}

/* ---- Footer ---- */
footer {
    text-align: center;
    padding: 12px;
    font-size: 0.75rem;
    color: var(--text-sec);
    border-top: 1px solid var(--border);
}

/* ---- Loading overlay ---- */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: 600;
    border-radius: var(--radius);
    z-index: 10;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .simulator { grid-template-columns: 1fr; }
    .controls {
        position: static;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .main-content { max-height: none; }
    .plot-grid.two-col { grid-template-columns: 1fr; }
}
