/* ==========================================================================
   VEXTOR CRaaS - HOJA DE ESTILOS MAESTRA (VERSIÓN 3.2 BALANCEADA)
   ========================================================================== */

:root {
    --bg-color-main: #0b1120; --bg-color-sidebar: #0f172a; --bg-color-card: #1e293b;
    --text-main: #e2e8f0; --text-muted: #94a3b8;
    --accent-azul-rey: #1e40af; --accent-cyan: #06b6d4; --status-green: #10b981;
    --panic-red-base: #7f1d1d; --panic-red-active: #ff0000; --border-color: #334155;
    --agent-purple: #a855f7;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', system-ui, sans-serif; }
body { background-color: var(--bg-color-main); color: var(--text-main); display: flex; min-height: 100vh; transition: background-color 0.3s ease; overflow-x: hidden; }

/* BARRA LATERAL FLOTANTE Y RETRÁCTIL */
.sidebar { 
    width: 320px; background-color: var(--bg-color-sidebar); border-right: 1px solid var(--border-color); 
    padding: 2.5rem 1.5rem; display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; height: 100vh; z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow-y: auto; 
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
body.sidebar-closed .sidebar { transform: translateX(-100%); }

.logo-container { display: flex; flex-direction: column; align-items: center; gap: 20px; margin-bottom: 1.5rem; text-align: center; }

/* ESCUDO SOBERANO */
#main-logo { 
    width: 130px; height: auto; cursor: pointer; 
    mix-blend-mode: screen; 
    animation: levitacion-soberana 6s ease-in-out infinite; 
}
@keyframes levitacion-soberana {
    0% { transform: translateY(0px) rotate(0deg); filter: drop-shadow(0 0 5px rgba(6, 182, 212, 0.2)); }
    50% { transform: translateY(-12px) rotate(3deg); filter: drop-shadow(0 0 25px rgba(6, 182, 212, 0.7)); }
    100% { transform: translateY(0px) rotate(0deg); filter: drop-shadow(0 0 5px rgba(6, 182, 212, 0.2)); }
}
#main-logo:hover { animation-play-state: paused; transform: scale(1.15) rotate(-5deg); filter: drop-shadow(0 0 35px rgba(6, 182, 212, 1)); transition: all 0.3s ease; }

/* BRANDING EN AZUL REY */
#brand-name { font-size: 2.2rem; font-weight: 900; letter-spacing: -1px; line-height: 1.1; color: var(--accent-azul-rey); text-shadow: 0 0 15px rgba(30, 64, 175, 0.6); }
#brand-name span { color: var(--accent-azul-rey); display: block; font-size: 2.5rem; }

.project-sublogo { text-align: center; margin-bottom: 2.5rem; }
.project-sublogo p { color: var(--accent-cyan); font-weight: 600; line-height: 1.4; font-size: 0.85rem; background: rgba(6, 182, 212, 0.05); padding: 10px; border-radius: 8px; border: 1px solid rgba(6, 182, 212, 0.2); }

.menu-principal ul { list-style: none; }
.menu-principal li { margin-bottom: 0.8rem; }
.menu-principal a { text-decoration: none; color: var(--text-muted); font-size: 1.1rem; display: block; padding: 12px 15px; border-radius: 8px; transition: all 0.2s ease; }
.menu-principal a:hover, .menu-principal li.active a { background-color: var(--bg-color-card); color: var(--accent-cyan); }

.language-selector-container { margin-top: 1.5rem; margin-bottom: 1.5rem; background: rgba(0,0,0,0.15); padding: 12px; border-radius: 8px; border: 1px solid var(--border-color); }
.language-selector-container label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 5px; }
#lang-select { width: 100%; background-color: var(--bg-color-main); color: var(--text-main); border: 1px solid var(--border-color); padding: 8px; border-radius: 6px; outline: none; }

.sidebar-status { margin-top: auto; background-color: rgba(0,0,0,0.2); padding: 15px; border-radius: 8px; border: 1px solid var(--border-color); font-size: 0.9rem; }
.text-green { color: var(--status-green); font-weight: bold; }
.text-blue { color: var(--accent-blue); font-weight: bold; }
.text-alert { color: var(--panic-red-active); font-weight: bold; }

/* TABLERO GENERAL */
.dashboard-content { flex: 1; padding: 3rem; margin-left: 320px; transition: margin-left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); width: 100%; }
body.sidebar-closed .dashboard-content { margin-left: 0; }

.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3rem; border-bottom: 1px solid var(--border-color); padding-bottom: 2rem; }
.header-left { display: flex; align-items: center; gap: 20px; }

.btn-toggle-menu { background: transparent; color: var(--accent-cyan); border: 1px solid var(--border-color); padding: 10px 15px; border-radius: 6px; cursor: pointer; font-size: 1.2rem; transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; }
.btn-toggle-menu:hover { background: rgba(6, 182, 212, 0.1); border-color: var(--accent-cyan); }

.dashboard-header h1 { font-size: 2.2rem; color: var(--accent-azul-rey); text-shadow: 0 0 15px rgba(30, 64, 175, 0.6); font-weight: 900; }
.dashboard-header p { color: var(--text-muted); margin-top: 5px; font-weight: 300; }

