@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&display=swap');

:root {
    --bg: #000;
    --card-bg: rgba(0, 0, 0, 0.75);
    --border: #0f03;
    --neon: #0f0;
    --neon-glow: #0f08;
    --neon-strong: #00ff00;
    --neon-cyan: #0ff;
    --neon-pink: #f0f;
    --text: #0c0;
    --muted: #0a0;
    --error: #f44;
    --error-glow: #f444;
}

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

body {
    font-family: 'Fira Code', 'Courier New', monospace;
    color: var(--neon);
    background: var(--bg);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent 0px,
            transparent 2px,
            rgba(0,255,0,0.03) 2px,
            rgba(0,255,0,0.03) 3px
        );
    pointer-events: none;
    z-index: -2;
}

@keyframes flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        opacity: 0.99;
    }
    20%, 24%, 55% {
        opacity: 0.98;
    }
}

/* Matrix rain de fons (igual que al login) */
#matrix {
    position: fixed;
    inset: 0;
    z-index: -3;
    pointer-events: none;
}

.card {
    width: 100%;
    max-width: 960px;
    background: var(--card-bg);
    border: 2px solid var(--neon);
    border-radius: 8px;
    padding: 32px;
    margin: 4vh auto;
    box-shadow: 
        0 0 20px var(--neon),
        0 0 40px var(--neon-glow),
        0 0 60px rgba(0,255,0,0.3),
        inset 0 0 25px rgba(0,255,0,0.1);
    backdrop-filter: blur(3px);
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}
}

.card:hover {
    box-shadow: 
        0 0 30px var(--neon),
        0 0 50px var(--neon-glow),
        0 0 80px rgba(0,255,0,0.4),
        inset 0 0 30px rgba(0,255,0,0.15);
    border-color: var(--neon-strong);
}

@keyframes cardPulse {
    0%, 100% {
        box-shadow: 
            0 0 20px var(--neon),
            0 0 40px var(--neon-glow),
            0 0 60px rgba(0,255,0,0.3),
            inset 0 0 25px rgba(0,255,0,0.1);
    }
    50% {
        box-shadow: 
            0 0 25px var(--neon),
            0 0 45px var(--neon-glow),
            0 0 70px rgba(0,255,0,0.35),
            inset 0 0 30px rgba(0,255,0,0.12);
    }
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    gap: 16px;
    border-bottom: 2px solid var(--neon);
    padding-bottom: 16px;
}
}

@keyframes topbarGlow {
    0%, 100% { 
        border-bottom-color: var(--neon);
        text-shadow: 0 0 10px var(--neon);
    }
    50% { 
        border-bottom-color: var(--neon-strong);
        text-shadow: 0 0 20px var(--neon-strong);
    }
}

.topbar strong {
    color: var(--neon);
    font-size: 1.4rem;
    text-shadow: 0 0 12px var(--neon);
    letter-spacing: 1px;
}

h1, h2, h3 {
    color: var(--neon);
    text-shadow: 
        0 0 10px var(--neon),
        0 0 20px var(--neon-glow),
        0 0 30px rgba(0,255,0,0.3);
    margin-bottom: 0.8em;
    letter-spacing: 2px;
}

@keyframes titleGlow {
    0%, 100% {
        text-shadow: 
            0 0 10px var(--neon),
            0 0 20px var(--neon-glow),
            0 0 30px rgba(0,255,0,0.3);
    }
    50% {
        text-shadow: 
            0 0 15px var(--neon),
            0 0 30px var(--neon-glow),
            0 0 40px rgba(0,255,0,0.4);
    }
}

h1 {
    font-size: 2.4rem;
    text-align: center;
    margin-bottom: 0.6em;
}

.sub {
    color: #0b0;
    font-size: 1.1rem;
    margin-bottom: 2rem;
    text-align: center;
    opacity: 0.9;
}

.small {
    color: #0a0;
    font-size: 0.95rem;
    line-height: 1.6;
}

a {
    color: #0c0;
    text-decoration: none;
    transition: all 0.2s;
}

a:hover {
    color: var(--neon);
    text-shadow: 0 0 8px var(--neon);
}

.services {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin: 2rem 0;
}

.service {
    background: rgba(0,0,0,0.6);
    border: 2px solid rgba(0,255,0,0.3);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 0 10px rgba(0,255,0,0.2),
        inset 0 0 15px rgba(0,255,0,0.05);
}

