/* ============================================================
   Gauss's Law Explorer — Page Styles
   ============================================================ */

/* Workspace fills viewport */
.workspace {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: transparent;
}

/* ─── Top Bar ─────────────────────────────────────────────── */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    height: 48px;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.2rem;
    background: rgba(11, 13, 20, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.hub-btn {
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.hub-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.page-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #e0e7ff;
    letter-spacing: -0.3px;
}

/* ─── Canvas Wrap ─────────────────────────────────────────── */
.canvas-wrap {
    position: absolute;
    top: 48px;
    left: 0;
    width: 100%;
    height: calc(100% - 48px);
    z-index: 1;
}

canvas#gaussCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ─── Side Panel (controls) ───────────────────────────────── */
.side-panel {
    position: absolute;
    top: 68px;
    bottom: 20px;
    right: 20px;
    width: 300px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    z-index: 10;
}

.panel-heading {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent, #37e0a1);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.2rem;
    border-bottom: 1px solid rgba(55, 224, 161, 0.15);
    padding-bottom: 0.4rem;
}

.ctrl-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ctrl-group label {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.slider-container input[type="range"] {
    flex: 1;
}

.slider-value {
    min-width: 65px;
    text-align: right;
    font-size: 0.82rem;
    font-weight: 600;
    color: #a8f4d2;
    font-variant-numeric: tabular-nums;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.1rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
}

.toggle-row span:first-child {
    flex: 1;
}

.toggle-row input[type="checkbox"] {
    display: none;
}

.reset-btn {
    margin-top: auto;
    padding: 0.65rem;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.reset-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
}

/* ─── HUD Panel (bottom-left) ─────────────────────────────── */
.hud-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 300px;
    padding: 1.2rem;
    z-index: 20;
}

.hud-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
}

.hud-label {
    color: rgba(255, 255, 255, 0.55);
}

.hud-val {
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.78rem;
    color: #a5b4fc;
}

.accent-val {
    color: var(--research-cyan) !important;
    font-weight: 700;
    font-size: 0.88rem;
}

.hud-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 0.5rem 0;
}

/* ─── Dynamic Rule Panel (bottom center) ──────────────────── */
.formula-badge {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    width: 340px;
    padding: 1rem 1.2rem !important;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-family: 'Inter', sans-serif;
    border-radius: 8px;
    box-shadow: var(--shadow-deep);
}

.formula-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--accent, #37e0a1);
}

.formula-content {
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0.15rem 0;
}

.formula-details {
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.45);
    white-space: pre-wrap;
    line-height: 1.4;
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 1100px) {
    .side-panel {
        width: 280px;
    }

    .hud-panel {
        width: 280px;
        left: 16px;
        bottom: 16px;
    }

    .formula-badge {
        width: 300px;
        bottom: 16px;
        left: 50%;
        transform: translateX(-50%);
    }
}

@media (max-width: 962px) {
    .formula-badge {
        position: absolute;
        top: 68px;
        left: 16px;
        bottom: auto;
        transform: none;
        width: 280px;
    }

    .side-panel {
        width: 260px;
    }

    .hud-panel {
        width: 260px;
        left: 16px;
        bottom: 16px;
    }
}

@media (max-width: 768px) {
    .workspace {
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        min-height: 100vh;
    }

    .side-panel {
        position: relative;
        top: 0;
        bottom: 0;
        right: 0;
        width: 100%;
        height: auto;
        max-height: none;
        margin-top: 10px;
        padding: 1rem;
        border-radius: 0 !important;
        border-left: none;
        border-right: none;
        border-bottom: none;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }

    .canvas-wrap {
        position: relative;
        top: 0;
        width: 100%;
        height: auto;
        min-height: 300px;
        flex: 1;
    }

    .hud-panel {
        position: relative;
        bottom: 0;
        left: 0;
        width: 100%;
        margin-top: 10px;
        padding: 1rem;
        border-radius: 0 !important;
        border-left: none;
        border-right: none;
        border-bottom: none;
    }

    .formula-badge {
        position: relative;
        top: 0;
        left: 0;
        bottom: 0;
        transform: none;
        width: 100%;
        margin-top: 10px;
        padding: 0.85rem 1rem;
        border-radius: 0 !important;
        border-left: none;
        border-right: none;
        border-bottom: none;
    }

    .toggle-row {
        padding: 0.5rem 0;
    }

    .toggle-row span:first-child {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .side-panel {
        padding: 0.75rem;
    }

    .canvas-wrap {
        min-height: 260px;
    }

    .hud-panel,
    .formula-badge {
        padding: 0.75rem;
    }

    .ctrl-group label {
        font-size: 0.75rem;
    }

    .slider-value {
        font-size: 0.78rem;
        min-width: 60px;
    }

    .panel-heading {
        font-size: 0.75rem;
    }

    .hud-row {
        font-size: 0.75rem;
    }

    .hud-val {
        font-size: 0.72rem;
    }

    .formula-title {
        font-size: 0.65rem;
    }

    .formula-content {
        font-size: 0.85rem;
    }

    .formula-details {
        font-size: 0.65rem;
    }
}