/* TARJETAS PREMIUM Y EQUILIBRIO DE FUENTES */
.telemetry-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 25px; }
.card { background-color: var(--bg-color-card); padding: 2.5rem; border-radius: 12px; border: 1px solid var(--border-color); box-shadow: 0 10px 25px rgba(0,0,0,0.2); transition: transform 0.3s ease; }
.card:hover { transform: translateY(-2px); }
.card h3 { color: var(--text-muted); text-transform: uppercase; margin-bottom: 1.2rem; font-size: 0.85rem; font-weight: 600; }

/* CORRECCIÓN: Tipografía equilibrada y sin saltos de letra molestos */
.card .big-data { 
    font-size: clamp(1.3rem, 2vw + 0.5rem, 1.9rem); /* Reducido para equilibrar visualmente con los números */
    font-weight: 700; 
    line-height: 1.2; 
    /* Hemos eliminado 'word-break' para que OPERATIVO jamás se parta en dos líneas */
}

/* BOTÓN DE PÁNICO Y ANIMACIÓN TÁCTICA */
.panic-button { background-color: var(--panic-red-base); color: white; padding: 15px 30px; border: 2px solid #ef4444; border-radius: 8px; font-weight: bold; font-size: 1.1rem; cursor: pointer; box-shadow: 0 0 10px rgba(239, 68, 68, 0.4); }
.panic-button.emergencia-activa { background-color: var(--panic-red-active); box-shadow: 0 0 40px rgba(255, 0, 0, 1); animation: vibrar-boton 0.1s infinite; }

body.alerta-ambulancia { animation: flash-ambulancia-tactica 1.5s infinite alternate ease-in-out; }
@keyframes flash-ambulancia-tactica { 0% { box-shadow: inset 0 0 0px rgba(255, 0, 0, 0); border-top: 0px solid transparent; } 100% { box-shadow: inset 0 60px 100px -30px rgba(255, 0, 0, 0.25); border-top: 6px solid var(--panic-red-active); } }
@keyframes vibrar-boton { 0% { transform: translate(1px, 1px); } 50% { transform: translate(-2px, -1px); } 100% { transform: translate(1px, -1px); } }

/* ELEMENTOS DE GOBIERNO */
.btn-action, .btn-success { padding: 14px 18px; border-radius: 8px; cursor: pointer; font-weight: bold; width: 100%; margin-bottom: 12px; transition: all 0.3s ease; text-transform: uppercase; font-size: 0.9rem; }
.btn-action { background-color: rgba(6, 182, 212, 0.05); color: var(--accent-cyan); border: 1px solid var(--accent-cyan); }
.btn-action:hover, .btn-action.active-report { background-color: var(--accent-cyan); color: var(--bg-color-main); box-shadow: 0 0 15px rgba(6, 182, 212, 0.4); }
.btn-success { background-color: rgba(16, 185, 129, 0.05); color: var(--status-green); border: 1px solid var(--status-green); }
.btn-success:hover { background-color: var(--status-green); color: var(--bg-color-main); box-shadow: 0 0 15px rgba(16, 185, 129, 0.4); }
.input-dark { width: 100%; padding: 14px; margin-bottom: 15px; background-color: rgba(0,0,0,0.3); border: 1px solid var(--border-color); color: var(--text-main); border-radius: 8px; outline: none; transition: border-color 0.3s, box-shadow 0.3s; }
.input-dark:focus { border-color: var(--accent-cyan); box-shadow: 0 0 10px rgba(6, 182, 212, 0.2); }
.input-error { border-color: var(--panic-red-active) !important; box-shadow: 0 0 8px rgba(255,0,0,0.5); }

/* VENTANA MODAL CISO */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(5, 8, 15, 0.9); display: flex; align-items: center; justify-content: center; z-index: 9999; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; backdrop-filter: blur(5px); }
.modal-overlay.active-modal { opacity: 1; pointer-events: auto; }
.modal-content { background-color: var(--bg-color-sidebar); border: 1px solid var(--border-color); padding: 3rem; border-radius: 16px; width: 450px; text-align: center; box-shadow: 0 20px 40px rgba(0,0,0,0.8); }
.modal-content h3 { margin-bottom: 1rem; color: #ffffff; font-size: 1.4rem; }
.modal-content p { margin-bottom: 1.8rem; color: var(--text-muted); font-size: 0.95rem; line-height: 1.5; }
.modal-buttons { display: flex; gap: 15px; margin-top: 1rem; }
.alert-text { color: var(--panic-red-active); font-size: 0.85rem; margin-top: 15px; font-weight: bold; display: none; }

/* TABLA FORENSE (BÓVEDA) */
.table-responsive { overflow-x: auto; }
.forensic-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.9rem; }
.forensic-table th { background-color: rgba(0,0,0,0.2); padding: 15px; color: var(--text-muted); border-bottom: 1px solid var(--border-color); text-transform: uppercase; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.5px; }
.forensic-table td { padding: 18px 15px; border-bottom: 1px solid var(--border-color); color: var(--text-main); }
.forensic-table tr:hover { background-color: rgba(255,255,255,0.02); }
.badge { padding: 6px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: bold; letter-spacing: 0.5px; }
.badge-red { background-color: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.4); }
.badge-green { background-color: rgba(16, 185, 129, 0.1); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.4); }
.svg-curva-animada { stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: dibujar-curva 3s ease forwards; }
@keyframes dibujar-curva { to { stroke-dashoffset: 0; } }

