/* ==========================================================================
   1. VARIABLES GENERALES Y BASE
   ========================================================================== */
:root {
  --htb-bg: #0b0e14;
  --htb-surface: #131927;
  --htb-surface-hover: #1a2332;
  --htb-border: #1e2638;
  --htb-green: #9fef00;
  --htb-green-hover: #b4ff1a;
  --htb-blue: #0dcaf0;
  --htb-yellow: #ffb800;
  --htb-text: #a4b1cd;
  --htb-text-muted: #98a6ad;
  --htb-text-bright: #ffffff;
  --htb-font-mono: 'Fira Code', monospace;
}

body {
  background-color: var(--htb-bg);
  color: var(--htb-text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
}

.htb-container {
  background-color: var(--htb-bg);
  color: var(--htb-text);
  min-height: calc(100vh - 60px);
}

.htb-title {
  font-family: var(--htb-font-mono);
  color: var(--htb-text-bright);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.5px;
}

/* ==========================================================================
   2. NAVBAR & NAVEGACIÓN
   ========================================================================== */
.htb-navbar {
  background-color: var(--htb-surface) !important;
  border-bottom: 1px solid var(--htb-border);
}

.htb-brand {
  font-family: var(--htb-font-mono);
  color: var(--htb-green) !important;
  letter-spacing: -0.5px;
}

.htb-brand i {
  color: var(--htb-green);
  text-shadow: 0 0 10px rgba(159, 239, 0, 0.4);
}

.htb-nav-link {
  color: var(--htb-text) !important;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  padding: 0.5rem 1rem !important;
  border-radius: 6px;
}

.htb-nav-link:hover,
.htb-nav-link.active {
  color: var(--htb-text-bright) !important;
  background-color: rgba(255, 255, 255, 0.05);
}

.user-tag {
  font-family: var(--htb-font-mono);
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--htb-border);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  color: var(--htb-text-bright);
}

/* ==========================================================================
   3. CARDS Y CONTENEDORES
   ========================================================================== */
.card-htb {
  background-color: var(--htb-surface);
  border: 1px solid var(--htb-border);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.card-htb-header {
  background-color: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--htb-border);
  font-family: var(--htb-font-mono);
  padding: 0.85rem 1.25rem;
}

.metric-box {
  background-color: var(--htb-bg);
  border: 1px solid var(--htb-border);
  border-radius: 6px;
}

/* ==========================================================================
   4. FORMULARIO E INPUTS
   ========================================================================== */
.htb-input,
.htb-select,
.htb-form-control input,
.htb-form-control select,
.htb-form-control textarea,
.form-control,
.form-select {
  background-color: var(--htb-bg) !important;
  border: 1px solid var(--htb-border) !important;
  color: var(--htb-text-bright) !important;
  font-family: var(--htb-font-mono);
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
}

.htb-input::placeholder {
  color: var(--htb-text-muted) !important;
  opacity: 0.6;
}

.htb-input:focus,
.htb-select:focus,
.htb-form-control input:focus,
.htb-form-control select:focus,
.htb-form-control textarea:focus,
.form-control:focus,
.form-select:focus {
  border-color: var(--htb-green) !important;
  box-shadow: 0 0 8px rgba(159, 239, 0, 0.2) !important;
}

.htb-label {
  color: var(--htb-text-muted);
  font-family: var(--htb-font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  font-weight: 600;
}

/* ==========================================================================
   5. BOTONES
   ========================================================================== */
.btn-htb-primary {
  background-color: var(--htb-green);
  color: #000000;
  font-weight: 700;
  border: none;
  font-family: var(--htb-font-mono);
  font-size: 0.85rem;
  box-shadow: 0 0 10px rgba(159, 239, 0, 0.2);
  transition: all 0.2s ease;
}

.btn-htb-primary:hover {
  background-color: var(--htb-green-hover);
  color: #000000;
  box-shadow: 0 0 18px rgba(159, 239, 0, 0.4);
}

.btn-htb-outline {
  background-color: transparent;
  color: var(--htb-green);
  border: 1px solid var(--htb-green);
  font-family: var(--htb-font-mono);
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.btn-htb-outline:hover {
  background-color: var(--htb-green);
  color: #000000;
  box-shadow: 0 0 12px rgba(159, 239, 0, 0.3);
}

.btn-htb-cancel {
  background-color: transparent;
  color: var(--htb-text-muted);
  border: 1px solid var(--htb-border);
  font-family: var(--htb-font-mono);
  transition: all 0.2s ease;
}

.btn-htb-cancel:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--htb-text-bright);
  border-color: #344465;
}

