/* ==========================================================================
   🎨 VPS SENTINEL - PREMIUM GLASSMORPHISM DESIGN SYSTEM (TRUE DARK MODE)
   ========================================================================== */

:root {
  /* Paleta de Colores de Fondo */
  --bg-color: #050508;
  --bg-gradient: radial-gradient(circle at top, #0f101b 0%, #050508 100%);
  --bg-card: rgba(10, 12, 22, 0.45);
  --bg-card-hover: rgba(20, 24, 44, 0.6);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(255, 255, 255, 0.15);
  
  /* Tipografías y Colores de Texto */
  --text-main: #e2e8f0;
  --text-title: #ffffff;
  --text-muted: #64748b;
  
  /* Tonos Neón de Cristal Líquido (Acentos LED) */
  --color-blue: #3b82f6;
  --color-blue-rgb: 59, 130, 246;
  
  --color-green: #10b981;
  --color-green-rgb: 16, 185, 129;
  
  --color-cyan: #06b6d4;
  --color-cyan-rgb: 6, 182, 212;
  
  --color-magenta: #ec4899;
  --color-magenta-rgb: 236, 72, 153;
  
  --color-red: #ef4444;
  --color-red-rgb: 239, 68, 68;
  
  --color-orange: #f97316;
  --color-orange-rgb: 249, 115, 22;
  
  /* Fuentes */
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-tech: 'Orbitron', monospace;
}

/* ==========================================================================
   🧱 ESTRUCTURA BASE Y REGLAS WEB-TO-APP (NATIVA)
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* Deshabilitar selección de texto azul en la interfaz para simular app nativa */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  font-family: var(--font-main);
  overflow: hidden; /* Evita scrolls raros en el cuerpo, el scroll se maneja dentro de paneles */
  height: 100vh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ocultar elementos de SEO de manera elegante */
.seo-title {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Gestión Premium de Scrollbars (Ocultas pero funcionales, o súper finas) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Permitir selección de texto SOLO dentro de terminales o bloques de código */
.terminal-output, .form-group input, .font-digital {
  -webkit-user-select: text;
  user-select: text;
}

/* ==========================================================================
   ✨ UTILERÍAS Y GLASSMORPHISM ESTÁNDAR
   ========================================================================== */

.glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05), 
              0 8px 32px 0 rgba(0, 0, 0, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: var(--bg-card-hover);
}

/* Tipografía Tecnológica Digital */
.font-digital {
  font-family: var(--font-tech);
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   🟢 INDICADORES LED DE CRISTAL LÍQUIDO (LIQUID CRYSTAL)
   ========================================================================== */

.led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.led-blue {
  background-color: var(--color-blue);
  box-shadow: 0 0 8px var(--color-blue);
}

.led-blink {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
}

.led-blink.online {
  background-color: var(--color-green);
  box-shadow: 0 0 10px var(--color-green);
  animation: pulse-green 2s infinite alternate;
}

.led-blink.offline {
  background-color: var(--color-red);
  box-shadow: 0 0 10px var(--color-red);
  animation: pulse-red 1.5s infinite alternate;
}

.led-blink.loading {
  background-color: var(--color-cyan);
  box-shadow: 0 0 10px var(--color-cyan);
  animation: pulse-cyan 1s infinite alternate;
}

/* Brillos e Iconos LED */
.glow-blue {
  text-shadow: 0 0 12px rgba(var(--color-blue-rgb), 0.6);
  color: var(--color-blue);
}
.glow-green {
  text-shadow: 0 0 12px rgba(var(--color-green-rgb), 0.6);
  color: var(--color-green);
}
.glow-cyan {
  text-shadow: 0 0 12px rgba(var(--color-cyan-rgb), 0.6);
  color: var(--color-cyan);
}
.glow-magenta {
  text-shadow: 0 0 12px rgba(var(--color-magenta-rgb), 0.6);
  color: var(--color-magenta);
}
.glow-red {
  text-shadow: 0 0 12px rgba(var(--color-red-rgb), 0.6);
  color: var(--color-red);
}

/* Bordes LED de Tarjetas */
.border-blue { border-left: 4px solid var(--color-blue); }
.border-green { border-left: 4px solid var(--color-green); }
.border-cyan { border-left: 4px solid var(--color-cyan); }
.border-magenta { border-left: 4px solid var(--color-magenta); }
.border-red { border-left: 4px solid var(--color-red); }

/* Animaciones */
@keyframes pulse-green {
  0% { box-shadow: 0 0 2px var(--color-green); opacity: 0.6; }
  100% { box-shadow: 0 0 14px var(--color-green); opacity: 1; }
}
@keyframes pulse-red {
  0% { box-shadow: 0 0 2px var(--color-red); opacity: 0.5; }
  100% { box-shadow: 0 0 16px var(--color-red); opacity: 1; }
}
@keyframes pulse-cyan {
  0% { box-shadow: 0 0 2px var(--color-cyan); opacity: 0.6; }
  100% { box-shadow: 0 0 12px var(--color-cyan); opacity: 1; }
}

/* ==========================================================================
   🔒 PANTALLA DE LOGIN
   ========================================================================== */

#app {
  width: 100vw;
  height: 100vh;
  position: relative;
}

.view {
  display: none !important;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  z-index: 1;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  animation: fadeIn 0.4s ease;
}

.view.active {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  z-index: 2;
}

#login-view {
  align-items: center;
  justify-content: center;
  background-image: radial-gradient(circle at center, #111326 0%, #030305 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  margin: 20px;
  border-radius: 24px;
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.logo-icon {
  font-size: 40px;
  margin-bottom: 12px;
  display: inline-block;
}

.login-header h2 {
  font-family: var(--font-tech);
  font-size: 24px;
  letter-spacing: 2px;
  color: var(--text-title);
  margin-bottom: 6px;
}

.login-header p {
  color: var(--text-muted);
  font-size: 13px;
}

/* Formularios Premium */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-title);
  font-size: 14px;
  transition: all 0.3s ease;
  outline: none;
}

