/* ── LusoVector — Frontend Styles ── */

:root {
    --bg: #0a0a1a;
    --bg-panel: #111122;
    --text: #ddd;
    --text-muted: #888;
    --border: #333;
    --accent-l: #4a9eff;   /* Left lane — blue */
    --accent-r: #ff5555;   /* Right lane — red */
    --green: #4ecb71;
    --yellow: #f0c040;
    --red: #e04545;
    --btn-bg: #1a1a2e;
    --btn-hover: #2a2a4e;
    --btn-active-l: #1a3a6e;
    --btn-active-r: #5e1a1a;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overscroll-behavior-y: contain;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
}

body {
    display: flex;
    flex-direction: column;
}

/* ── Status Bar ── */

#status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.75rem;
    background: #0d0d20;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.app-title {
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

#connection-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
}

#status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--yellow);
    transition: background 0.3s;
}

#status-dot.connected { background: var(--green); }
#status-dot.disconnected { background: var(--red); }
#status-dot.reconnecting {
    background: var(--yellow);
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ── View Toggle ── */

#view-toggle {
    display: flex;
    gap: 2px;
}

.view-btn {
    background: var(--btn-bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.view-btn:hover { background: var(--btn-hover); }
.view-btn.active { background: var(--accent-l); color: #fff; border-color: var(--accent-l); }

/* Panel visibility controlled by body data-view attribute */
body[data-view="2d"] #panel-3d,
body[data-view="3d"] #panel-2d { display: none; }

/* ── Panels ── */

#panels {
    flex: 1;
    display: flex;
    flex-direction: row;
    gap: 2px;
    min-height: 0;
    overflow: hidden;
}

.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    margin: 4px;
    overflow: hidden;
    position: relative;
}

.panel-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.3rem 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    pointer-events: none;
}

/* ── Trajectory Config ── */

#traj-config {
    background: #0d0d20;
    border-top: 1px solid var(--border);
    padding: 0.3rem 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

#traj-config.collapsed #traj-fields { display: none; }

.btn-toggle {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
}


#traj-fields {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.traj-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.traj-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    width: 32px;
}

.traj-row label {
    font-size: 0.6rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 2px;
}

.traj-row input[type="range"] {
    width: 80px;
    height: 4px;
    accent-color: var(--accent-l);
    cursor: pointer;
}

.traj-row .val {
    font-size: 0.65rem;
    color: var(--text);
    min-width: 28px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

#canvas2d {
    flex: 1;
    width: 100%;
    display: block;
}

#container3d {
    flex: 1;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* ── Controls ── */

#controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    background: #0d0d20;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.btn-group {
    display: flex;
    gap: 0.4rem;
}

.btn {
    min-width: 80px;
    min-height: 44px;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--btn-bg);
    color: var(--text);
    touch-action: manipulation;
    user-select: none;
    transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
    background: var(--btn-hover);
}

.btn:active {
    transform: scale(0.97);
}

.btn-listen.active[data-lane="L"] {
    background: var(--btn-active-l);
    border-color: var(--accent-l);
    color: var(--accent-l);
}

.btn-listen.active[data-lane="R"] {
    background: var(--btn-active-r);
    border-color: var(--accent-r);
    color: var(--accent-r);
}

.btn-clean {
    border-style: dashed;
}

.btn-throw {
    background: #2a1a0a;
    border-color: #c08030;
    color: #f0c040;
}

.btn-throw:hover {
    background: #3a2a1a;
}

/* ── Responsive: Mobile (stacked) ── */

@media (max-width: 767px) {
    #panels {
        flex-direction: column;
    }

    .panel {
        flex: 1;
        min-height: 0;
    }

    #controls {
        gap: 0.5rem;
        padding: 0.4rem;
    }

    .btn {
        min-width: 64px;
        padding: 0.4rem 0.6rem;
        font-size: 0.78rem;
    }
}

/* ── Large screens: more breathing room ── */

@media (min-width: 1200px) {
    .panel {
        margin: 6px;
    }

    .btn {
        min-width: 100px;
        font-size: 0.9rem;
    }
}
