/* =========================================
   VARIABLES GLOBALES DEL SISTEMA HUD
========================================= */
:root {
    --bg-dark: #030508;
    --hud-cyan: #00f3ff;
    --hud-cyan-dim: rgba(0, 243, 255, 0.2);
    --hud-amber: #ffb700;
    --hud-amber-dim: rgba(255, 183, 0, 0.2);
    --hud-purple: #b535ff;
    --hud-purple-dim: rgba(181, 53, 255, 0.2);
    --hud-green: #00ff66;
    --hud-green-dim: rgba(0, 255, 102, 0.2);
    --hud-text: #c0f8ff;
    --hud-text-muted: #a3d2db; /* Más claro, tirando al blanco */
    
    --border-glow: 0 0 10px var(--hud-cyan-dim), inset 0 0 10px var(--hud-cyan-dim);
    --border-glow-amber: 0 0 10px var(--hud-amber-dim), inset 0 0 10px var(--hud-amber-dim);
    --border-glow-purple: 0 0 10px var(--hud-purple-dim), inset 0 0 10px var(--hud-purple-dim);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.dark-space {
    background-color: var(--bg-deep);
    background-image: url('../assets/space_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--hud-text-muted);
    font-family: 'Orbitron', sans-serif;
    margin: 0;
    overflow: hidden;
    height: 100vh;
}

h1, h2, h3, h4, h5, .orbitron {
    font-family: 'Orbitron', sans-serif;
}

/* =========================================
   EFECTOS DE FONDO (CANVAS, SCANLINES)
========================================= */
#space-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(circle at center, #0a0f18 0%, #030508 100%);
}

#space-canvas {
    width: 100%;
    height: 100%;
}

.scanlines {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.1));
    background-size: 100% 4px;
    z-index: 10;
    pointer-events: none;
    opacity: 0.6;
}

.vignette {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    box-shadow: 0 0 150px rgba(0,0,0,0.9) inset;
    z-index: 9;
    pointer-events: none;
}

/* =========================================
   LAYOUT DEL CENTRO DE COMANDO (GRID)
========================================= */
.hud-container {
    position: relative;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr 3fr;
    grid-template-rows: auto 1fr auto;
    gap: 20px;
    padding: 20px;
    height: 100vh;
    max-width: 1800px;
    margin: 0 auto;
}