.service::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0,255,0,0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.service:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--neon);
    box-shadow: 
        0 0 15px var(--neon),
        0 0 25px rgba(0,255,0,0.2),
        inset 0 0 10px rgba(0,255,0,0.1);
    background: rgba(0,30,0,0.8);
}

.service:hover::before {
    opacity: 1;
}

.service h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--neon-strong);
    transition: all 0.3s ease;
}

.service:hover h3 {
    text-shadow: 
        0 0 15px var(--neon),
        0 0 25px var(--neon-glow),
        0 0 35px rgba(0,255,0,0.3);
}

.service::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(0,255,0,0.08), transparent);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.service:hover::before {
    opacity: 1;
}

.warning-title {
    color: #f66 !important;
    text-shadow: 0 0 10px #f44;
    margin: 3rem 0 1rem;
}

ol, ul {
    padding-left: 1.8rem;
    margin: 1.2rem 0;
}

ol li, ul li {
    margin-bottom: 0.8rem;
    line-height: 1.5;
}

/* Efecte glitch per títols principals (opcional) */
.glitch {
    position: relative;
    animation: glitch-skew 4s infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 #f0f8;
    clip: rect(0, 9999px, 0, 0);
    animation: glitch-anim 2s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: 2px 0 #0ff8;
    clip: rect(0, 9999px, 0, 0);
    animation: glitch-anim2 3s infinite linear alternate-reverse;
}

@keyframes glitch-skew {
    0%, 100% { transform: skew(0deg); }
    10%, 40%, 70% { transform: skew(2deg); }
    20%, 60% { transform: skew(-2deg); }
}

/* Pots posar class="glitch" data-text="..." als <h1> si vols */
/* ────────────────────────────────────────────────
   PANELL LATERAL (SIDEBAR)
───────────────────────────────────────────────── */

.menu-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  padding: 12px 20px;
  background: rgba(0,255,0,0.15);
  border: 1px solid #0f0;
  color: #0f0;
  font-family: 'Fira Code', monospace;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  box-shadow: 0 0 12px rgba(0,255,0,0.3);
}

.menu-btn:hover {
  background: rgba(0,255,0,0.25);
  box-shadow: 0 0 20px rgba(0,255,0,0.5);
}

.sidebar {
  position: fixed;
  top: 0;
  right: -320px;
  width: 320px;
  height: 100%;
  background: rgba(0,0,0,0.92);
  border-left: 1px solid #0f04;
  box-shadow: -10px 0 30px rgba(0,255,0,0.15);
  color: #0f0;
  transition: right 0.35s ease;
  z-index: 999;
  overflow-y: auto;
}

.sidebar.active {
  right: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #0f03;
}

.sidebar-header h2 {
  font-size: 1.3rem;
  margin: 0;
  text-shadow: 0 0 8px #0f0;
}

.close-btn {
  background: none;
  border: none;
  color: #0f0;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
}

.sidebar-content {
  padding: 20px 24px;
}

