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

:root {
    --ui-font: 'Space Grotesk', sans-serif;
    --mono-font: 'JetBrains Mono', monospace;
    --text-primary: #e8f1ff;
    --text-muted: #9aa9c7;
    --text-soft: #7b89a8;
    --ui-accent: #22f2a6;
    --ui-accent-strong: #66ffe0;
    --ui-border: rgba(64, 200, 255, 0.35);
    --ui-bg: rgba(9, 14, 23, 0.88);
    --ui-bg-strong: rgba(8, 12, 20, 0.95);
    --shadow-soft: 0 16px 40px rgba(0,0,0,0.35);
    --shadow-strong: 0 20px 60px rgba(0,0,0,0.45);
    --shadow-glow: 0 0 18px rgba(34, 242, 166, 0.2);
}

body {
    font-family: var(--ui-font);
    overflow: hidden;
    color: var(--text-primary);
    background:
        radial-gradient(1200px 800px at 10% 10%, rgba(22, 52, 82, 0.35), transparent 60%),
        radial-gradient(900px 700px at 90% 20%, rgba(10, 70, 95, 0.3), transparent 55%),
        #04070b;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overscroll-behavior: none;
}

#globeViz {
    width: 100vw;
    height: 100vh;
    position: relative;
    z-index: 5;
    cursor: grab;
    touch-action: none;
}

#globeViz:active {
    cursor: grabbing;
}

/* ===== LOADING SCREEN ===== */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #05070d 0%, #0d1423 50%, #101c2b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.loading-content {
    text-align: center;
    color: white;
    max-width: 500px;
    padding: 40px;
}

.loading-title {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 20px;
    background: linear-gradient(45deg, var(--ui-accent), #3fd4ff, var(--ui-accent-strong));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(34, 242, 166, 0.45);
}

.loading-subtitle {
    font-size: 16px;
    margin-bottom: 30px;
    color: var(--ui-accent);
    font-weight: bold;
}

#loadingProgress {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--ui-accent);
    font-weight: bold;
}

.loading-bar {
    width: 400px;
    height: 8px;
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

#loadingBar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--ui-accent), #3fd4ff, var(--ui-accent-strong));
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(34, 242, 166, 0.4);
}

/* ===== CONTROLS PANEL ===== */
.controls-panel {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: opacity 0.3s ease;
    resize: both;
    overflow: auto;
    min-width: 190px;
    max-width: 320px;
    min-height: 120px;
    max-height: calc(100vh - 40px);
}

.control-btn {
    background: linear-gradient(160deg, rgba(18, 28, 45, 0.95), rgba(8, 12, 20, 0.95));
    color: var(--text-primary);
    border: 1px solid var(--ui-border);
    padding: 8px 14px;
    font-family: var(--ui-font);
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s ease;
    min-width: 140px;
    text-align: center;
    font-size: 12px;
}

.control-btn:hover {
    border-color: var(--ui-accent);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.4), var(--shadow-glow);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.control-input-group {
    background: var(--ui-bg);
    border: 1px solid var(--ui-border);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: var(--shadow-soft);
    min-width: 180px;
}

.control-label {
    font-size: 12px;
    font-weight: bold;
    color: var(--ui-accent);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.control-input {
    background: rgba(2, 5, 10, 0.55);
    border: 1px solid rgba(34, 242, 166, 0.5);
    color: var(--text-primary);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
    font-family: var(--ui-font);
    outline: none;
}

.control-input::placeholder {
    color: rgba(255,255,255,0.6);
}

.control-input:focus {
    border-color: var(--ui-accent);
    box-shadow: 0 0 0 2px rgba(34, 242, 166, 0.2);
}

.control-group {
    background: var(--ui-bg);
    border: 1px solid var(--ui-border);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-soft);
    min-width: 180px;
}

.control-group-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-soft);
    font-weight: 600;
}