/* =========================================
   CABECERA (HEADER)
========================================= */
.hud-header {
    grid-column: 1 / -1;
    border: 1px solid var(--hud-cyan);
    box-shadow: var(--border-glow);
    padding: 20px;
    position: relative;
    background: rgba(0, 243, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    clip-path: polygon(0 0, 100% 0, 98% 100%, 2% 100%);
}

/* Esquinas Decorativas */
.corner {
    position: absolute;
    width: 20px; height: 20px;
    border: 2px solid var(--hud-cyan);
}
.corner.top-left { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.corner.top-right { top: -2px; right: -2px; border-left: none; border-bottom: none; }

.glitch {
    font-size: 2rem;
    font-weight: 900;
    color: var(--hud-cyan);
    text-shadow: 0 0 10px var(--hud-cyan);
    letter-spacing: 4px;
    position: relative;
}

/* Efecto Glitch básico */
.glitch::before, .glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
.glitch::before {
    left: 2px;
    text-shadow: -2px 0 red;
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}
.glitch::after {
    left: -2px;
    text-shadow: -2px 0 blue;
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip: rect(10px, 9999px, 80px, 0); }
    20% { clip: rect(30px, 9999px, 10px, 0); }
    40% { clip: rect(60px, 9999px, 40px, 0); }
    60% { clip: rect(20px, 9999px, 90px, 0); }
    80% { clip: rect(80px, 9999px, 30px, 0); }
    100% { clip: rect(40px, 9999px, 60px, 0); }
}
@keyframes glitch-anim-2 {
    0% { clip: rect(20px, 9999px, 40px, 0); }
    20% { clip: rect(80px, 9999px, 20px, 0); }
    40% { clip: rect(10px, 9999px, 90px, 0); }
    60% { clip: rect(50px, 9999px, 30px, 0); }
    80% { clip: rect(90px, 9999px, 10px, 0); }
    100% { clip: rect(30px, 9999px, 80px, 0); }
}

.status-bar {
    font-size: 1.2rem;
    color: var(--hud-cyan);
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-indicator {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--hud-green);
    box-shadow: 0 0 10px var(--hud-green);
    animation: blink 2s infinite;
}

.digital-clock {
    font-weight: bold;
    letter-spacing: 2px;
}

/* =========================================
   PANELES HUD (IZQUIERDA Y CENTRO)
========================================= */
.hud-panel {
    border: 1px solid var(--hud-cyan-dim);
    background: rgba(0, 10, 20, 0.6);
    backdrop-filter: blur(5px);
    padding: 20px;
    position: relative;
    overflow-y: auto;
}

.hud-panel::-webkit-scrollbar { width: 5px; }
.hud-panel::-webkit-scrollbar-track { background: transparent; }
.hud-panel::-webkit-scrollbar-thumb { background: var(--hud-cyan); }

.left-panel {
    border-right: 2px solid var(--hud-cyan);
}

.panel-title {
    font-family: 'Orbitron', sans-serif;
    color: var(--hud-cyan);
    font-size: 1.1rem;
    border-bottom: 1px dashed var(--hud-cyan);
    padding-bottom: 10px;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

/* Módulos de Información (Qué Hacemos) */
.data-module {
    margin-bottom: 30px;
    padding: 15px;
    border: 1px solid rgba(0, 243, 255, 0.1);
    background: linear-gradient(90deg, rgba(0,243,255,0.05) 0%, transparent 100%);
    border-left: 3px solid var(--hud-cyan);
    transition: all 0.3s ease;
}

.data-module:hover {
    background: linear-gradient(90deg, rgba(0,243,255,0.15) 0%, transparent 100%);
    border-left-color: #fff;
}

.module-title {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.9rem;
    color: var(--hud-text-muted);
    margin-bottom: 5px;
}

.module-subtitle {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    color: #fff;
    margin-bottom: 10px;
    text-shadow: 0 0 5px rgba(255,255,255,0.5);
}

.module-text {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 15px;
    color: #e0faff; /* 50% más claro y brillante */
    text-shadow: 0 0 5px rgba(224, 250, 255, 0.3);
}

.progress-bar-container {
    height: 4px;
    background: rgba(0, 243, 255, 0.1);
    width: 100%;
}

.progress-bar {
    height: 100%;
    background: var(--hud-cyan);
    box-shadow: 0 0 10px var(--hud-cyan);
}

/* =========================================
   EL RADAR ANIMADO
========================================= */
.radar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 40px;
}

.radar {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 2px solid var(--hud-cyan);
    background: rgba(0, 243, 255, 0.05) url('data:image/svg+xml;utf8,<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"><circle cx="100" cy="100" r="50" stroke="%2300f3ff" stroke-width="1" fill="none" opacity="0.3"/><circle cx="100" cy="100" r="80" stroke="%2300f3ff" stroke-width="1" fill="none" opacity="0.3"/><line x1="100" y1="0" x2="100" y2="200" stroke="%2300f3ff" opacity="0.3"/><line x1="0" y1="100" x2="200" y2="100" stroke="%2300f3ff" opacity="0.3"/></svg>');
    position: relative;
    overflow: hidden;
    box-shadow: var(--border-glow);
}

.radar-sweep {
    position: absolute;
    top: 0; left: 100px;
    width: 100px; height: 100px;
    background: linear-gradient(to right, transparent, rgba(0, 243, 255, 0.5));
    transform-origin: bottom left;
    animation: radar-spin 4s linear infinite;
}

@keyframes radar-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.radar-blip {
    position: absolute;
    width: 6px; height: 6px;
    background: var(--hud-amber);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--hud-amber);
    animation: blip-fade 4s infinite;
}

@keyframes blip-fade {
    0% { opacity: 0; transform: scale(0); }
    10% { opacity: 1; transform: scale(1.5); }
    20% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1); }
}

.radar-text {
    font-size: 0.8rem;
    color: var(--hud-cyan);
    animation: blink 1.5s infinite;
}

/* =========================================
   GRID DE SISTEMAS (EL PORTAL)
========================================= */
.systems-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 10px;
}

