/* ============================================================
   ALR SaaS — Core Premium Styling System (v1.0.0-PROD)
   ============================================================ */

/* 🌌 DESIGN TOKENS & HSL CURATED COLOR PALETTE */
:root {
  --bg-space: #030509;
  --bg-card: rgba(10, 15, 30, 0.5);
  --bg-sidebar: rgba(4, 6, 12, 0.85);
  --border-glass: rgba(255, 255, 255, 0.05);
  --border-active: rgba(0, 229, 255, 0.3);
  
  --accent: #00e5ff;
  --accent-glow: rgba(0, 229, 255, 0.25);
  --accent-secondary: #c084fc;
  
  --text-white: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.5);
  --text-dimmed: rgba(255, 255, 255, 0.25);
  
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

/* 🌀 GLOBAL STYLING & CORE SCROLLBARS */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-space);
  color: var(--text-white);
  font-family: var(--font-display);
  overflow-x: hidden;
  min-height: 100vh;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.custom-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.custom-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.01);
}
.custom-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}
.custom-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* 🖼️ LAYOUT & STRUCTURAL GRID */
#app-root {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* 🎛️ SIDEBAR NAVIGATOR */
.saas-sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  backdrop-filter: blur(40px);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-header {
  padding: 30px 24px;
  border-bottom: 1px solid var(--border-glass);
}

.brand-title {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--text-white);
  text-transform: uppercase;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-title span {
  color: var(--accent);
  text-shadow: 0 0 15px var(--accent-glow);
}

.brand-subtitle {
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 5px;
  text-transform: uppercase;
  margin-top: 4px;
  opacity: 0.4;
}

.sidebar-nav {
  flex: 1;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.nav-section {
  font-size: 8px;
  font-weight: 900;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  padding: 12px 12px 6px;
  opacity: 0.3;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
  cursor: pointer;
}

.nav-item i {
  font-size: 18px;
  opacity: 0.7;
}

.nav-item:hover {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
  color: var(--text-white);
  background: rgba(0, 229, 255, 0.05);
  border-color: var(--border-active);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.05);
}

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-glass);
}

/* 🚀 MAIN CONTENT & CONTAINER */
.saas-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.saas-header {
  height: 80px;
  border-bottom: 1px solid var(--border-glass);
  background: rgba(3, 5, 9, 0.3);
  backdrop-filter: blur(20px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  position: sticky;
  top: 0;
  z-index: 90;
}

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

.header-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: pulse 2s infinite;
}

.header-status-text {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--success);
  text-transform: uppercase;
}

.saas-main {
  padding: 40px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

/* 🖼️ GLASS PANELS & DYNAMIC CARDS */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 32px;
  padding: 30px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s ease;
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.08);
}

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

.metric-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: start;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.metric-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-active);
  box-shadow: 0 10px 30px rgba(0, 229, 255, 0.04);
}

.metric-title {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.metric-value {
  font-size: 32px;
  font-weight: 900;
  color: var(--text-white);
  margin-top: 8px;
  letter-spacing: -1px;
}

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-muted);
  border: 1px solid var(--border-glass);
  transition: all 0.3s;
}

.metric-card:hover .metric-icon {
  background: rgba(0, 229, 255, 0.1);
  color: var(--accent);
  border-color: var(--border-active);
}

/* 💻 FORMS, INPUTS & COMPONENT PRESETS */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 9px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  height: 52px;
  padding: 0 20px;
  color: var(--text-white);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: all 0.3s ease;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 15px var(--accent-glow);
  background: rgba(0, 0, 0, 0.5);
}

textarea.form-input {
  height: 120px;
  padding: 16px 20px;
  resize: none;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 30px;
  border-radius: 16px;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  outline: none;
  border: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary {
  background: var(--accent);
  color: #000;
  box-shadow: 0 10px 25px var(--accent-glow);
}

.btn-primary:hover {
  transform: scale(1.02);
  box-shadow: 0 15px 35px var(--accent-glow);
}

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

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

.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
}

/* 👥 TABLE & SYSTEM VIEWS */
.saas-view {
  display: none;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.saas-view.active {
  display: block;
}

.view-header {
  margin-bottom: 35px;
  display: flex;
  justify-content: space-between;
  align-items: end;
}

.view-title {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -1px;
  text-transform: uppercase;
  font-style: italic;
}

.view-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 4px;
}

.saas-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.saas-table th {
  padding: 16px 24px;
  font-size: 9px;
  font-weight: 900;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-glass);
}

.saas-table td {
  padding: 20px 24px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-glass);
  color: var(--text-white);
}