.btn-htb-danger {
  background-color: transparent;
  color: #ff4d4d;
  border: 1px solid rgba(255, 77, 77, 0.3);
  font-family: var(--htb-font-mono);
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn-htb-danger:hover {
  background-color: rgba(255, 77, 77, 0.1);
  color: #ff6666;
  border-color: #ff4d4d;
  box-shadow: 0 0 12px rgba(255, 77, 77, 0.4);
}

.btn-htb-tool {
  background-color: var(--htb-bg);
  border: 1px solid var(--htb-border);
  color: var(--htb-text-bright);
  font-family: var(--htb-font-mono);
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.btn-htb-tool:hover {
  border-color: var(--htb-green);
  color: var(--htb-green);
  background-color: var(--htb-surface-hover);
}

/* ==========================================================================
   6. TABLAS
   ========================================================================== */
.table-htb {
  --bs-table-bg: transparent;
  --bs-table-color: #a4b1cd;
  border-color: var(--htb-border);
  font-size: 0.825rem;
}

.table-htb tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.015);
}

.table-htb td {
  padding: 0.45rem 0.75rem;
  border-color: rgba(30, 38, 56, 0.6);
}

.htb-val-highlight {
  color: var(--htb-green);
  font-family: var(--htb-font-mono);
}

/* ==========================================================================
   7. MONITOREO / DASHBOARD
   ========================================================================== */
.monitor-shell {
  background: linear-gradient(135deg, rgba(16, 22, 33, 0.95), rgba(19, 25, 39, 0.9));
  border: 1px solid var(--htb-border);
  border-radius: 16px;
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.24);
}

.monitor-title-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(159, 239, 0, 0.12);
  color: var(--htb-green);
  box-shadow: inset 0 0 0 1px rgba(159, 239, 0, 0.18);
}

.monitor-stat {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--htb-border);
  border-radius: 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.monitor-stat-online { border-top: 3px solid #2ecc71; }
.monitor-stat-warning { border-top: 3px solid #f4b942; }
.monitor-stat-offline { border-top: 3px solid #f87171; }
.monitor-stat-total { border-top: 3px solid #8b9bb6; }

.monitor-stat-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  margin: 0 auto 0.6rem;
}

.monitor-form .form-check-input {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.15rem;
}

.monitor-target {
  border: 1px solid var(--htb-border);
  border-left: 4px solid var(--htb-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.monitor-target:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.12);
}

.monitor-target-online {
  border-left-color: #2ecc71;
  background: linear-gradient(180deg, rgba(46, 204, 113, 0.12), rgba(255,255,255,0.02));
}

.monitor-target-warning {
  border-left-color: #f4b942;
  background: linear-gradient(180deg, rgba(244, 185, 66, 0.12), rgba(255,255,255,0.02));
}

.monitor-target-offline {
  border-left-color: #f87171;
  background: linear-gradient(180deg, rgba(248, 113, 113, 0.12), rgba(255,255,255,0.02));
}

.monitor-target-desconocido {
  border-left-color: #8b9bb6;
  background: rgba(139, 155, 182, 0.04);
}

.monitor-target-name {
  color: var(--htb-text-bright);
  font-size: 1.02rem;
}

.monitor-target-meta {
  color: var(--htb-text);
  font-size: 0.82rem;
  line-height: 1.5;
}

.monitor-target-meta strong {
  color: var(--htb-text-bright);
}

/* ==========================================================================
   8. TOPOLOGÍA / RED DIAGRAM
   ========================================================================== */
.topology-board {
  min-height: 720px;
  background: linear-gradient(180deg, rgba(10, 14, 20, 0.96), rgba(16, 20, 30, 0.96));
  border: 1px solid var(--htb-border);
  border-radius: 18px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.28);
}

.topology-network {
  position: relative;
  width: 100%;
  min-height: 650px;
  border-radius: 18px;
  background:
   radial-gradient(circle at center, rgba(13, 202, 240, 0.06), transparent 34%),
   linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border: 1px solid rgba(159, 239, 0, 0.12);
  overflow: hidden;
}

.topology-network::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
   linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
   linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, black 42%, transparent 100%);
}

