/* =============================================
   StackMonitor — main.css
   Estética: Industrial Dark / Terminal Precision
   ============================================= */

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

:root {
    --bg:       #080c10;
    --surface:  #0e1419;
    --border:   #1e2d3d;
    --accent:   #00d4ff;
    --accent2:  #ff6b35;
    --accent3:  #39ff14;
    --text:     #c8d8e8;
    --muted:    #4a6274;
    --danger:   #ff3b5c;
    --warn:     #ffcc00;
    --font-mono: 'Space Mono', monospace;
    --font-ui:   'Syne', sans-serif;
    --radius:    6px;
    --sidebar-w: 240px;
}

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

/* ---- FONDO ---- */
.bg-grid {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image:
        linear-gradient(rgba(0,212,255,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,212,255,.04) 1px, transparent 1px);
    background-size: 40px 40px;
}
.bg-glow {
    position: fixed; border-radius: 50%; filter: blur(120px); pointer-events: none; z-index: 0;
}
.g1 { width: 600px; height: 600px; background: rgba(0,212,255,.06); top: -200px; right: -200px; }
.g2 { width: 500px; height: 500px; background: rgba(255,107,53,.05); bottom: -150px; left: -150px; }

/* ---- SHELL ---- */
.shell {
    position: relative; z-index: 1;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: 24px 0;
    position: sticky; top: 0; height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex; align-items: center; gap: 12px;
    padding: 0 20px 28px;
    border-bottom: 1px solid var(--border);
}
.brand-icon { font-size: 28px; color: var(--accent); line-height: 1; }
.brand-name { font-family: var(--font-ui); font-weight: 800; font-size: 15px; letter-spacing: .05em; color: #fff; }
.brand-sub  { font-family: var(--font-mono); font-size: 9px; color: var(--muted); letter-spacing: .1em; }

.nav { padding: 20px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: var(--radius);
    font-size: 13px; font-weight: 600; letter-spacing: .03em;
    color: var(--muted); text-decoration: none;
    transition: all .2s ease;
    border: 1px solid transparent;
}
.nav-item:hover {
    color: var(--text);
    background: rgba(0,212,255,.06);
    border-color: rgba(0,212,255,.15);
}
.nav-item.active {
    color: var(--accent);
    background: rgba(0,212,255,.1);
    border-color: rgba(0,212,255,.3);
}
.nav-icon { font-size: 16px; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 8px;
    font-family: var(--font-mono); font-size: 10px; color: var(--muted);
}
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent3);
    box-shadow: 0 0 8px var(--accent3);
    animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ---- CONTENT ---- */
.content {
    padding: 36px 40px;
    min-height: 100vh;
    animation: fadeIn .3s ease;
}
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }

/* ---- COMPONENTES COMUNES ---- */
.page-header { margin-bottom: 32px; }
.page-title {
    font-size: 28px; font-weight: 800;
    color: #fff; letter-spacing: -.01em;
}
.page-title span { color: var(--accent); }
.page-desc { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 6px; letter-spacing: .05em; }

/* Tarjetas */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}
.card-title {
    font-size: 11px; font-weight: 600; letter-spacing: .12em;
    text-transform: uppercase; color: var(--accent);
    margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}
.card-title::before { content:''; display:block; width:3px; height:14px; background:var(--accent); border-radius:2px; }

/* Grid de tarjetas */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
    position: relative; overflow: hidden;
}
.stat-card::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0;
    height: 2px; background: var(--accent);
}
.stat-card.orange::after { background: var(--accent2); }
.stat-card.green::after  { background: var(--accent3); }
.stat-card.red::after    { background: var(--danger); }
.stat-label { font-family: var(--font-mono); font-size: 10px; color: var(--muted); letter-spacing: .08em; margin-bottom: 8px; }
.stat-value { font-family: var(--font-mono); font-size: 28px; font-weight: 700; color: #fff; }
.stat-unit  { font-size: 13px; color: var(--muted); margin-left: 4px; }

/* Formularios */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-family: var(--font-mono); font-size: 10px; color: var(--muted); letter-spacing: .08em; }
.field input, .field select {
    background: var(--bg); border: 1px solid var(--border);
    color: var(--text); font-family: var(--font-mono); font-size: 13px;
    padding: 9px 12px; border-radius: var(--radius);
    outline: none; transition: border-color .2s;
}
.field input:focus, .field select:focus { border-color: var(--accent); }

