/* === Slackline Balance Simulator — Styles === */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #111133;
    --bg-panel: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.08);
    --text: #e0e0e0;
    --text-dim: rgba(255, 255, 255, 0.45);
    --accent-blue: #3a86ff;
    --accent-pink: #ff006e;
    --accent-purple: #8338ec;
    --accent-yellow: #ffbe0b;
    --accent-green: #4ade80;
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* === Header === */
.header {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header .subtitle {
    font-size: 12px;
    color: var(--text-dim);
    font-weight: 300;
}

/* === Main Layout === */
.main-container {
    display: flex;
    height: calc(100vh - 52px);
    gap: 0;
}

/* === Canvas Area === */
.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sim-container {
    flex: 3;
    position: relative;
    border-bottom: 1px solid var(--border);
}

.sim-container canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.graph-container {
    flex: 1.2;
    position: relative;
    min-height: 150px;
}

.graph-container canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* === Control Panel === */
.control-panel {
    width: 280px;
    min-width: 280px;
    background: linear-gradient(180deg, rgba(17, 17, 51, 0.95), rgba(10, 10, 26, 0.98));
    border-left: 1px solid var(--border);
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-section {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    backdrop-filter: blur(10px);
}

.panel-section h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.panel-section h3::before {
    content: '';
    width: 3px;
    height: 12px;
    border-radius: 2px;
    background: var(--accent-blue);
}

/* === Slider Groups === */
.slider-group {
    margin-bottom: 10px;
}

.slider-group:last-child {
    margin-bottom: 0;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 12px;
}

.slider-label span:first-child {
    color: var(--text);
    font-weight: 400;
}

.slider-label .slider-val {
    color: var(--accent-blue);
    font-weight: 600;
    font-family: 'Inter', monospace;
    min-width: 45px;
    text-align: right;
}

/* === Range Slider Styling === */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-blue);
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(58, 134, 255, 0.5);
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-blue);
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
}

/* Controller slider accent */
.controller-section input[type="range"]::-webkit-slider-thumb {
    background: var(--accent-purple);
}

.controller-section input[type="range"]::-moz-range-thumb {
    background: var(--accent-purple);
}

/* === Buttons === */
.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    flex: 1;
    min-width: 80px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-color: transparent;
}

.btn-primary:hover {
    filter: brightness(1.15);
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
}

.btn-primary.active {
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
}

.btn-danger {
    border-color: rgba(255, 0, 110, 0.3);
    color: var(--accent-pink);
}

.btn-danger:hover {
    background: rgba(255, 0, 110, 0.15);
}

.btn-controller {
    width: 100%;
    padding: 10px;
    font-size: 13px;
}

.btn-controller.active {
    background: rgba(74, 222, 128, 0.15);
    border-color: rgba(74, 222, 128, 0.3);
    color: var(--accent-green);
}

/* === Perturbation Buttons === */
.perturb-group {
    display: flex;
    gap: 8px;
}

.perturb-group .btn {
    font-size: 18px;
    padding: 8px;
}

/* === Legend === */
.legend {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    margin-top: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dim);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* === Scrollbar === */
.control-panel::-webkit-scrollbar {
    width: 4px;
}

.control-panel::-webkit-scrollbar-track {
    background: transparent;
}

.control-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* === Responsive === */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }

    .control-panel {
        width: 100%;
        min-width: unset;
        border-left: none;
        border-top: 1px solid var(--border);
        max-height: 350px;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .panel-section {
        flex: 1;
        min-width: 200px;
    }
}
