/* ===========================
   THEME VARIABLES
   =========================== */
:root {
    --primary-color: #00ff00;
    --primary-glow: rgba(0, 255, 0, 0.5);
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-panel: rgba(0, 20, 0, 0.3);
    --border-color: rgba(0, 255, 0, 0.3);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-dim: rgba(255, 255, 255, 0.4);
}

.theme-green {
    --primary-color: #00ff00;
    --primary-glow: rgba(0, 255, 0, 0.5);
    --bg-panel: rgba(0, 20, 0, 0.3);
    --border-color: rgba(0, 255, 0, 0.3);
}

.theme-cyan {
    --primary-color: #00ffff;
    --primary-glow: rgba(0, 255, 255, 0.5);
    --bg-panel: rgba(0, 20, 20, 0.3);
    --border-color: rgba(0, 255, 255, 0.3);
}

.theme-orange {
    --primary-color: #ff9500;
    --primary-glow: rgba(255, 149, 0, 0.5);
    --bg-panel: rgba(20, 10, 0, 0.3);
    --border-color: rgba(255, 149, 0, 0.3);
}

.theme-pink {
    --primary-color: #ff77ff;
    --primary-glow: rgba(255, 119, 255, 0.5);
    --bg-panel: rgba(20, 0, 20, 0.3);
    --border-color: rgba(255, 119, 255, 0.3);
}

.theme-red {
    --primary-color: #ff4444;
    --primary-glow: rgba(255, 68, 68, 0.5);
    --bg-panel: rgba(20, 0, 0, 0.3);
    --border-color: rgba(255, 68, 68, 0.3);
}

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

body {
    font-family: 'Courier New', 'Courier', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    position: relative;
}

/* ===========================
   SCANLINE EFFECT
   =========================== */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15) 0px,
        transparent 1px,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 3px
    );
    animation: scanlines-move 8s linear infinite;
}

@keyframes scanlines-move {
    0% { transform: translateY(0); }
    100% { transform: translateY(10px); }
}

/* ===========================
   HEADER
   =========================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--primary-color);
    box-shadow: 0 0 20px var(--primary-glow);
    position: relative;
    z-index: 100;
}

.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.station-id {
    font-size: 14px;
    font-weight: bold;
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-glow);
    letter-spacing: 2px;
}

.mission-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.separator {
    color: var(--text-dim);
}

.glitch-text {
    font-size: 16px;
    font-weight: bold;
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-glow);
    position: relative;
    letter-spacing: 3px;
}

.theme-selector {
    background: var(--bg-primary);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 6px 12px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    cursor: pointer;
    outline: none;
    transition: all 0.3s;
}

.theme-selector:hover {
    background: var(--primary-color);
    color: var(--bg-primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

/* ===========================
   NAVIGATION TABS
   =========================== */
.nav-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
    gap: 5px;
    position: relative;
    z-index: 99;
}

.nav-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 12px 20px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    border-top: 2px solid transparent;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
    position: relative;
}

.nav-tab:hover {
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    background: var(--bg-panel);
    box-shadow: 0 0 10px var(--primary-glow);
}

.tab-icon {
    margin-right: 8px;
    font-size: 14px;
}

/* ===========================
   MAIN DASHBOARD
   =========================== */
.dashboard {
    height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 20px;
}

.page {
    display: none;
    animation: page-fade-in 0.5s ease-in-out;
}

.page.active {
    display: block;
}

@keyframes page-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
   GRID LAYOUTS
   =========================== */
.grid-container {
    display: grid;
    gap: 20px;
    height: 100%;
}

.overview-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.navigation-grid {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr auto;
}

.systems-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.comms-grid {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.diagnostics-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

/* ===========================
   PANELS
   =========================== */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    animation: panel-glow 3s infinite;
}

@keyframes panel-glow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.panel-header {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 13px;
    color: var(--primary-color);
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--primary-glow);
}

.status-indicator {
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--primary-glow);
}

.status-indicator.pulse {
    animation: pulse-indicator 1.5s infinite;
}