.form-group input:focus {
  border-color: var(--color-blue);
  box-shadow: 0 0 10px rgba(var(--color-blue-rgb), 0.25);
  background: rgba(0, 0, 0, 0.5);
}

.error-text {
  color: var(--color-red);
  font-size: 12px;
  margin-top: -10px;
  margin-bottom: 15px;
  min-height: 18px;
  text-align: center;
}

/* Botones Premium */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--color-blue);
  color: #ffffff;
}

.btn-primary:hover {
  background: #2563eb;
  box-shadow: 0 0 18px rgba(var(--color-blue-rgb), 0.55);
}

.glow-button-blue {
  box-shadow: 0 0 10px rgba(var(--color-blue-rgb), 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon {
  background: transparent;
  color: var(--text-muted);
  padding: 8px;
  font-size: 18px;
}

.btn-icon:hover {
  color: var(--text-title);
  background: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   📊 VISTA DASHBOARD COMPLETO (SPA VIEW)
   ========================================================================== */

#dashboard-view {
  flex-direction: column;
}

.main-header {
  height: 70px;
  width: 100%;
  border-radius: 0;
  border-top: none;
  border-left: none;
  border-right: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 10;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-shield {
  font-size: 24px;
}

.header-logo h2 {
  font-family: var(--font-tech);
  font-size: 18px;
  letter-spacing: 2px;
  color: var(--text-title);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 16px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
}

.status-text {
  font-size: 12px;
  font-weight: 500;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 13px;
}

/* Cuerpo Principal */
.layout-body {
  display: flex;
  flex: 1;
  width: 100%;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  height: 100%;
  border-radius: 0;
  border-top: none;
  border-left: none;
  border-bottom: none;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
}

.sidebar-section h3 {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  margin-bottom: 12px;
  padding-left: 8px;
}

.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 12px;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: all 0.25s ease;
  font-weight: 500;
  font-size: 13px;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-title);
}

.menu-item.active {
  background: rgba(var(--color-blue-rgb), 0.15);
  border: 1px solid rgba(var(--color-blue-rgb), 0.25);
  color: var(--color-blue);
  text-shadow: 0 0 10px rgba(var(--color-blue-rgb), 0.35);
}

.menu-item.offline-server {
  border-left: 3px solid var(--color-red);
}

.loading-placeholder-menu {
  color: var(--text-muted);
  font-size: 12px;
  padding-left: 8px;
  font-style: italic;
}

/* Área de Contenido */
.content-area {
  flex: 1;
  height: 100%;
  padding: 24px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.1);
}