.topology-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 128px;
  height: 128px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(159, 239, 0, 0.18), rgba(13, 202, 240, 0.08));
  border: 1px solid rgba(159, 239, 0, 0.4);
  color: var(--htb-green);
  font-family: var(--htb-font-mono);
  font-weight: 700;
  box-shadow: 0 0 30px rgba(159, 239, 0, 0.12);
  z-index: 1;
}

.topology-line {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  height: 2px;
  background: linear-gradient(90deg, rgba(159,239,0,0.2), rgba(13,202,240,0.5), rgba(159,239,0,0.2));
  opacity: 0.8;
  z-index: 0;
}

.line-internet { width: 32%; transform: rotate(18deg); }
.line-servers { width: 30%; transform: rotate(-18deg); }
.line-routers { width: 40%; transform: rotate(42deg); }
.line-switches { width: 38%; transform: rotate(-42deg); }
.line-pcs { width: 30%; transform: rotate(90deg); }

.topology-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  background: rgba(17, 23, 32, 0.9);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.26);
  z-index: 2;
  min-width: 160px;
}

.node-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: 0 0 14px currentColor;
  flex-shrink: 0;
}

.node-online { border-color: rgba(46, 204, 113, 0.6); }
.node-online .node-dot { color: #2ecc71; background: #2ecc71; }
.node-online .node-label strong { color: #8ae6a3; }

.node-warning { border-color: rgba(244, 185, 66, 0.6); }
.node-warning .node-dot { color: #f4b942; background: #f4b942; }
.node-warning .node-label strong { color: #ffd56a; }

.node-offline { border-color: rgba(248, 113, 113, 0.7); }
.node-offline .node-dot { color: #f87171; background: #f87171; }
.node-offline .node-label strong { color: #ff9d9d; }

.node-unknown { border-color: rgba(139, 155, 182, 0.7); }
.node-unknown .node-dot { color: #8b9bb6; background: #8b9bb6; }
.node-unknown .node-label strong { color: #c4cfe3; }

.node-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 130px;
  max-width: 180px;
}

.node-label strong {
  font-size: 0.75rem;
  line-height: 1.15;
}

.node-label small {
  font-size: 0.62rem;
  color: var(--htb-text-muted);
  white-space: nowrap;
}

/* ==========================================================================
   9. PAGINACIÓN
   ========================================================================== */
.pagination-htb .page-link {
  background-color: var(--htb-surface);
  border-color: var(--htb-border);
  color: #a4b1cd;
  font-family: var(--htb-font-mono);
}

.pagination-htb .page-link:hover {
  background-color: var(--htb-surface-hover);
  color: var(--htb-green);
  border-color: var(--htb-green);
}

.pagination-htb .page-item.active .page-link {
  background-color: var(--htb-green);
  border-color: var(--htb-green);
  color: #000000;
  font-weight: bold;
}

.pagination-htb .page-item.disabled .page-link {
  background-color: var(--htb-bg);
  border-color: var(--htb-border);
  color: #495057;
}

/* ==========================================================================
   8. BADGES, TEXTOS Y ANIMACIONES UTILITARIAS
   ========================================================================== */
.text-htb-green { color: var(--htb-green) !important; }
.text-htb-blue { color: var(--htb-blue) !important; }
.text-htb-yellow { color: var(--htb-yellow) !important; }
.text-htb-mono { font-family: var(--htb-font-mono); }

.badge-htb-active {
  background-color: rgba(159, 239, 0, 0.1);
  color: var(--htb-green);
  border: 1px solid rgba(159, 239, 0, 0.3);
  font-family: var(--htb-font-mono);
}

.badge-htb-port {
  background-color: rgba(13, 202, 240, 0.1);
  color: var(--htb-blue);
  border: 1px solid rgba(13, 202, 240, 0.3);
  font-family: var(--htb-font-mono);
}

.radar-pulse {
  width: 8px;
  height: 8px;
  background-color: var(--htb-green);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 rgba(159, 239, 0, 0.4);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(159, 239, 0, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(159, 239, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(159, 239, 0, 0); }
}