.sidebar-content h3 {
  color: #0c0;
  font-size: 1.1rem;
  margin: 1.8rem 0 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-content li {
  margin: 0.6rem 0;
}

.sidebar-content a {
  color: #0b0;
  text-decoration: none;
  transition: all 0.2s;
  display: block;
  padding: 6px 0;
}

.sidebar-content a:hover {
  color: #0f0;
  padding-left: 8px;
  text-shadow: 0 0 6px #0f0;
}

/* Overlay fosc */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  opacity: 0;
  visibility: hidden;
  transition: all 0.35s;
  z-index: 998;
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

.big-control-btn {
  display: inline-block;
  padding: 20px 40px;
  background: linear-gradient(135deg, #0f0 0%, #0c0 50%, #0f0 100%);
  color: #000;
  font-family: 'Fira Code', monospace;
  font-size: 1.4rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 8px;
  border: 3px solid #00ff00;
  box-shadow: 
    0 0 25px rgba(0,255,0,0.6),
    0 0 50px rgba(0,255,0,0.3),
    inset 0 0 15px rgba(0,255,0,0.2);
  transition: all 0.3s ease;
  letter-spacing: 2px;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}
}

@keyframes bigBtnPulse {
    0%, 100% {
        box-shadow: 
            0 0 25px rgba(0,255,0,0.6),
            0 0 50px rgba(0,255,0,0.3),
            inset 0 0 15px rgba(0,255,0,0.2);
    }
    50% {
        box-shadow: 
            0 0 35px rgba(0,255,0,0.8),
            0 0 60px rgba(0,255,0,0.4),
            inset 0 0 20px rgba(0,255,0,0.3);
    }
}

.big-control-btn:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 
    0 0 20px rgba(0,255,0,0.6),
    0 0 40px rgba(0,255,0,0.3),
    inset 0 0 15px rgba(0,255,0,0.2);
  background: linear-gradient(135deg, #0c0 0%, #0f0 50%, #0c0 100%);
  color: #000;
  text-shadow: 0 0 8px rgba(0,0,0,0.3);
  border-color: #00ff00;
}

/* Botons d'iniciar simulació */
.start-btn {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: 12px;
  background: linear-gradient(135deg, #0f0 0%, #0c0 100%);
  color: #000;
  border: none;
  border-radius: 6px;
  font-family: 'Fira Code', monospace;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 0 15px rgba(0,255,0,0.4);
}

.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(0,255,0,0.6);
  background: linear-gradient(135deg, #0c0 0%, #0f0 100%);
}

/* Millorar targetes */
.service {
  padding: 1.5rem;
  background: rgba(0,0,0,0.6);
  border: 1px solid #0f05;
  border-radius: 10px;
  transition: all 0.25s;
}

.service:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 20px rgba(0,255,0,0.2);
  border-color: #0f0;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(6px);
}

.modal.active {
  display: flex;
}

.modal-content {
  background: rgba(5,15,5,0.96);
  border: 1px solid #0f06;
  border-radius: 12px;
  width: 90%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 0 60px #0f0a;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #0f04;
  padding-bottom: 1rem;
}

.close-modal {
  background: none;
  border: none;
  color: #0f0;
  font-size: 2.5rem;
  cursor: pointer;
  line-height: 1;
}

.form-group {
  margin: 1.2rem 0;
}

.form-group label {
  display: block;
  margin-bottom: 0.6rem;
  color: #0c0;
  font-size: 0.95rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  background: #0009;
  border: 1px solid #0f04;
  color: #0f0;
  font-family: 'Fira Code', monospace;
  border-radius: 6px;
  font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #0f0;
  box-shadow: 0 0 12px #0f07;
}

/* Barra de progrés */
.progress-bar {
  height: 10px;
  background: #0f03;
  border-radius: 5px;
  margin: 1.5rem 0;
  overflow: hidden;
  border: 1px solid var(--neon);
  box-shadow: inset 0 0 10px rgba(0,255,0,0.1);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0f0, #0c0, #0f0);
  transition: width 4s ease-in-out;
  box-shadow: 0 0 10px var(--neon);
}

/* Línies de log */
.log-container {
  background: #0005;
  border: 2px solid var(--neon);
  border-radius: 8px;
  padding: 1rem;
  min-height: 180px;
  max-height: 380px;
  overflow-y: auto;
  box-shadow: 
    0 0 15px rgba(0,255,0,0.2),
    inset 0 0 10px rgba(0,255,0,0.05);
}

.log-line {
  color: #0b0;
  font-size: 0.92rem;
  margin: 0.5rem 0;
  white-space: pre-wrap;
  animation: logAppear 0.3s ease-in;
}

@keyframes logAppear {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes logFade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes glitch-anim {
  0%   { clip-path: polygon(0% 0%, 100% 0%, 100% 20%, 0% 20%); }
  20%  { clip-path: polygon(0% 60%, 100% 60%, 100% 80%, 0% 80%); }
  40%  { clip-path: polygon(0% 10%, 100% 10%, 100% 90%, 0% 90%); }
  60%  { clip-path: polygon(0% 50%, 100% 50%, 100% 30%, 0% 30%); }
  80%  { clip-path: polygon(0% 30%, 100% 30%, 100% 70%, 0% 70%); }
  100% { clip-path: polygon(0% 40%, 100% 40%, 100% 20%, 0% 20%); }
}

@keyframes glitch-anim2 {
  0%   { clip-path: polygon(0% 70%, 100% 70%, 100% 10%, 0% 10%); }
  20%  { clip-path: polygon(0% 30%, 100% 30%, 100% 90%, 0% 90%); }
  40%  { clip-path: polygon(0% 80%, 100% 80%, 100% 50%, 0% 50%); }
  60%  { clip-path: polygon(0% 40%, 100% 40%, 100% 60%, 0% 60%); }
  80%  { clip-path: polygon(0% 90%, 100% 90%, 100% 30%, 0% 30%); }
  100% { clip-path: polygon(0% 20%, 100% 20%, 100% 80%, 0% 80%); }
}

/* Estils per a botons */
.submit-btn {
  padding: 14px 24px;
  background: linear-gradient(135deg, #0f0 0%, #0c0 100%);
  color: #000;
  border: 2px solid #00ff00;
  border-radius: 6px;
  font-family: 'Fira Code', monospace;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  transition: all 0.3s ease;
  box-shadow: 
    0 0 15px rgba(0,255,0,0.5),
    0 0 30px rgba(0,255,0,0.2),
    inset 0 0 10px rgba(0,255,0,0.1);
  position: relative;
  overflow: hidden;
}
}

@keyframes buttonGlow {
    0%, 100% {
        box-shadow: 
            0 0 15px rgba(0,255,0,0.5),
            0 0 30px rgba(0,255,0,0.2),
            inset 0 0 10px rgba(0,255,0,0.1);
    }
    50% {
        box-shadow: 
            0 0 20px rgba(0,255,0,0.6),
            0 0 40px rgba(0,255,0,0.3),
            inset 0 0 15px rgba(0,255,0,0.15);
    }
}

.submit-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 
    0 0 25px rgba(0,255,0,0.8),
    0 0 50px rgba(0,255,0,0.4),
    inset 0 0 20px rgba(0,255,0,0.2);
  background: linear-gradient(135deg, #0c0 0%, #0f0 100%);
  border-color: #00ff00;
  text-shadow: 0 0 10px rgba(0,255,0,0.5);
}

.submit-btn:active {
  transform: translateY(-1px) scale(0.98);
  box-shadow: 
    0 0 10px rgba(0,255,0,0.4),
    inset 0 0 15px rgba(0,255,0,0.1);
}
{
    --neon: #00ff41;
    --bg: #050505;
    --info: #00d4ff;
    --alert: #ff3333;
    --dark-green: #001100;
    --border-green: #004400;
}

/* BASE */
body {
    background: var(--bg);
    color: #fff;
    font-family: 'Fira Code', monospace;
    margin: 0;
    overflow-x: hidden;
}

/* NAVBAR */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 25px;
    border-bottom: 2px solid var(--neon);
    background: var(--dark-green);
    box-shadow: 0 4px 15px rgba(0, 255, 65, 0.1);
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--neon);
    color: var(--neon);
    padding: 6px 14px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.8rem;
    transition: 0.3s;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
}