.subview {
  display: none !important;
  flex-direction: column;
  gap: 24px;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.25s ease;
  animation: fadeIn 0.3s ease;
}

.subview.active {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

/* ==========================================================================
   🎛️ SUB-VISTA: DASHBOARD GENERAL
   ========================================================================== */

/* Grid de Estadísticas */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  border-radius: 18px;
}

.stat-icon {
  font-size: 32px;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 24px;
  color: var(--text-title);
}

/* Diagnósticos de Salud y Alertas */
.overview-details {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .overview-details {
    grid-template-columns: 1fr;
  }
}

.chart-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.panel-header h3 {
  font-size: 15px;
  color: var(--text-title);
  font-weight: 600;
}

.panel-header .alert-count {
  font-size: 14px;
  background: rgba(var(--color-red-rgb), 0.2);
  color: var(--color-red);
  padding: 4px 10px;
  border-radius: 30px;
}

/* Gráficas Circulares SVG */
.radial-charts {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  padding: 10px 0;
}

.radial-chart-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.circular-chart {
  display: block;
  max-width: 140px;
  max-height: 140px;
}

.circle-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.03);
  stroke-width: 2.8;
}

.circle {
  fill: none;
  stroke-width: 2.8;
  stroke-linecap: round;
  transition: stroke-dasharray 0.8s ease-in-out;
}

.circular-chart.blue .circle { stroke: var(--color-blue); }
.circular-chart.cyan .circle { stroke: var(--color-cyan); }
.circular-chart.magenta .circle { stroke: var(--color-magenta); }

.percentage {
  fill: var(--text-title);
  font-size: 8px;
  text-anchor: middle;
}

.gauge-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

/* Panel de Alertas Críticas */
.alerts-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 350px;
}

.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex: 1;
}

.empty-alerts {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-green);
  font-size: 13px;
  text-align: center;
  font-weight: 500;
  background: rgba(var(--color-green-rgb), 0.05);
  border: 1px dashed rgba(var(--color-green-rgb), 0.2);
  border-radius: 12px;
  padding: 20px;
}

.alert-item {
  background: rgba(var(--color-red-rgb), 0.08);
  border: 1px solid rgba(var(--color-red-rgb), 0.2);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: slideIn 0.3s ease;
}

.alert-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.alert-title {
  font-weight: 600;
  font-size: 13px;
  color: #fca5a5;
}

.alert-subtitle {
  font-size: 11px;
  color: #fca5a5;
  opacity: 0.8;
}

.alert-vps-tag {
  font-size: 10px;
  font-family: var(--font-tech);
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   🖥️ SUB-VISTA: DESGLOSE POR VPS
   ========================================================================== */

.vps-header-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vps-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.vps-title-row h2 {
  font-family: var(--font-tech);
  font-size: 22px;
  color: var(--text-title);
  letter-spacing: 1.5px;
}

.vps-mini-metrics {
  display: flex;
  gap: 20px;
  margin-top: 12px;
}

.mini-metric {
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 12px;
}

.mini-metric span {
  color: var(--text-muted);
  margin-right: 6px;
}

.mini-metric strong {
  font-family: var(--font-tech);
  color: var(--color-blue);
}

/* Acordeón de Proyectos y Contenedores */
.projects-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.projects-section h3 {
  font-size: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.project-card {
  margin-bottom: 16px;
  overflow: hidden;
}

.project-card-header {
  padding: 18px 24px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.project-card-header h4 {
  font-size: 15px;
  color: var(--text-title);
  font-weight: 600;
}

.project-card-body {
  padding: 16px 20px;
}

/* Listado de Contenedores */
.containers-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.container-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  align-items: center;
  padding: 12px 18px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 13px;
  transition: all 0.25s ease;
}

.container-row:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.15);
}

