/* Drone Flight Simulator Design System - Dark Futuristic Glassmorphism */
:root {
    --bg-primary: #0a0e17;
    --bg-surface: rgba(16, 24, 40, 0.75);
    --bg-surface-border: rgba(0, 240, 255, 0.2);
    --accent-cyan: #00f0ff;
    --accent-amber: #ffaa00;
    --accent-red: #ff3366;
    --accent-green: #00ff88;
    --accent-blue: #0088ff;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-muted: #484f58;
    --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --glass-backdrop: blur(12px);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-family);
}

/* 3D Canvas Container */
#viewport {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#hud-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* FPV Screen Overlay Signal Effect */
.fpv-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
    background: radial-gradient(circle, transparent 60%, rgba(0,0,0,0.4) 100%);
    box-shadow: inset 0 0 100px rgba(0,240,255,0.05);
}

.fpv-static {
    background-image: repeating-radial-gradient(circle at 17% 32%, rgba(255,255,255,0.03), rgba(0,0,0,0.08) 2px);
    opacity: 0.15;
    animation: staticNoise 0.2s steps(4) infinite;
}

@keyframes staticNoise {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-1px, 1px); }
    50% { transform: translate(1px, -1px); }
    75% { transform: translate(-1px, -1px); }
    100% { transform: translate(1px, 1px); }
}

/* UI Overlay Container */
.ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px;
}

.interactive {
    pointer-events: auto;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.brand-badge {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-backdrop);
    border: 1px solid var(--bg-surface-border);
    border-radius: var(--radius-md);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--glass-shadow);
}

.brand-logo {
    height: 44px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.4));
    transition: transform 0.3s ease;
}

.brand-logo:hover {
    transform: scale(1.08);
}

.brand-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    background: linear-gradient(135deg, #ffffff 0%, var(--accent-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
}

.brand-sub {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.creator-badge {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-backdrop);
    border: 1px solid rgba(255, 170, 0, 0.35);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-primary);
    box-shadow: var(--glass-shadow);
    white-space: nowrap;
}

.creator-badge .icon {
    color: var(--accent-amber);
    font-size: 0.95rem;
}

.creator-badge strong {
    color: var(--accent-amber);
    font-weight: 700;
}

.brand-badge span.tag {
    font-size: 0.7rem;
    background: rgba(0, 240, 255, 0.15);
    color: var(--accent-cyan);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Quick Bar Buttons */
.top-controls {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-backdrop);
    border: 1px solid var(--bg-surface-border);
    color: var(--text-primary);
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--glass-shadow);
}

.btn-icon:hover {
    background: rgba(0, 240, 255, 0.2);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    transform: translateY(-2px);
}

.btn-icon.active {
    background: var(--accent-cyan);
    color: #000;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
}

/* Mode Pills & Quick Info */
.flight-mode-selector {
    display: flex;
    gap: 6px;
    background: var(--bg-surface);
    backdrop-filter: var(--glass-backdrop);
    border: 1px solid var(--bg-surface-border);
    padding: 4px;
    border-radius: var(--radius-md);
}

.mode-pill {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.mode-pill.active {
    background: var(--accent-cyan);
    color: #000;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

.mode-pill:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Telemetry Dashboard Panels */
.side-panel {
    position: absolute;
    top: 80px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 240px;
}

.side-panel.left {
    left: 16px;
}

.side-panel.right {
    right: 16px;
}

.widget {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-backdrop);
    border: 1px solid var(--bg-surface-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    box-shadow: var(--glass-shadow);
}

.widget-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.telemetry-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.telemetry-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.telemetry-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-cyan);
}

.telemetry-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 2px;
}

/* Rotor Thruster Bar Gauge */
.rotor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.rotor-item {
    background: rgba(0,0,0,0.3);
    padding: 6px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.rotor-name {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.rotor-bar-bg {
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
}

.rotor-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
    transition: width 0.1s linear;
}

/* Battery Gauge */
.battery-bar-container {
    height: 10px;
    background: rgba(0,0,0,0.4);
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
    margin-top: 4px;
}

.battery-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan));
    transition: width 0.3s ease, background 0.3s ease;
}