/* MAPA TOPOLÓGICO Y NODOS */
.map-container { position: relative; width: 100%; background: repeating-linear-gradient(rgba(51, 65, 85, 0.1) 0, rgba(51, 65, 85, 0.1) 1px, transparent 1px, transparent 40px), repeating-linear-gradient(90deg, rgba(51, 65, 85, 0.1) 0, rgba(51, 65, 85, 0.1) 1px, transparent 1px, transparent 40px); border-radius: 12px; overflow: hidden; border: 1px solid var(--border-color); }
.map-lines { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }
.line-data { animation: flujo-datos 2s linear infinite; stroke-dasharray: 5,5; }
.line-attack { animation: rayo-ataque 0.5s infinite alternate; }
@keyframes flujo-datos { to { stroke-dashoffset: -20; } }
@keyframes rayo-ataque { 0% { opacity: 0.5; stroke-width: 2; } 100% { opacity: 1; stroke-width: 4; filter: drop-shadow(0 0 5px red); } }
.topo-node { position: absolute; transform: translate(-50%, -50%); z-index: 2; display: flex; flex-direction: column; align-items: center; }
.node-icon { width: 55px; height: 55px; background: var(--bg-color-sidebar); border: 2px solid var(--accent-cyan); border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 1.5rem; box-shadow: 0 0 15px rgba(6, 182, 212, 0.3); z-index: 3; transition: transform 0.3s; }
.node-icon:hover { transform: scale(1.1); }
.node-label { margin-top: 10px; font-size: 0.8rem; font-weight: bold; background: rgba(0,0,0,0.8); padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border-color); }
.node-under-attack .node-icon { border-color: var(--panic-red-active); background: #2b0000; box-shadow: 0 0 20px rgba(255, 0, 0, 0.5); }
.pulse-ring { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 55px; height: 55px; border-radius: 50%; border: 3px solid var(--panic-red-active); animation: radar-ataque 1.5s ease-out infinite; z-index: 1; }
@keyframes radar-ataque { 0% { transform: translateX(-50%) scale(1); opacity: 1; } 100% { transform: translateX(-50%) scale(2.5); opacity: 0; } }

/* MATRIZ ECG DE LA JAURÍA DE AGENTES */
.swarm-matrix-container { width: 100%; height: 200px; background-color: #030712; border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; position: relative; box-shadow: inset 0 0 40px rgba(0,0,0,0.9); }
.swarm-svg { width: 100%; height: 100%; display: block; }
.ecg-line { fill: none; stroke-width: 2.5; stroke-dasharray: 250 1200; stroke-linecap: round; animation: ecg-pulse-travel linear infinite; }
@keyframes ecg-pulse-travel { 0% { stroke-dashoffset: 1450; } 100% { stroke-dashoffset: -250; } }
.ecg-axis-y { font-size: 10px; fill: var(--text-muted); font-family: monospace; }
.agent-cyan { stroke: #06b6d4; filter: drop-shadow(0 0 8px #06b6d4); animation-duration: 4.2s; }
.agent-purple { stroke: #a855f7; filter: drop-shadow(0 0 8px #a855f7); animation-duration: 3.5s; animation-delay: 0.8s; }
.agent-red { stroke: #ef4444; filter: drop-shadow(0 0 10px #ef4444); animation-duration: 2.8s; animation-delay: 1.5s; }
.agent-green { stroke: #10b981; filter: drop-shadow(0 0 8px #10b981); animation-duration: 5s; animation-delay: 0.2s; }
.agent-blue { stroke: #3b82f6; filter: drop-shadow(0 0 8px #3b82f6); animation-duration: 4.8s; animation-delay: 1.1s; }
.agent-orange { stroke: #f59e0b; filter: drop-shadow(0 0 6px #f59e0b); animation-duration: 3.1s; animation-delay: 0.4s; }
.agent-legend { display: flex; flex-wrap: wrap; gap: 15px; margin-top: 20px; justify-content: center; font-size: 0.85rem; color: var(--text-muted); }
.agent-legend div { display: flex; align-items: center; gap: 8px; font-weight: bold; background: rgba(0,0,0,0.2); padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border-color); }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.bg-cyan { background: #06b6d4; box-shadow: 0 0 5px #06b6d4;}
.bg-purple { background: #a855f7; box-shadow: 0 0 5px #a855f7;}
.bg-red { background: #ef4444; box-shadow: 0 0 5px #ef4444;}
.bg-green { background: #10b981; box-shadow: 0 0 5px #10b981;}
.bg-blue { background: #3b82f6; box-shadow: 0 0 5px #3b82f6;}
.bg-orange { background: #f59e0b; box-shadow: 0 0 5px #f59e0b;}