.control-group-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.control-chip {
    flex: 1 1 calc(50% - 6px);
    background: linear-gradient(160deg, rgba(18, 28, 45, 0.95), rgba(8, 12, 20, 0.95));
    color: var(--text-primary);
    border: 1px solid var(--ui-border);
    padding: 5px 6px;
    border-radius: 6px;
    font-size: 9px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.control-chip:hover {
    border-color: var(--ui-accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.control-chip:active {
    transform: translateY(0);
}

.panel-grip {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-soft);
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(6, 10, 18, 0.65);
    border: 1px solid rgba(64, 200, 255, 0.25);
}

/* ===== PERFORMANCE MONITOR ===== */
.performance-monitor {
    position: fixed;
    top: 110px;
    right: 20px;
    z-index: 100;
    background: var(--ui-bg);
    color: var(--text-primary);
    padding: 15px;
    border-radius: 12px;
    font-family: var(--mono-font);
    font-size: 12px;
    border: 1px solid var(--ui-border);
    box-shadow: var(--shadow-soft);
    min-width: 170px;
    max-width: 260px;
    max-height: calc(100vh - 60px);
    backdrop-filter: blur(10px);
    transition: opacity 0.3s ease;
    resize: both;
    overflow: auto;
}

.monitor-header {
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--ui-accent);
    font-size: 14px;
    font-family: var(--ui-font);
    cursor: grab;
    user-select: none;
}

.performance-monitor div {
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

/* ===== CITY PANEL ===== */
.city-panel {
    position: fixed;
    right: 20px;
    bottom: 45px;
    top: auto;
    z-index: 100;
    background: var(--ui-bg);
    color: var(--text-primary);
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(34, 242, 166, 0.45);
    box-shadow: var(--shadow-soft);
    min-width: 220px;
    max-width: 260px;
    max-height: calc(100vh - 80px);
    backdrop-filter: blur(10px);
    font-family: var(--ui-font);
    transition: opacity 0.3s ease;
    resize: both;
    overflow: auto;
}

.panel-title {
    font-size: 13px;
    font-weight: bold;
    color: var(--ui-accent);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.panel-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 6px;
}

.panel-time {
    font-size: 15px;
    font-family: var(--mono-font);
    color: var(--ui-accent);
    margin-bottom: 4px;
}

.panel-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.panel-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    margin-bottom: 6px;
    color: var(--text-muted);
    align-items: center;
}

.panel-row span:last-child {
    color: var(--text-primary);
    text-align: right;
}

.daylight-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    border: 1px solid transparent;
    min-width: 58px;
}

.daylight-badge.day {
    background: rgba(34, 242, 166, 0.15);
    color: var(--ui-accent);
    border-color: rgba(34, 242, 166, 0.35);
}

.daylight-badge.night {
    background: rgba(120, 140, 255, 0.15);
    color: #96b0ff;
    border-color: rgba(120, 140, 255, 0.35);
}

.daylight-badge.neutral {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-soft);
    border-color: rgba(255, 255, 255, 0.15);
}