.saas-table tr:last-child td {
  border-bottom: none;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.active {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-badge.suspended {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* 🌌 INTERFACE WIDGETS & TOAST */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 20000; /* Asegurar que se muestre por encima del modal overlay */
  background: rgba(10, 15, 25, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  transform: translateY(100px) scale(0.9);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000; /* Modal por encima del contenido principal */
  background: rgba(3, 5, 8, 0.85);
  backdrop-filter: blur(25px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s ease;
  overflow-y: auto; /* Permitir scroll vertical si el contenido supera la pantalla */
  padding: 20px; /* Espaciado para pantallas pequeñas */
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 40px;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 30px 100px rgba(0,0,0,0.8);
  transform: scale(0.9) translateY(40px);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: calc(100vh - 40px); /* Evitar que la tarjeta supere el viewport */
  overflow-y: auto; /* Scroll dentro de la tarjeta como alternativa */
}

.modal-overlay.active .modal-box {
  transform: scale(1) translateY(0);
}

/* 🎥 ANIMATIONS PRESETS */
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.6; box-shadow: 0 0 15px var(--success); }
}

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

/* 🖨️ HIGH-FIDELITY PRINT-OPTIMIZED STYLES FOR ERP REPORTS */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12px !important;
  }
  
  .saas-sidebar, 
  .saas-header, 
  .btn, 
  #erp-sim-multiplier, 
  #erp-sim-scale-label, 
  .metric-icon,
  .modal-overlay,
  .toast {
    display: none !important;
  }
  
  .saas-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }
  
  .saas-main {
    padding: 0 !important;
    max-width: 100% !important;
  }
  
  .glass-panel {
    background: none !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: none !important;
    color: #000000 !important;
    padding: 20px !important;
    margin-bottom: 24px !important;
    border-radius: 12px !important;
  }
  
  .metric-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 12px !important;
    margin-bottom: 24px !important;
  }
  
  .metric-card {
    border: 1px solid #e2e8f0 !important;
    background: none !important;
    color: #000000 !important;
    box-shadow: none !important;
    padding: 12px !important;
  }
  
  .metric-value, 
  .metric-title {
    color: #000000 !important;
  }
  
  .saas-table th {
    border-bottom: 2px solid #000000 !important;
    color: #000000 !important;
    padding: 8px 12px !important;
    font-weight: 800 !important;
  }
  
  .saas-table td {
    border-bottom: 1px solid #e2e8f0 !important;
    color: #000000 !important;
    padding: 10px 12px !important;
  }
  
  .status-badge {
    background: none !important;
    border: 1px solid #000000 !important;
    color: #000000 !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
  }
}

/* ==================== SWITCHO DEL DESPACHADOR Y CONFIGURACION ==================== */
.switch-toggle input:checked + .switch-slider {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
}

.switch-toggle input:checked + .switch-slider .switch-knob {
  left: 16px !important;
  background: #030509 !important;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* ==================== PREVENCIÓN DE SELECCIÓN DE TEXTO CRÍTICO ==================== */
.form-input, 
input[type="password"], 
textarea, 
.logs-container, 
#logs-container,
.ledger-row,
.system-ledger,
.license-card,
.modal-body {
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
}

/* ==================== MÓDULO DE GESTIÓN DE DISCO Y LIMPIEZA ==================== */
.inactive-project-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.inactive-project-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(0, 229, 255, 0.25);
  box-shadow: 0 8px 20px rgba(0, 229, 255, 0.05);
}

.inactive-project-card.status-paused {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.02);
}

.inactive-project-card.status-production {
  border-color: rgba(212, 175, 55, 0.4);
  background: rgba(212, 175, 55, 0.02);
  box-shadow: inset 0 0 15px rgba(212, 175, 55, 0.05);
}

.inactive-project-card.status-production:hover {
  border-color: rgba(212, 175, 55, 0.8);
  box-shadow: 0 8px 25px rgba(212, 175, 55, 0.15);
}

.project-info-side {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-name-txt {
  font-size: 13px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.2px;
}

.project-meta-txt {
  font-size: 10px;
  opacity: 0.5;
  font-weight: 600;
}

.project-inactivity-badge {
  font-size: 8px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  margin-left: 8px;
  display: inline-block;
}

.badge-alert {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.badge-warn {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #f59e0b;
}

.project-action-side {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cleanup-select-state {
  height: 32px;
  font-size: 10px;
  background: #000;
  color: #fff;
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 0 8px;
  font-weight: 800;
  outline: none;
  cursor: pointer;
  transition: all 0.3s;
}

.cleanup-select-state:hover {
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-icon-danger {
  height: 32px;
  width: 32px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.05);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-icon-danger:hover {
  background: var(--danger);
  color: #000;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

/* Caja Fuerte locked states */
.btn-icon-locked {
  height: 32px;
  width: 32px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  background: rgba(212, 175, 55, 0.08);
  color: #d4af37;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: not-allowed;
  transition: all 0.3s;
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.1);
}

.badge-production {
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: #d4af37;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.1);
}

/* 🛡️ Semaphored Backup Warning Animations */
@keyframes pulse-red-glow {
  0%, 100% {
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.05);
  }
  50% {
    box-shadow: 0 0 18px rgba(239, 68, 68, 0.6);
    border-color: rgba(239, 68, 68, 0.8);
    background: rgba(239, 68, 68, 0.12);
  }
}
@keyframes pulse-yellow-glow {
  0%, 100% {
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.04);
  }
  50% {
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.45);
    border-color: rgba(245, 158, 11, 0.65);
    background: rgba(245, 158, 11, 0.08);
  }
}
@keyframes pulse-green-glow {
  0%, 100% {
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.25);
    background: rgba(16, 185, 129, 0.03);
  }
  50% {
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.06);
  }
}

.backup-pulse-red {
  animation: pulse-red-glow 2s infinite ease-in-out;
}
.backup-pulse-yellow {
  animation: pulse-yellow-glow 2.5s infinite ease-in-out;
}
.backup-pulse-green {
  animation: pulse-green-glow 3s infinite ease-in-out;
}