/* Botones */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius);
    font-family: var(--font-mono); font-size: 12px; font-weight: 700;
    letter-spacing: .06em; cursor: pointer; border: none;
    transition: all .2s ease;
}
.btn-primary {
    background: var(--accent); color: var(--bg);
}
.btn-primary:hover { background: #33ddff; box-shadow: 0 0 20px rgba(0,212,255,.4); }

.btn-secondary {
    background: transparent; color: var(--accent);
    border: 1px solid var(--accent);
}
.btn-secondary:hover { background: rgba(0,212,255,.1); }

.btn-orange { background: var(--accent2); color: #fff; }
.btn-orange:hover { background: #ff8555; box-shadow: 0 0 20px rgba(255,107,53,.4); }

/* Tabla de resultados */
.result-table {
    width: 100%; border-collapse: collapse;
    font-family: var(--font-mono); font-size: 12px;
    margin-top: 16px;
}
.result-table th {
    text-align: left; padding: 10px 14px;
    color: var(--accent); font-size: 10px; letter-spacing: .1em;
    border-bottom: 1px solid var(--border);
}
.result-table td {
    padding: 10px 14px; border-bottom: 1px solid rgba(30,45,61,.5);
    color: var(--text);
}
.result-table tr:hover td { background: rgba(0,212,255,.04); }
.result-table .highlight { color: var(--accent); font-weight: 700; }

/* Gantt */
#gantt-container {
    overflow-x: auto; margin-top: 16px;
}
.gantt-wrap { position: relative; padding-bottom: 30px; }
.gantt-row { display: flex; align-items: center; margin-bottom: 8px; gap: 0; }
.gantt-label { width: 60px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); flex-shrink: 0; }
.gantt-bar {
    height: 32px; border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-mono); font-size: 10px; font-weight: 700;
    color: var(--bg); position: relative; min-width: 10px;
    border-left: 2px solid rgba(255,255,255,.2);
    transition: filter .2s;
}
.gantt-bar:hover { filter: brightness(1.2); }
.gantt-bar.idle { background: rgba(255,255,255,.04); border: 1px dashed var(--border); color: var(--muted); }
.gantt-timeline {
    display: flex; margin-left: 60px;
    border-top: 1px solid var(--border);
    padding-top: 4px;
}
.gantt-tick {
    font-family: var(--font-mono); font-size: 9px; color: var(--muted);
    text-align: center;
}

/* Mapa de memoria */
.mem-map { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.mem-block {
    display: flex; align-items: center;
    border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border);
    font-family: var(--font-mono); font-size: 11px;
    min-height: 40px; transition: all .3s ease;
}
.mem-block-label {
    width: 90px; flex-shrink: 0;
    padding: 8px 10px; color: var(--muted);
    background: var(--bg); border-right: 1px solid var(--border);
}
.mem-block-bar {
    flex: 1; padding: 8px 12px;
    display: flex; align-items: center; justify-content: space-between;
}
.mem-block.libre .mem-block-bar   { background: rgba(0,212,255,.07); color: var(--accent); }
.mem-block.ocupado .mem-block-bar { background: rgba(255,107,53,.15); color: var(--accent2); }
.mem-block.asignado .mem-block-bar { background: rgba(57,255,20,.12); color: var(--accent3); }
.mem-block.highlight-block { border-color: var(--accent3); box-shadow: 0 0 16px rgba(57,255,20,.2); }
.mem-frag-badge {
    display: inline-block; padding: 2px 8px;
    border-radius: 3px; font-size: 9px; font-weight: 700; letter-spacing: .08em;
    margin-left: 8px;
}
.frag-int { background: rgba(255,204,0,.2); color: var(--warn); }
.frag-ext { background: rgba(255,59,92,.2);  color: var(--danger); }