.container-name-col {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  color: var(--text-title);
}

.container-type-col {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
}

.container-status-col {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 30px;
  font-size: 11px;
  font-weight: 600;
}

.status-badge.healthy {
  background: rgba(var(--color-green-rgb), 0.15);
  color: var(--color-green);
  border: 1px solid rgba(var(--color-green-rgb), 0.25);
}

.status-badge.unhealthy {
  background: rgba(var(--color-red-rgb), 0.15);
  color: var(--color-red);
  border: 1px solid rgba(var(--color-red-rgb), 0.25);
}

.status-badge.warning {
  background: rgba(var(--color-orange-rgb), 0.15);
  color: var(--color-orange);
  border: 1px solid rgba(var(--color-orange-rgb), 0.25);
}

.status-badge.unknown {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.container-actions-col {
  display: flex;
  justify-content: flex-end;
}

/* ==========================================================================
   📺 MODAL TERMINAL RETRO (VISOR DE LOGS)
   ========================================================================== */

.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-window {
  width: 100%;
  max-width: 800px;
  height: 80vh;
  display: flex;
  flex-direction: column;
  animation: modalScaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.modal-title h3 {
  font-size: 16px;
  color: var(--text-title);
  font-weight: 600;
}

.modal-title span {
  font-size: 11px;
}

.btn-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
}

.btn-close:hover {
  background: rgba(var(--color-red-rgb), 0.2);
  color: var(--color-red);
}

.modal-body {
  flex: 1;
  padding: 20px;
  overflow: hidden;
  display: flex;
}

.terminal-container {
  width: 100%;
  height: 100%;
  background: #010103;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.terminal-header {
  background: #0b0c16;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-dots .dot.red { background: #ff5f56; }
.terminal-dots .dot.yellow { background: #ffbd2e; }
.terminal-dots .dot.green { background: #27c93f; }

.terminal-title {
  font-family: var(--font-tech);
  font-size: 10px;
  color: var(--text-muted);
}

.terminal-output {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  color: #10b981; /* Texto verde terminal retro */
  text-shadow: 0 0 4px rgba(16, 185, 129, 0.4);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/* Custom Checkbox */
.checkbox-container {
  display: flex;
  align-items: center;
  position: relative;
  padding-left: 30px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-main);
  user-select: none;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 20px;
  width: 20px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: all 0.25s ease;
}

.checkbox-container:hover input ~ .checkmark {
  border-color: var(--color-blue);
}

.checkbox-container input:checked ~ .checkmark {
  background-color: var(--color-blue);
  border-color: var(--color-blue);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}

.checkbox-container .checkmark:after {
  left: 7px;
  top: 3px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ==========================================================================
   🔔 SISTEMA DE ALERTAS VISUALES EMERGENTES (TOASTS EN PANTALLA)
   ========================================================================== */

#toast-container {
  position: fixed;
  top: calc(70px + 20px); /* Justo debajo de la cabecera */
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1000;
  max-width: 360px;
  width: 100%;
}

.toast-alert {
  background: rgba(15, 7, 7, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(var(--color-red-rgb), 0.4);
  border-left: 6px solid var(--color-red);
  border-radius: 12px;
  padding: 16px;
  color: #fca5a5;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 
              inset 0 1px 1px rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 12px;
  position: relative;
  overflow: hidden;
  animation: toastSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 15px rgba(var(--color-red-rgb), 0.25);
}

.toast-alert::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background-color: var(--color-red);
  animation: toastProgress 6s linear forwards;
}

.toast-icon {
  font-size: 20px;
  animation: pulse-red-blink 1s infinite alternate;
}

.toast-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toast-title {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.toast-message {
  font-size: 12px;
  line-height: 1.4;
  opacity: 0.9;
}

.toast-close {
  background: transparent;
  border: none;
  color: #fca5a5;
  opacity: 0.6;
  font-size: 14px;
  cursor: pointer;
  align-self: flex-start;
}

.toast-close:hover {
  opacity: 1;
}

/* ==========================================================================
   🎬 ANIMACIONES DEL SISTEMA
   ========================================================================== */

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

@keyframes slideIn {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes modalScaleUp {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes toastSlideIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

@keyframes pulse-red-blink {
  0% { transform: scale(1); filter: drop-shadow(0 0 1px var(--color-red)); }
  100% { transform: scale(1.15); filter: drop-shadow(0 0 6px var(--color-red)); }
}

/* ==========================================================================
   📱 ADAPTACIONES PARA MÓVIL (NATIVAS RESPONSIVAS)
   ========================================================================== */

@media (max-width: 768px) {
  .layout-body {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
    flex-direction: row;
    overflow-x: auto;
    white-space: nowrap;
    gap: 16px;
  }

  .sidebar-section {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .sidebar-section h3 {
    display: none; /* Ocultamos los títulos de las secciones para ahorrar espacio en móvil */
  }

  .menu-item {
    display: inline-flex;
    width: auto;
    padding: 8px 14px;
  }

  .content-area {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .radial-charts {
    flex-direction: column;
    gap: 30px;
  }

  .container-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .container-type-col, .container-actions-col {
    grid-column: span 2;
    display: flex;
    justify-content: flex-start;
  }
  
  .container-actions-col {
    justify-content: flex-end;
    margin-top: 4px;
  }
  
  #toast-container {
    width: calc(100% - 40px);
    right: 20px;
    left: 20px;
  }
}

/* Custom size adjustment for the Change Password modal */
#password-modal .modal-window {
  height: auto !important;
  max-height: 90vh;
}

/* ==========================================================================
   👤 USER PROFILE & GLASSMORPHIC DROPDOWN MENU
   ========================================================================== */

.user-profile-container {
  position: relative;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 13px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.user-badge:hover, .user-badge:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(var(--color-blue-rgb), 0.4);
  box-shadow: 0 0 12px rgba(var(--color-blue-rgb), 0.2);
}

.chevron-icon {
  transition: transform 0.3s ease;
  color: var(--text-muted);
}

.user-badge:hover .chevron-icon {
  color: var(--text-title);
}

.user-profile-container.active .chevron-icon {
  transform: rotate(180deg);
  color: var(--color-blue);
}

/* Menú Desplegable Glassmorphic */
.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 220px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(10, 12, 22, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5),
              inset 0 1px 1px rgba(255, 255, 255, 0.05);
  transform: translateY(10px);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
}

.user-dropdown-menu.active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.dropdown-header {
  padding: 8px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-role {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--color-blue);
  text-shadow: 0 0 8px rgba(var(--color-blue-rgb), 0.4);
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-title);
}

.dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 8px 0;
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  outline: none;
}

.dropdown-item:hover, .dropdown-item:focus {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-title);
}

.dropdown-item-icon {
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.dropdown-item:hover .dropdown-item-icon, .dropdown-item:focus .dropdown-item-icon {
  color: var(--text-title);
}

.dropdown-item.logout-item:hover, .dropdown-item.logout-item:focus {
  background: rgba(var(--color-red-rgb), 0.1);
  color: #fca5a5;
}

.dropdown-item.logout-item:hover .dropdown-item-icon, .dropdown-item.logout-item:focus .dropdown-item-icon {
  color: var(--color-red);
  filter: drop-shadow(0 0 4px rgba(var(--color-red-rgb), 0.5));
}


