/*
    3D MATH LAB STYLES
    Theme: Modern Education
*/

:root {
    --bg-dark: #1a1a2e;
    --panel-bg: #16213e;
    --accent: #0f3460;
    --highlight: #e94560;
    --text: #ffffff;
    --text-muted: #b0b0b0;
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text);
    font-family: var(--font-main);
    height: 100vh;
    overflow: hidden; /* Prevent scrolling, app-like feel */
    display: flex;
    flex-direction: column;
}

/* HEADER */
.main-header {
    height: 60px;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    border-bottom: 1px solid var(--accent);
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--highlight);
    text-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 8px 20px;
    margin-left: 10px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-btn:hover, .nav-btn.active {
    background: var(--highlight);
    border-color: var(--highlight);
    color: white;
    box-shadow: 0 0 15px rgba(233, 69, 96, 0.4);
}

/* MAIN LAYOUT */
.container {
    display: flex;
    height: calc(100vh - 60px);
}

/* CONTROLS (Left) */
.controls-panel {
    width: 350px;
    background: var(--panel-bg);
    padding: 30px;
    overflow-y: auto;
    border-right: 1px solid var(--accent);
    box-shadow: 5px 0 15px rgba(0,0,0,0.3);
    z-index: 10;
}

h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--highlight);
}

.description {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 25px;
}

/* FORMULA BOX */
.math-info {
    background: rgba(255,255,255,0.05);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 30px;
    border-left: 4px solid var(--highlight);
}

.formula-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
}

/* SLIDERS & INPUTS */
.input-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text);
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--accent);
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--highlight);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* COLOR PICKER */
.colors {
    display: flex;
    gap: 10px;
}

.c-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.2);
    transition: transform 0.2s;
}

.c-btn:hover {
    transform: scale(1.1);
    border-color: white;
}

/* STATS LIST */
.stats-box {
    margin-top: 30px;
    border-top: 1px solid var(--accent);
    padding-top: 20px;
}

.stats-box h3 {
    font-size: 1rem;
    margin-bottom: 10px;
}

.stats-box ul {
    list-style: none;
}

.stats-box li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* 3D VIEWPORT */
.viewport {
    flex: 1;
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    overflow: hidden;
}

canvas {
    display: block;
    outline: none;
}

.overlay-text {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0,0,0,0.5);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    pointer-events: none;
    user-select: none;
}

/* TOGGLES */
.checkbox-container {
    display: block;
    position: relative;
    padding-left: 30px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: #eee;
    border-radius: 4px;
}

.checkbox-container:hover input ~ .checkmark {
    background-color: #ccc;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--highlight);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

/* MOBILE RESPONSIVE STYLES (Added) */
@media screen and (max-width: 768px) {
    body {
        overflow-y: auto; /* Allow scrolling on mobile */
        height: auto;
    }

    .main-header {
        flex-direction: column;
        height: auto;
        padding: 15px;
        gap: 15px;
    }

    .logo {
        font-size: 1.2rem;
    }

    nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
    }

    .nav-btn {
        margin: 0;
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .container {
        flex-direction: column-reverse; /* 3D View on top, Controls on bottom */
        height: auto;
    }

    .viewport {
        width: 100%;
        height: 50vh; /* Give 3D area half the screen height */
        min-height: 300px;
    }

    .controls-panel {
        width: 100%;
        border-right: none;
        border-top: 2px solid var(--accent);
        padding: 20px;
        overflow-y: visible; /* Use body scroll */
    }

    h2 {
        font-size: 1.5rem;
    }

    .overlay-text {
        bottom: 10px;
        right: 10px;
        font-size: 0.7rem;
    }
}