@keyframes pulse-indicator {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.panel-content {
    padding: 15px;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ===========================
   STATUS PANEL
   =========================== */
.status-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.status-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-label {
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.progress-bar {
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-glow);
    transition: width 0.5s;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-value {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--bg-primary);
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/* ===========================
   RADAR DISPLAY
   =========================== */
.radar-display {
    width: 100%;
    height: 300px;
    position: relative;
    background: radial-gradient(circle, rgba(0, 255, 0, 0.05), transparent);
}

.radar-grid {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    background-image: 
        linear-gradient(var(--border-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-color) 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.3;
}

.radar-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.radar-rings::before,
.radar-rings::after {
    content: '';
    position: absolute;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.radar-rings::before {
    width: 150px;
    height: 150px;
}

.radar-rings::after {
    width: 250px;
    height: 250px;
}

.radar-center {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 20px var(--primary-glow);
    animation: pulse-indicator 1s infinite;
}

.radar-sweep {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150px;
    height: 1px;
    background: linear-gradient(90deg, var(--primary-color), transparent);
    transform-origin: left center;
    transform: translate(0, -50%);
    animation: radar-sweep 4s linear infinite;
}

@keyframes radar-sweep {
    0% { transform: translate(0, -50%) rotate(0deg); }
    100% { transform: translate(0, -50%) rotate(360deg); }
}

.radar-blip {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--primary-glow);
    animation: blip-pulse 2s infinite;
}

@keyframes blip-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.5); }
}

.radar-info {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* ===========================
   ALERTS & LOGS
   =========================== */
.alert-list,
.terminal-display,
.error-log {
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert-item,
.terminal-line,
.log-entry {
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid var(--border-color);
    font-size: 11px;
    line-height: 1.4;
}

.alert-item.info,
.log-entry.info {
    border-left-color: #00aaff;
}

.alert-item.warning,
.log-entry.warning {
    border-left-color: #ffaa00;
    animation: warning-blink 2s infinite;
}

@keyframes warning-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.alert-item.success {
    border-left-color: #00ff00;
}

.alert-time,
.log-time {
    color: var(--text-dim);
    margin-right: 8px;
}

.alert-message,
.log-message {
    color: var(--text-secondary);
}

.terminal-line.received {
    color: #00aaff;
}

.terminal-line.sent {
    color: var(--primary-color);
}

.log-code {
    color: var(--primary-color);
    margin-right: 8px;
}

/* ===========================
   NAVIGATION DISPLAY
   =========================== */
.nav-display {
    width: 100%;
    height: 400px;
    position: relative;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

.nav-grid-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(var(--border-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-color) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.2;
    transform: perspective(600px) rotateX(50deg);
    transform-origin: bottom;
}

.trajectory-path {
    position: absolute;
    top: 80%;
    left: 10%;
    width: 4px;
    height: 60%;
    background: linear-gradient(0deg, var(--primary-color), transparent);
    transform: perspective(600px) rotateX(50deg);
    transform-origin: bottom;
    box-shadow: 0 0 10px var(--primary-glow);
}

.nav-target {
    position: absolute;
    top: 10%;
    left: 80%;
    width: 30px;
    height: 30px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: target-pulse 2s infinite;
}

@keyframes target-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.5; }
}

.nav-waypoint {
    position: absolute;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    font-size: 10px;
    box-shadow: 0 0 10px var(--primary-glow);
}

/* ===========================
   DATA GRID
   =========================== */
.data-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.data-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 8px 0;
}

.data-row.separator {
    height: 1px;
    background: var(--border-color);
    padding: 0;
}

.data-label {
    color: var(--text-secondary);
}

.data-value {
    color: var(--primary-color);
    font-weight: bold;
    text-shadow: 0 0 5px var(--primary-glow);
}

/* ===========================
   CONTROL BUTTONS
   =========================== */
.control-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.control-btn {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.control-btn:hover {
    background: var(--primary-color);
    color: var(--bg-primary);
    box-shadow: 0 0 20px var(--primary-glow);
    transform: scale(1.05);
}

.control-btn.pulse-btn {
    grid-column: span 2;
    animation: pulse-btn 2s infinite;
}

@keyframes pulse-btn {
    0%, 100% { box-shadow: 0 0 10px var(--primary-glow); }
    50% { box-shadow: 0 0 30px var(--primary-glow); }
}

/* ===========================
   SYSTEM METRICS
   =========================== */
.system-metrics {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.metric-label {
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.metric-display {
    display: flex;
    align-items: center;
    gap: 15px;
}

.gauge {
    flex: 1;
    height: 25px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.gauge-fill {
    height: 100%;
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-glow);
    transition: width 0.5s;
}

.metric-value {
    min-width: 60px;
    font-size: 14px;
    color: var(--primary-color);
    font-weight: bold;
    text-shadow: 0 0 5px var(--primary-glow);
}

.temperature-bar {
    flex: 1;
    height: 25px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    position: relative;
}

.temp-fill {
    height: 100%;
    background: linear-gradient(90deg, #00aaff, var(--primary-color), #ff4444);
    width: 50%;
    transition: width 0.5s;
}

.waveform-display {
    flex: 1;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
}

.status-badge.operational {
    background: rgba(0, 255, 0, 0.2);
    color: #00ff00;
    border: 1px solid #00ff00;
}

.status-badge.standby {
    background: rgba(255, 170, 0, 0.2);
    color: #ffaa00;
    border: 1px solid #ffaa00;
}

/* ===========================
   SIGNAL DISPLAY
   =========================== */
.signal-display {
    width: 100%;
    height: 200px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    position: relative;
}

.signal-display canvas {
    width: 100%;
    height: 100%;
}

.signal-info {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* ===========================
   MESSAGE TERMINAL
   =========================== */
.terminal-input {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

.terminal-prompt {
    color: var(--primary-color);
    font-weight: bold;
}

.terminal-field {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    outline: none;
}

.terminal-field::placeholder {
    color: var(--text-dim);
}

/* ===========================
   CHANNEL LIST
   =========================== */
.channel-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.channel-item:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-glow);
}

.channel-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-dim);
}

.channel-item.active .channel-indicator {
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-glow);
    animation: pulse-indicator 1.5s infinite;
}

.channel-name {
    flex: 1;
    font-size: 12px;
    color: var(--text-primary);
}

.channel-status {
    font-size: 10px;
    color: var(--text-dim);
}

.channel-item.active .channel-status {
    color: var(--primary-color);
}

/* ===========================
   SCAN DISPLAY
   =========================== */
.scan-display {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.scan-grid {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-glow);
    animation: scan-line 3s linear infinite;
}

@keyframes scan-line {
    0% { top: 0; }
    100% { top: 100%; }
}

.scan-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.scan-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid var(--border-color);
    font-size: 11px;
}

.scan-item.ok {
    border-left-color: #00ff00;
}

.scan-item.warning {
    border-left-color: #ffaa00;
}

.scan-icon {
    font-size: 14px;
    font-weight: bold;
}

.scan-item.ok .scan-icon {
    color: #00ff00;
}

.scan-item.warning .scan-icon {
    color: #ffaa00;
}

/* ===========================
   PERFORMANCE CHART
   =========================== */
.metrics-chart {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    padding: 10px;
}

.metrics-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ===========================
   FOOTER
   =========================== */
.footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 10px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-secondary);
}

.status-text {
    color: var(--primary-color);
    font-weight: bold;
}

/* ===========================
   SCROLLBAR
   =========================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */
@media (max-width: 1024px) {
    .overview-grid,
    .systems-grid,
    .diagnostics-grid {
        grid-template-columns: 1fr;
    }
    
    .navigation-grid,
    .comms-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-tabs {
        overflow-x: auto;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 10px;
    }
    
    .header-left,
    .header-center,
    .header-right {
        width: 100%;
        justify-content: center;
    }
    
    .nav-tab {
        padding: 10px 15px;
        font-size: 11px;
    }
    
    .dashboard {
        padding: 10px;
    }
    
    .grid-container {
        gap: 10px;
    }
}