.nav-btn:hover {
    background: var(--neon);
    color: #000;
    box-shadow: 0 0 10px var(--neon);
}

.btn-home {
    border-color: #888;
    color: #ccc;
    margin-left: 15px;
}

.btn-home:hover {
    background: #444;
    color: #fff;
    border-color: #fff;
}

.btn-logout {
    border-color: var(--alert);
    color: var(--alert);
}

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

.agent-tag {
    font-size: 0.7rem;
    color: #666;
    margin-right: 20px;
    background: rgba(0, 255, 65, 0.05);
    padding: 4px 10px;
    border-radius: 3px;
    border: 1px solid #003300;
    display: flex;
    align-items: center;
}

.agent-tag .dot {
    height: 6px;
    width: 6px;
    background-color: var(--neon);
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    box-shadow: 0 0 5px var(--neon);
}

/* CONTENIDOR PRINCIPAL I GRID */
.main-container {
    max-width: 1100px;
    margin: 20px auto;
    padding: 20px;
    border: 1px solid var(--neon);
    background: rgba(0,10,0,0.9);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.tool-card {
    border: 1px solid rgba(0, 255, 65, 0.2);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
    background: rgba(0,0,0,0.5);
}

.tool-card:hover {
    border-color: var(--neon);
    background: rgba(0,255,65,0.1);
    transform: translateY(-3px);
}

/* OUTPUT: TERMINAL I GRÀFIC */
.output-container {
    position: relative;
    min-height: 450px;
    border: 1px solid var(--border-green);
    background: #000;
    display: none;
}

.controls {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: var(--dark-green);
    border-bottom: 1px solid var(--border-green);
}

.log-area {
    padding: 20px;
    height: 450px;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

#networkGraph {
    width: 100%;
    height: 450px;
    display: none;
    background: #000;
}

/* MODALS */
.modal {
    display:none;
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.9);
    align-items:center;
    justify-content:center;
    z-index:999;
}

.modal.active {
    display:flex;
}

.modal-box {
    border: 1px solid var(--neon);
    background:#000;
    padding:30px;
    width:400px;
    box-shadow: 0 0 20px var(--neon);
}

.modal-box input {
    width:100%;
    background:#000;
    border:1px solid var(--border-green);
    color:var(--neon);
    padding:10px;
    margin:10px 0;
    outline:none;
    font-family: inherit;
}
