/* =========================
   LAYOUT
   ========================= */
body {
    margin: 0;
    overflow: hidden;
    font-family: Arial, sans-serif;
    background: #202020;
}

#canvas-container {
    width: 100vw;
    height: 100vh;
}

/* =========================
   UI - HEADER
   ========================= */
#info {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 15px;
    border-radius: 5px;
    color: white;
    font-family: Arial, sans-serif;
    font-size: 14px;
    pointer-events: none;
}

#keybindings-btn {
    position: absolute;
    top: 10px;
    right: 110px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-family: Arial, sans-serif;
    font-size: 14px;
    pointer-events: all;
}

#keybindings-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

#keybindings-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 30px;
    border-radius: 10px;
    color: white;
    font-family: Arial, sans-serif;
    display: none;
    pointer-events: all;
    min-width: 320px;
    z-index: 1000;
}

#keybindings-panel h2 {
    margin-top: 0;
    color: #87CEEB;
}

#keybind-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

#keybind-table td {
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.keybind-key {
    font-size: 18px;
    text-align: center;
    width: 50px;
    color: #FFD700;
}

.rebind-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.rebind-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.rebind-btn.listening {
    background: rgba(255, 100, 0, 0.4);
    border-color: orange;
    color: orange;
    animation: pulse 0.8s infinite alternate;
}

@keyframes pulse {
    from { opacity: 1; }
    to   { opacity: 0.5; }
}

#close-keybindings {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

#close-keybindings:hover {
    background: rgba(255, 255, 255, 0.3);
}

#settings-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-family: Arial, sans-serif;
    font-size: 14px;
    pointer-events: all;
}

#settings-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* =========================
   UI - SETTINGS PANEL
   ========================= */
#settings-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 30px;
    border-radius: 10px;
    color: white;
    font-family: Arial, sans-serif;
    display: none;
    pointer-events: all;
    width: 420px;
    z-index: 1000;
}

/* =========================
   UI - SETTINGS TABS
   ========================= */
.settings-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 0;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 8px 18px;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    font-size: 13px;
    font-family: Arial, sans-serif;
    transition: background 0.15s, color 0.15s;
}

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

.tab-btn.active {
    background: rgba(135, 206, 235, 0.2);
    border-color: rgba(135, 206, 235, 0.5);
    color: #87CEEB;
}

.tab-content {
    min-height: 120px;
}

.tab-content.hidden {
    display: none;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}

.setting-row label {
    width: 140px;
    font-size: 13px;
    flex-shrink: 0;
}

.setting-row input[type="range"] {
    flex: 1;
}

.setting-row span {
    width: 40px;
    text-align: right;
    font-size: 13px;
    color: #FFD700;
}

#settings-panel h2 {
    margin-top: 0;
    color: #87CEEB;
}

#settings-panel p {
    line-height: 1.6;
    margin: 10px 0;
}

#close-settings {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

#close-settings:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* =========================
   UI - EFFECTS
   ========================= */
#fade {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: black;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s;
}

/* =========================
   UI - DAY/NIGHT CONTROLS
   ========================= */
#day-night-slider {
    margin: 20px 0;
}

#day-night-slider label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
}

#speed-slider {
    width: 100%;
}

#speed-value {
    display: inline-block;
    margin-left: 10px;
    font-weight: bold;
}

/* =========================
   UI - TOOLBAR
   ========================= */
#toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: rgba(0, 0, 0, 0.78);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 6px;
    z-index: 500;
    pointer-events: all;
}

.toolbar-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 6px;
    padding: 5px 14px;
    cursor: pointer;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 52px;
    transition: background 0.15s, border-color 0.15s;
}

.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.toolbar-btn.active {
    background: rgba(135, 206, 235, 0.22);
    border-color: rgba(135, 206, 235, 0.55);
}

.toolbar-icon { font-size: 18px; line-height: 1; }
.toolbar-label { font-size: 10px; color: rgba(255, 255, 255, 0.65); }

#toolbar-ticker {
    margin-left: 14px;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1px;
    pointer-events: none;
}

.ticker-line {
    font-family: monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.ticker-line:first-child {
    color: rgba(255, 255, 255, 0.7);
}

/* =========================
   UI - CATALOG PANEL
   ========================= */
#catalog-panel {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: calc(100vh - 52px);
    background: rgba(12, 18, 12, 0.96);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 600;
    transition: right 0.2s ease;
    pointer-events: all;
}

#catalog-panel.open { right: 0; }

.catalog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.catalog-title {
    color: #87CEEB;
    font-size: 15px;
    font-weight: bold;
    font-family: Arial, sans-serif;
}

.catalog-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.45);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s;
}

.catalog-close:hover { color: white; }

.catalog-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.catalog-tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: rgba(255, 255, 255, 0.45);
    padding: 10px 6px;
    cursor: pointer;
    font-size: 12px;
    font-family: Arial, sans-serif;
    transition: color 0.15s;
}

.catalog-tab:hover { color: white; }
.catalog-tab.active { color: #87CEEB; border-bottom-color: #87CEEB; }

.catalog-grid {
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-content: flex-start;
}

.catalog-card {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.82);
    border-radius: 5px;
    padding: 7px 10px;
    font-size: 11px;
    font-family: Arial, sans-serif;
    cursor: pointer;
    text-align: left;
    width: calc(50% - 3px);
    box-sizing: border-box;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.catalog-card:hover {
    background: rgba(135, 206, 235, 0.15);
    border-color: rgba(135, 206, 235, 0.4);
    color: white;
}

/* =========================
   UI - AXIS HELPER TOGGLE
   ========================= */
#axis-helper-toggle {
    margin: 20px 0;
}

#axis-helper-toggle label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

#axis-helper-toggle input {
    margin-right: 10px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}
