:root {
    --neon-green: #00ff41;
    --dark-bg: #0a0a0a;
    --warn-yellow: #f1e05a;
    --crit-red: #ff3e3e;
}

body {
    background-color: var(--dark-bg);
    color: var(--neon-green);
    font-family: 'Courier New', Courier, monospace;
    margin: 0;
    overflow: hidden;
    text-transform: uppercase;
}

/* Efecto de líneas de escaneo de monitor antiguo */
.scanline {
    width: 100%;
    height: 100px;
    z-index: 10;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0) 0%, rgba(0, 255, 65, 0.05) 50%, rgba(0, 0, 0, 0) 100%);
    opacity: 0.1;
    position: absolute;
    bottom: 100%;
    animation: scanline 6s linear infinite;
}

@keyframes scanline {
    0% { bottom: 100%; }
    100% { bottom: -100px; }
}

.terminal-container {
    padding: 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Grid de Servidores */
.monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin: 20px 0;
    flex-grow: 1;
    overflow-y: auto;
}

.server-node {
    border: 1px solid var(--neon-green);
    padding: 15px;
    background: rgba(0, 255, 65, 0.02);
    box-shadow: inset 0 0 10px rgba(0, 255, 65, 0.1);
    position: relative;
}

.server-node.offline { border-color: var(--crit-red); color: var(--crit-red); }

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 10px;
    background: var(--neon-green);
}

/* Input de Comandos */
.input-area { display: flex; align-items: center; border-top: 1px solid #333; padding-top: 10px; }
#command-input {
    background: transparent;
    border: none;
    color: var(--neon-green);
    font-family: inherit;
    font-size: 1.1rem;
    outline: none;
    width: 100%;
}

.server-node {
    border: 1px solid var(--neon-green);
    background: rgba(0, 5, 0, 0.8);
    padding: 0; /* Quitamos padding para usar el header de la tarjeta */
    display: flex;
    flex-direction: column;
    min-height: 180px;
    font-size: 0.85rem;
}

.node-header {
    background: var(--neon-green);
    color: var(--dark-bg);
    padding: 4px 10px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.node-body {
    padding: 12px;
    flex-grow: 1;
}

.data-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(0, 255, 65, 0.1);
}

.data-label { color: rgba(0, 255, 65, 0.6); font-size: 0.75rem; }

.cpu-bar-container {
    width: 100%;
    height: 4px;
    background: #1a1a1a;
    margin-top: 10px;
}

.cpu-bar-fill {
    height: 100%;
    background: var(--neon-green);
    box-shadow: 0 0 8px var(--neon-green);
    transition: width 0.5s ease-in-out; /* <--- ESTA LÍNEA ES CLAVE */
}

.sparkline-container {
    width: 100%;
    height: 30px;
    margin-top: 10px;
    border-bottom: 1px solid rgba(0, 255, 65, 0.2);
    overflow: hidden;
}

.sparkline-path {
    fill: none;
    stroke: var(--neon-green);
    stroke-width: 1.5;
    stroke-linecap: round;
}

.server-node.offline {
    border-color: var(--crit-red) !important;
    background: rgba(255, 62, 62, 0.05);
    animation: alert-blink 1s infinite;
}

.server-node.offline .node-header {
    background: var(--crit-red);
}

.server-node.offline .sparkline-path {
    stroke: var(--crit-red);
}

@keyframes alert-blink {
    0% { box-shadow: inset 0 0 10px rgba(255, 62, 62, 0.1); }
    50% { box-shadow: inset 0 0 20px rgba(255, 62, 62, 0.4); }
    100% { box-shadow: inset 0 0 10px rgba(255, 62, 62, 0.1); }
}

/* Marco de Advertencia Global */
.alarm-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; /* No interfiere con los clics */
    border: 0px solid var(--crit-red);
    box-sizing: border-box;
    z-index: 9999;
    transition: border-width 0.2s;
}

/* Cuando el sistema entra en pánico */
body.system-panic .alarm-overlay {
    border-width: 15px;
    animation: pulse-border 1s infinite;
}

@keyframes pulse-border {
    0% { border-color: rgba(255, 62, 62, 0.2); }
    50% { border-color: rgba(255, 62, 62, 0.8); }
    100% { border-color: rgba(255, 62, 62, 0.2); }
}

/* Botón de pantalla completa manual */
.fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 150px;
    background: transparent;
    border: 1px solid var(--neon-green);
    color: var(--neon-green);
    cursor: pointer;
    font-family: inherit;
    padding: 2px 10px;
}

/* Scrollbar estilo Matrix */
.console-output::-webkit-scrollbar {
    width: 4px;
}
.console-output::-webkit-scrollbar-thumb {
    background: var(--neon-green);
    box-shadow: 0 0 5px var(--neon-green);
}

/* Efecto de texto que brilla */
.log-entry {
    margin-bottom: 5px;
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-shadow: 0 0 2px rgba(0, 255, 65, 0.7);
}

/* Animación del prompt de escritura */
.prompt {
    animation: blink 1s infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

body.system-panic::before {
    content: "";
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(255, 0, 0, 0.05),
        rgba(255, 0, 0, 0.05) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 1000;
}

/* Mejora del contenedor de la gráfica */
.sparkline-container {
    width: 100%;
    height: 45px; /* Un poco más alto para mejor visibilidad */
    margin-top: 15px;
    filter: drop-shadow(0 0 2px rgba(0, 255, 65, 0.2));
}

.sparkline-path {
    fill: none;
    stroke-width: 2;
    stroke-linejoin: round;
    transition: all 0.3s ease; /* Suaviza la actualización de datos */
}

.sparkline-fill {
    transition: all 0.3s ease;
    pointer-events: none;
}

.stats-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}

.cpu-gauge {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gauge-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 3;
}

.gauge-fill {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 0.5s ease, stroke 0.5s ease;
}

.gauge-text {
    font-size: 8px;
    text-anchor: middle;
    dominant-baseline: middle;
    font-weight: bold;
}

.gauge-label {
    font-size: 0.6rem;
    color: rgba(0, 255, 65, 0.5);
    margin-top: -5px;
}

.hosting-info {
    margin-top: 15px;
    font-size: 0.75rem;
    color: rgba(0, 255, 65, 0.4);
    text-align: right; /* Orientado a la derecha */
    letter-spacing: 0.5px;
    border-top: 1px solid rgba(0, 255, 65, 0.1);
    padding-top: 10px;
    text-transform: none; /* Esto asegura que se respete la minúscula */
}

.hosting-info a {
    color: rgba(0, 255, 65, 0.6);
    text-decoration: none;
    transition: all 0.3s ease;
}

.hosting-info a:hover {
    color: var(--neon-green);
    text-shadow: 0 0 5px var(--neon-green);
}

.hosting-info .url {
    font-family: monospace;
    opacity: 0.5;
}