.panel-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.panel-subtitle {
    margin-top: 10px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-soft);
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.chip {
    border: 1px solid rgba(64, 200, 255, 0.35);
    background: rgba(6, 10, 18, 0.65);
    color: var(--text-primary);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip:hover {
    border-color: var(--ui-accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.chip.active {
    border-color: var(--ui-accent);
    color: var(--ui-accent);
}

.chip-empty {
    font-size: 11px;
    color: var(--text-soft);
}

.panel-btn {
    flex: 1;
    background: linear-gradient(160deg, rgba(18, 28, 45, 0.95), rgba(8, 12, 20, 0.95));
    color: var(--text-primary);
    border: 1px solid rgba(34, 242, 166, 0.45);
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}

.panel-btn:hover {
    border-color: var(--ui-accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.panel-btn:active {
    transform: translateY(0);
}

/* ===== TIMEBOARD ===== */
.timeboard {
    position: fixed;
    left: 20px;
    bottom: 45px;
    z-index: 90;
    background: var(--ui-bg);
    color: var(--text-primary);
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--ui-border);
    box-shadow: var(--shadow-soft);
    min-width: 220px;
    max-width: 280px;
    max-height: calc(100vh - 80px);
    backdrop-filter: blur(10px);
    font-family: var(--ui-font);
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
    resize: both;
    overflow: auto;
}

.timeboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timeboard-item {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 2px 12px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(6, 10, 18, 0.65);
    border: 1px solid rgba(64, 200, 255, 0.25);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.timeboard-item:hover {
    border-color: var(--ui-accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.timeboard-item.active {
    border-color: var(--ui-accent);
    box-shadow: var(--shadow-glow);
}

.timeboard-city {
    grid-column: 1;
    grid-row: 1;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.timeboard-meta {
    grid-column: 1;
    grid-row: 2;
    font-size: 10px;
    color: var(--text-soft);
}

.timeboard-time {
    grid-column: 2;
    grid-row: 1 / span 2;
    font-family: var(--mono-font);
    font-size: 14px;
    color: var(--ui-accent);
    align-self: center;
}

.timeboard-badge {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid transparent;
}

.timeboard-badge.day {
    background: rgba(34, 242, 166, 0.15);
    color: var(--ui-accent);
    border-color: rgba(34, 242, 166, 0.35);
}

.timeboard-badge.night {
    background: rgba(120, 140, 255, 0.15);
    color: #96b0ff;
    border-color: rgba(120, 140, 255, 0.35);
}

/* ===== CLOCK DISPLAY ===== */
.clock-display {
    position: fixed;
    top: 20px;
    right: 20px;
    left: auto;
    transform: none;
    z-index: 80;
    background: var(--ui-bg);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 12px;
    text-align: left;
    border: 1px solid var(--ui-border);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(12px);
    font-family: var(--ui-font);
    font-weight: 600;
    min-width: 200px;
    transition: opacity 0.3s ease;
    pointer-events: auto;
    user-select: none;
    cursor: grab;
    touch-action: none;
}

.clock-handle {
    font-size: 10px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-soft);
    margin-bottom: 6px;
}

.clock-handle span {
    margin-left: 6px;
    color: var(--ui-accent);
    font-weight: 600;
}

.clock-display.dragging {
    cursor: grabbing;
    box-shadow: var(--shadow-strong);
}

.clock-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.clock-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
}

.clock-time {
    font-size: 16px;
    font-family: var(--mono-font);
    color: var(--ui-accent);
    text-shadow: 0 0 8px rgba(34, 242, 166, 0.35);
}

.clock-date {
    font-size: 11px;
    color: var(--text-soft);
}

/* ===== STATUS BAR ===== */
.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: var(--ui-bg-strong);
    border-top: 1px solid var(--ui-border);
    display: flex;
    align-items: center;
    padding: 0 15px;
    font-size: 12px;
    font-family: var(--ui-font);
    z-index: 100;
    color: var(--text-primary);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    transition: opacity 0.3s ease;
}

.status-left {
    flex: 1;
    font-weight: bold;
}

.status-center {
    flex: 1;
    text-align: center;
    font-family: var(--mono-font);
    font-weight: bold;
    color: var(--ui-accent);
}

.status-right {
    flex: 1;
    text-align: right;
    font-weight: bold;
}

/* ===== STARFIELD ===== */
#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    display: block;
    opacity: 0.8;
}

/* ===== GLOBAL ANIMATION CONTROL ===== */
body.animations-paused #starfield,
body.animations-paused .pulse,
body.animations-paused .glow {
    animation-play-state: paused !important;
}

body.hud-hidden .controls-panel,
body.hud-hidden .performance-monitor,
body.hud-hidden .clock-display,
body.hud-hidden .status-bar,
body.hud-hidden .city-panel,
body.hud-hidden .timeboard {
    opacity: 0;
    pointer-events: none;
}

body.stats-hidden .performance-monitor {
    opacity: 0;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    #starfield,
    .pulse,
    .glow {
        animation: none !important;
    }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .controls-panel {
        top: 10px;
        left: 10px;
        gap: 5px;
    }
    
    .control-btn {
        padding: 8px 12px;
        font-size: 12px;
        min-width: 120px;
    }

    .control-input-group {
        padding: 8px;
        min-width: 160px;
    }

    .control-label {
        font-size: 10px;
    }

    .control-input {
        font-size: 12px;
        padding: 6px 8px;
    }

    .control-group {
        padding: 8px;
        min-width: 160px;
    }

    .control-chip {
        font-size: 9px;
        padding: 6px;
    }
    
    .performance-monitor {
        top: 90px;
        right: 10px;
        padding: 10px;
        font-size: 10px;
        min-width: 140px;
    }

    .city-panel {
        right: 10px;
        bottom: 40px;
        padding: 10px;
        min-width: 180px;
    }

    .panel-name {
        font-size: 14px;
    }

    .panel-time {
        font-size: 13px;
    }

    .panel-actions {
        flex-direction: column;
    }

    .daylight-badge {
        font-size: 9px;
        min-width: 50px;
    }

    .timeboard {
        left: 10px;
        bottom: 40px;
        padding: 10px;
        min-width: 190px;
        max-width: 220px;
    }

    .timeboard-time {
        font-size: 13px;
    }
    
    .clock-display {
        top: 10px;
        right: 10px;
        padding: 10px 12px;
        min-width: 170px;
    }

    .clock-time {
        font-size: 14px;
    }

    .clock-date {
        font-size: 10px;
    }
    
    .status-bar {
        height: 25px;
        font-size: 10px;
        padding: 0 10px;
    }
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

.fade-out {
    opacity: 0 !important;
}

.fade-in {
    opacity: 1 !important;
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes glow {
    0% { box-shadow: 0 0 5px rgba(0,255,136,0.5); }
    50% { box-shadow: 0 0 20px rgba(0,255,136,0.8); }
    100% { box-shadow: 0 0 5px rgba(0,255,136,0.5); }
}

.glow {
    animation: glow 2s infinite;
} 
.draggable-panel {
    resize: both;
    overflow: auto;
}

.panel-grip,
.monitor-header,
.panel-title {
    cursor: grab;
    user-select: none;
}

.draggable-panel.dragging {
    cursor: grabbing;
}
