/* ============================================================
   GLOBAL STYLES & RESET
   ============================================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #0b0f19;
    color: #f1f5f9;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ============================================================
   HEADER
   ============================================================ */
header {
    background-color: #111827;
    padding: 12px 24px;
    border-bottom: 1px solid #1f2937;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #38bdf8;
    letter-spacing: 0.5px;
}

header p {
    font-size: 0.8rem;
    color: #9ca3af;
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
main {
    display: flex;
    flex: 1;
    height: calc(100vh - 60px);
    overflow: hidden;
}

/* ============================================================
   CONTROLS PANEL (SIDEBAR)
   ============================================================ */
.controls {
    width: 320px;
    min-width: 320px;
    background-color: #111827;
    border-right: 1px solid #1f2937;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Scrollbar styling for sidebar */
.controls::-webkit-scrollbar {
    width: 6px;
}

.controls::-webkit-scrollbar-track {
    background: #0b0f19;
}

.controls::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 3px;
}

.controls h2 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #9ca3af;
    margin-top: 4px;
}

hr {
    border: none;
    border-top: 1px solid #1f2937;
    margin: 4px 0;
}

/* ============================================================
   FORM CONTROLS & INPUTS
   ============================================================ */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

label {
    font-size: 0.8rem;
    color: #d1d5db;
    font-weight: 500;
}

/* Text Inputs, Selects, and Number Inputs */
input[type="text"],
select,
.number-input {
    background-color: #1f2937;
    border: 1px solid #374151;
    color: #38bdf8;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    width: 100%;
    transition: border-color 0.15s ease;
}

input[type="text"]:focus,
select:focus,
.number-input:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 1px #38bdf8;
}

.number-input {
    width: 75px;
    text-align: right;
    padding: 2px 6px;
}

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

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #38bdf8;
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #7dd3fc;
}

/* ============================================================
   BUTTONS
   ============================================================ */
button {
    background-color: #1e293b;
    border: 1px solid #334155;
    color: #f8fafc;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

button:hover {
    background-color: #334155;
    border-color: #475569;
}

button:active {
    transform: translateY(1px);
}

.button-group {
    display: flex;
    gap: 8px;
}

.button-group button {
    flex: 1;
}

/* Play/Pause specific accents */
#playButton {
    background-color: #065f46;
    border-color: #047857;
}

#playButton:hover {
    background-color: #047857;
}

#pauseButton {
    background-color: #854d0e;
    border-color: #a16207;
}

#pauseButton:hover {
    background-color: #a16207;
}

/* ============================================================
   INFORMATION BOX
   ============================================================ */
.info {
    background-color: #0b0f19;
    border: 1px solid #1f2937;
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info p {
    font-size: 0.8rem;
    color: #9ca3af;
    display: flex;
    justify-content: space-between;
}

.info span {
    color: #f3f4f6;
    font-weight: 600;
}

/* ============================================================
   VISUALIZER CONTAINER (RIGHT SECTION)
   ============================================================ */
.visualizer-container {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: #050811;
}

/* 3D Canvas Viewport */
#canvas3DContainer {
    flex: 1;
    width: 100%;
    height: 100%;
    position: relative;
}

#canvas3DContainer canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* 2D Map Viewport Overlay */
#canvas2DContainer {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 360px;
    height: 180px;
    background-color: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.map-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9ca3af;
    padding: 6px 10px;
    background-color: rgba(11, 15, 25, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#map2DCanvas {
    width: 100%;
    height: calc(100% - 25px);
    display: block;
}

/* Overlay Time Counter */
.time-display {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.8rem;
    color: #9ca3af;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.time-display span {
    color: #38bdf8;
    font-family: monospace;
    font-weight: 700;
    font-size: 0.9rem;
}

/* ============================================================
   RESPONSIVE DESIGN ADJUSTMENTS
   ============================================================ */
@media (max-width: 900px) {
    main {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .controls {
        width: 100%;
        min-width: 100%;
        border-right: none;
        border-bottom: 1px solid #1f2937;
    }

    .visualizer-container {
        height: 600px;
    }

    #canvas2DContainer {
        width: 280px;
        height: 140px;
        bottom: 10px;
        right: 10px;
    }
}