.battery-bar-fill.warning {
    background: linear-gradient(90deg, var(--accent-amber), #ff8800);
}

.battery-bar-fill.critical {
    background: linear-gradient(90deg, var(--accent-red), #ff0000);
    animation: flash 0.5s infinite alternate;
}

@keyframes flash {
    from { opacity: 1; }
    to { opacity: 0.4; }
}

/* Touch Joysticks for Mobile / Touch Screens */
.joystick-zone {
    position: absolute;
    bottom: 24px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: rgba(0, 240, 255, 0.05);
    border: 2px dashed rgba(0, 240, 255, 0.3);
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.joystick-zone.left {
    left: 24px;
}

.joystick-zone.right {
    right: 24px;
}

.joystick-handle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-cyan) 0%, rgba(0, 136, 255, 0.8) 100%);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.6);
    position: absolute;
    pointer-events: none;
}

.joystick-label {
    position: absolute;
    top: -24px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Bottom Center Action Bar & Controls Overlay */
.bottom-bar {
    align-self: center;
    display: flex;
    gap: 12px;
    background: var(--bg-surface);
    backdrop-filter: var(--glass-backdrop);
    border: 1px solid var(--bg-surface-border);
    padding: 8px 16px;
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
}

.btn-action {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-action:hover {
    background: rgba(0, 240, 255, 0.15);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.btn-action.btn-rth {
    background: rgba(255, 170, 0, 0.15);
    border-color: var(--accent-amber);
    color: var(--accent-amber);
}

.btn-action.btn-rth:hover {
    background: var(--accent-amber);
    color: #000;
    box-shadow: 0 0 15px rgba(255, 170, 0, 0.5);
}

.btn-action.btn-rth.active {
    background: var(--accent-amber);
    color: #000;
    animation: flash 0.8s infinite alternate;
}

/* Modals & Dialogs */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 8, 15, 0.8);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: rgba(16, 24, 40, 0.95);
    border: 1px solid var(--accent-cyan);
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.2);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 12px;
}

.modal-header h2 {
    font-size: 1.25rem;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.close-btn:hover {
    color: var(--accent-red);
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setting-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
}

.setting-input-range {
    width: 100%;
    accent-color: var(--accent-cyan);
}

.keybind-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.keybind-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.key-badge {
    background: rgba(0, 240, 255, 0.15);
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
}

/* Race & Mission Banner Overlay */
.banner-overlay {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-surface);
    backdrop-filter: var(--glass-backdrop);
    border: 1px solid var(--accent-amber);
    box-shadow: 0 0 20px rgba(255, 170, 0, 0.3);
    padding: 10px 24px;
    border-radius: var(--radius-md);
    text-align: center;
    pointer-events: none;
    z-index: 20;
}

.banner-title {
    font-size: 0.75rem;
    color: var(--accent-amber);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.banner-value {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
}

/* Notification Toast */
.toast-container {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: rgba(16, 24, 40, 0.95);
    border-left: 4px solid var(--accent-cyan);
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    animation: slideUp 0.3s ease forwards;
    transition: opacity 0.4s ease;
    white-space: nowrap;
    max-width: 420px;
}

.toast-warning {
    border-left-color: var(--accent-amber);
    box-shadow: 0 4px 20px rgba(255,170,0,0.2);
}

.toast-error {
    border-left-color: var(--accent-red);
    box-shadow: 0 4px 20px rgba(255,51,102,0.2);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Widget header flex helper */
.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    gap: 6px;
}

/* Pulse keyframe for status indicators */
@keyframes pulse {
    0%,100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.7; transform: scale(1.05); }
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .side-panel { width: 190px; }
    .flight-mode-selector { display: none; }
    .creator-badge { display: none; }
}

@media (max-width: 640px) {
    .side-panel { width: 155px; top: 68px; }
    .side-panel.left { left: 6px; }
    .side-panel.right { right: 6px; }
    .brand-name { font-size: 0.9rem; }
    .joystick-zone { width: 110px; height: 110px; }
    .joystick-handle { width: 38px; height: 38px; }
    .bottom-bar { gap: 6px; padding: 6px 10px; font-size: 0.78rem; }
    #minimap-container { bottom: 90px; }
}

