/* ── PhET Scaling Base ───────────────────────────────────── */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* PhET Stage — scalable container */
#phet-stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 1280px;
    height: 720px;
    background-color: #f8fafc;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: 0 0;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.05);
}

nav {
    position: relative !important;
    background: #ffffff !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: #0f172a !important;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    flex-shrink: 0;
    top: 0 !important;
    z-index: 1000;
}

/* ScienceSim Physics Lab Design System */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #10b981;
    --bg-main: #f8fafc;
    --bg-panel: rgba(255, 255, 255, 0.9);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --field-color: #0ea5e9; /* Sky Blue for Magnetic Field (B) */
    --current-color: #ef4444; /* Red for Conventional Current (I) */
    --electron-color: #fbbf24; /* Yellow for Electrons (v) */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    touch-action: none;
    overscroll-behavior: none;
}

/* --- Navigation links from index.css --- */
.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: #64748b;
    font-weight: 600;
}

#sim-app {
    flex: 1;
    display: flex;
    width: 100%;
    min-height: 0; /* Important for flex flow */
}

.sim-container {
    flex: 1;
    display: flex;
    flex-direction: row;
}

.canvas-panel {
    flex: 1;
    position: relative;
    background: #ffffff;
    overflow: hidden;
    height: 100%;
}

/* Floating Physics Dashboard - Optimized & Top Positioned */
.physics-dashboard {
    position: absolute;
    top: 100px; /* Offset from header */
    right: 25px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.8));
    backdrop-filter: blur(12px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    outline: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 14px;
    width: 200px;
    box-shadow: 
        0 15px 35px -5px rgba(0, 0, 0, 0.1),
        0 5px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.physics-dashboard:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
}

.dash-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dash-item label {
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    opacity: 0.8;
}

.dash-val {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    text-align: right;
    margin-top: -16px;
    pointer-events: none;
    font-family: 'JetBrains Mono', monospace, sans-serif;
}

.dash-item-force {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
}

.red-alert {
    color: #ef4444;
    font-size: 1.05rem;
    letter-spacing: -0.5px;
}

/* Custom Minimalist Sliders */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    outline: none;
    margin: 10px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--primary);
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.dash-reset {
    width: 100%;
    margin-top: 2px;
    padding: 7px;
    background: #475569; /* Muted slate for reset */
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.dash-reset:hover {
    background: #f43f5e; /* Red only on hover */
    transform: scale(1.02);
}

#simCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Sidebar removed - replaced by physics-dashboard */

/* Visual Legend */
.visual-legend {
    position: absolute;
    bottom: 30px; /* Moved down from top to avoid header overlap */
    left: 25px;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dot { width: 10px; height: 100%; aspect-ratio: 1; border-radius: 50%; }
.dot.yellow { background: var(--electron-color); box-shadow: 0 0 5px var(--electron-color); }
.line { width: 20px; height: 3px; }
.line.blue { background: var(--field-color); }
.line.red { background: var(--current-color); }
.arrow { color: var(--current-color); font-weight: bold; }

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    width: 400px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.btn-close {
    margin-top: 20px;
    width: 100%;
    padding: 10px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