.system-card {
    border: 1px solid var(--hud-cyan-dim);
    background: rgba(0, 24, 40, 0.5);
    padding: 20px;
    position: relative;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.system-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0, 243, 255, 0.02) 10px, rgba(0, 243, 255, 0.02) 20px);
    pointer-events: none;
}

.system-card:hover {
    border-color: var(--hud-cyan);
    box-shadow: inset 0 0 20px rgba(0, 243, 255, 0.1), 0 0 15px rgba(0, 243, 255, 0.2);
    transform: scale(1.02);
    z-index: 2;
}

/* Variaciones de Estado */
.status-dev { border-color: var(--hud-amber-dim); }
.status-dev:hover { border-color: var(--hud-amber); box-shadow: inset 0 0 20px rgba(255, 183, 0, 0.1), 0 0 15px rgba(255, 183, 0, 0.2); }

.status-proto { border-color: var(--hud-purple-dim); }
.status-proto:hover { border-color: var(--hud-purple); box-shadow: inset 0 0 20px rgba(181, 53, 255, 0.1), 0 0 15px rgba(181, 53, 255, 0.2); }

.system-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 5px;
}

.system-id { color: var(--hud-text-muted); }
.system-status { color: var(--hud-green); font-weight: bold; text-shadow: 0 0 5px var(--hud-green); }

.system-name {
    font-family: 'Orbitron', sans-serif;
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.system-desc {
    font-size: 0.9rem;
    color: #e0faff; /* 50% más claro y brillante */
    text-shadow: 0 0 5px rgba(224, 250, 255, 0.3);
    flex-grow: 1;
    margin-bottom: 20px;
}

/* Botones HUD */
.hud-btn {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 10px;
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid var(--hud-cyan);
    color: var(--hud-cyan);
    text-decoration: none;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 1px;
    transition: all 0.2s;
    cursor: pointer;
    text-transform: uppercase;
}

.hud-btn:hover {
    background: var(--hud-cyan);
    color: #000;
    box-shadow: 0 0 15px var(--hud-cyan);
}

.hud-btn-amber {
    border-color: var(--hud-amber);
    color: var(--hud-amber);
    background: rgba(255, 183, 0, 0.1);
}
.hud-btn-amber:hover {
    background: var(--hud-amber);
    color: #000;
    box-shadow: 0 0 15px var(--hud-amber);
}

.hud-btn-purple {
    border-color: var(--hud-purple);
    color: var(--hud-purple);
    background: rgba(181, 53, 255, 0.1);
}
.hud-btn-purple:hover {
    background: var(--hud-purple);
    color: #000;
    box-shadow: 0 0 15px var(--hud-purple);
}

/* =========================================
   FOOTER (COMUNICACIONES)
========================================= */
.hud-footer {
    grid-column: 1 / -1;
    border-top: 1px solid var(--hud-cyan);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 243, 255, 0.05);
}

.comms-panel {
    display: flex;
    gap: 20px;
    align-items: center;
}

.comms-link {
    color: var(--hud-cyan);
    text-decoration: none;
    transition: color 0.2s;
}
.comms-link:hover {
    color: #fff;
    text-shadow: 0 0 8px #fff;
}

.footer-deco {
    color: var(--hud-text-muted);
    font-size: 0.9rem;
}

/* =========================================
   UTILIDADES
========================================= */
.text-amber { color: var(--hud-amber) !important; text-shadow: 0 0 5px var(--hud-amber); }
.text-purple { color: var(--hud-purple) !important; text-shadow: 0 0 5px var(--hud-purple); }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.mt-2 { margin-top: 10px; }
.mt-4 { margin-top: 20px; }
.text-center { text-align: center; }

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
.blink-text { animation: blink 1s infinite; }

/* Responsive */
@media (max-width: 1200px) {
    .hud-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr auto;
        height: auto;
    }
    .left-panel { border-right: none; border-bottom: 2px solid var(--hud-cyan); }
}

@media (max-width: 768px) {
    .hud-container {
        padding: 10px;
        gap: 10px;
    }
    
    .hud-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .glitch {
        font-size: 1.5rem; /* Letra más chica para el título en móviles */
    }
    
    .status-bar {
        font-size: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .systems-grid {
        grid-template-columns: 1fr; /* Una sola columna en teléfonos */
    }
    
    .hud-footer {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .comms-panel {
        flex-direction: column;
        gap: 10px;
    }
}