/* RAID */
.raid-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; margin-top: 16px; }
.raid-card {
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; position: relative; overflow: hidden;
}
.raid-level { font-size: 32px; font-weight: 800; color: var(--accent); font-family: var(--font-ui); }
.raid-name  { font-size: 11px; color: var(--muted); font-family: var(--font-mono); letter-spacing: .08em; margin-bottom: 12px; }
.raid-capacity { font-family: var(--font-mono); font-size: 22px; color: #fff; font-weight: 700; }
.raid-detail  { font-family: var(--font-mono); font-size: 10px; color: var(--muted); margin-top: 6px; }
.raid-redundancy { margin-top: 10px; display: inline-block; }
.badge {
    display: inline-block; padding: 3px 10px;
    border-radius: 20px; font-size: 10px; font-weight: 700;
    font-family: var(--font-mono); letter-spacing: .06em;
}
.badge-red    { background: rgba(255,59,92,.15);  color: var(--danger); }
.badge-warn   { background: rgba(255,204,0,.15);  color: var(--warn); }
.badge-green  { background: rgba(57,255,20,.12);  color: var(--accent3); }
.badge-blue   { background: rgba(0,212,255,.1);   color: var(--accent); }

/* Alertas / mensajes */
.alert {
    padding: 12px 16px; border-radius: var(--radius);
    font-family: var(--font-mono); font-size: 11px;
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px; border-left: 3px solid;
}
.alert-info    { background: rgba(0,212,255,.07);  border-color: var(--accent);  color: var(--accent); }
.alert-success { background: rgba(57,255,20,.07);  border-color: var(--accent3); color: var(--accent3); }
.alert-warn    { background: rgba(255,204,0,.07);  border-color: var(--warn);    color: var(--warn); }
.alert-error   { background: rgba(255,59,92,.07);  border-color: var(--danger);  color: var(--danger); }

.error-box {
    background: rgba(255,59,92,.1); border: 1px solid var(--danger);
    color: var(--danger); padding: 20px; border-radius: var(--radius);
    font-family: var(--font-mono); font-size: 13px;
}

/* Home dashboard stats */
.home-hero {
    margin-bottom: 36px; padding: 36px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); position: relative; overflow: hidden;
}
.home-hero::before {
    content: 'STACK\AMONITOR';
    white-space: pre;
    position: absolute; right: -20px; top: 50%; transform: translateY(-50%);
    font-family: var(--font-ui); font-size: 96px; font-weight: 800;
    color: rgba(0,212,255,.03); line-height: .95;
    pointer-events: none;
}
.home-hero h1 { font-size: 36px; font-weight: 800; color: #fff; line-height: 1.1; }
.home-hero h1 em { font-style: normal; color: var(--accent); }
.home-hero p { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-top: 10px; max-width: 500px; line-height: 1.8; }
.module-links { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-top: 28px; }
.mod-link {
    display: flex; flex-direction: column; gap: 8px;
    padding: 20px; border-radius: var(--radius);
    border: 1px solid var(--border); text-decoration: none;
    background: var(--bg); transition: all .25s ease;
}
.mod-link:hover {
    border-color: var(--accent); background: rgba(0,212,255,.05);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,212,255,.1);
}
.mod-link-icon { font-size: 24px; }
.mod-link-title { font-size: 14px; font-weight: 700; color: #fff; }
.mod-link-desc  { font-family: var(--font-mono); font-size: 10px; color: var(--muted); line-height: 1.6; }

/* Responsive mínimo */
@media (max-width: 800px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 12px; }
    .brand { border-bottom: none; padding-bottom: 0; }
    .nav { flex-direction: row; flex-wrap: wrap; gap: 4px; padding: 0; }
    .content { padding: 20px 16px; }
    .raid-grid { grid-template-columns: 1fr; }
    .module-links { grid-template-columns: 1fr; }
}
