/* ── PhET Scaling Base ───────────────────────────────────── */
:root {
    --primary: #ec4899;
    --primary-light: #fdf2f8;
    --primary-dark: #be185d;
    --bg-main: #f8fafc;
    --border: rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #eef2f6;
    font-family: 'Outfit', sans-serif;
    touch-action: none; /* Disable browser defaults for panning */
}

#phet-stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 1280px;
    height: 720px;
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: 0 0; /* Updated for custom pan/zoom math */
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.1);
    touch-action: none;
}

/* NAV — Overriding fixed position from index.css to keep it in flex flow */
nav {
    position: relative !important;
    background: #ffffff !important;
    border-bottom: 1px solid var(--border) !important;
    color: #0f172a !important;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    flex-shrink: 0;
    top: 0 !important;
}

.nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

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

.nav-links a:hover {
    color: var(--primary);
}

.sim-tabs {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.nav-tab {
    cursor: pointer;
    padding: 8px 24px;
    border-radius: 30px;
    font-weight: 600;
    color: #64748b;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.nav-tab:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--primary);
}

.nav-tab.active {
    background: var(--primary) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
}

/* CORE LAYOUT */
.sim-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.canvas-panel {
    flex: 1;
    position: relative;
    background:
        linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    background-color: #f8fafc;
    overflow: hidden;
}

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

/* CONTROL SIDEBAR — Restored to Original UI */
.control-panel {
    width: 280px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.8rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10;
    box-shadow: -8px 0 25px rgba(0, 0, 0, 0.04);
}

/* Custom Scrollbar for sidebar */
.control-panel::-webkit-scrollbar {
    width: 6px;
}

.control-panel::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.control-panel::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* UI COMPONENTS — Restored to Original Design */
.phet-box {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    padding: 0.9rem;
    margin-bottom: 5px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.phet-box:hover {
    box-shadow: 0 6px 15px -3px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.section-header {
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
    color: #475569;
    /* Visible dark text by default */
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
    padding: 0.5rem 0.2rem;
    text-align: center;
}

.control-group {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.control-group:last-child {
    border-bottom: none;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: #475569;
}

.val-display {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
}

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

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    border: 3px solid #64748b;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.slider-blue::-webkit-slider-thumb {
    border-color: #3b82f6 !important;
}

.slider-green::-webkit-slider-thumb {
    border-color: #10b981 !important;
}

/* Checkboxes */
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
}

.checkbox-group label:hover {
    background: #f8fafc;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}