/* ==========================================================================
   SISTEMA DE CARGA DE FUENTES BI - BANMÉDICA
   Estilos Corporativos Modernos con Glassmorphism y Paleta Salud/BI
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #0066cc;
  --primary-hover: #0052a3;
  --primary-dark: #003366;
  --primary-light: #e6f0fa;
  --secondary: #00a88f;
  --secondary-hover: #008f7a;
  --accent: #6366f1;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #0ea5e9;
  
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  --card-bg: rgba(255, 255, 255, 0.98);
  --card-border: rgba(226, 232, 240, 0.8);
  --text-main: #1e293b;
  --text-muted: #64748b;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 20px rgba(0, 102, 204, 0.25);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 13.5px; /* Escala compacta profesional para pantallas 1080p y portatiles */
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f8fafc;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   LOGIN PAGE & HERO BACKGROUND
   ========================================================================== */
.auth-body {
  background: var(--bg-gradient);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
}

.auth-body::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0, 102, 204, 0.15) 0%, rgba(0, 168, 143, 0.05) 50%, transparent 70%);
  top: -150px;
  right: -150px;
  border-radius: 50%;
  pointer-events: none;
}

.auth-body::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
  bottom: -100px;
  left: -100px;
  border-radius: 50%;
  pointer-events: none;
}

.auth-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 460px;
  padding: 36px 28px;
  z-index: 10;
  margin: auto 0;
  animation: slideUp 0.4s ease-out;
}

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

.brand-header {
  text-align: center;
  margin-bottom: 28px;
}

.brand-logo-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 26px;
  box-shadow: var(--shadow-glow);
  margin-bottom: 12px;
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================================================
   FORMS & INPUTS
   ========================================================================== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  background-color: #ffffff;
  color: var(--text-main);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.btn-primary {
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 102, 204, 0.3);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================================
   MFA & TOTP MODAL STYLES
   ========================================================================== */
.mfa-box {
  background: #f1f5f9;
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  margin-bottom: 20px;
  border: 1px dashed #cbd5e1;
}

.mfa-qr-container {
  background: white;
  padding: 12px;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin: 12px 0;
  box-shadow: var(--shadow-sm);
}

.mfa-secret-code {
  font-family: monospace;
  background: #e2e8f0;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 2px;
  word-break: break-all;
  display: inline-block;
  margin-top: 6px;
}

.otp-inputs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 16px 0;
}

.otp-digit {
  width: 48px;
  height: 54px;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-md);
  background: white;
  transition: var(--transition);
}

.otp-digit:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
  outline: none;
}

/* ==========================================================================
   DASHBOARD & NAVBAR
   ========================================================================== */
.navbar-custom {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-user-badge {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.nav-user-area-tag {
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.btn-outline-logout {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #64748b;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-outline-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: #fef2f2;
}

/* ==========================================================================
   BANNER HERO
   ========================================================================== */
.hero-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: white;
  padding: 16px 22px;
  border-radius: var(--radius-sm);
  margin: 0 0 14px 0;
  max-width: 100%;
  width: 100%;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: 'BI';
  position: absolute;
  right: -10px;
  bottom: -20px;
  font-size: 80px;
  font-weight: 900;
  opacity: 0.03;
  color: white;
  pointer-events: none;
}

.hero-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.hero-subtitle {
  color: #94a3b8;
  font-size: 0.78rem;
  margin-top: 3px;
  max-width: 650px;
  line-height: 1.35;
}

/* ==========================================================================
   TABLE CATALOG CARDS
   ========================================================================== */
.container-dashboard {
  max-width: 100%;
  width: 100%;
  margin: 0 auto 20px auto;
  flex: 1;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.table-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 12px 15px;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.table-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.table-card-header {
  margin-bottom: 8px;
}

.table-card-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 4px;
}

.table-card-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
}

.table-card-name {
  font-size: 0.74rem;
  font-family: monospace;
  color: var(--text-muted);
  margin-top: 2px;
  background: #f8fafc;
  padding: 1px 5px;
  border-radius: 4px;
  display: inline-block;
}

.table-card-footer {
  margin-top: 12px;
  display: flex;
  gap: 6px;
}

.btn-upload-trigger {
  flex: 1;
  padding: 6px 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-upload-trigger:hover {
  background: var(--primary-hover);
}

.btn-history-trigger {
  padding: 6px 9px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-history-trigger:hover {
  background: #e2e8f0;
  color: #1e293b;
}

/* ==========================================================================
   MODAL & OVERLAY
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

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

.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
  animation: scaleUp 0.25s ease-out;
}

.modal-card-lg {
  max-width: 1100px;
}

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

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #0f172a;
}

.btn-modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.btn-modal-close:hover {
  color: #0f172a;
}

/* ==========================================================================
   DRAG & DROP UPLOAD ZONE
   ========================================================================== */
.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 36px 20px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 20px;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.dropzone-icon {
  font-size: 40px;
  color: var(--primary);
  margin-bottom: 12px;
}

.dropzone-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
}

.dropzone-subtext {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 4px;
}

/* ==========================================================================
   DATA TABLE & PREVIEW
   ========================================================================== */
.table-preview-wrapper {
  max-height: 400px;
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  margin: 16px 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  background: #0f172a;
  color: white;
  padding: 10px 14px;
  text-align: left;
  position: sticky;
  top: 0;
  font-weight: 600;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
}

.data-table tr:hover {
  background-color: #f8fafc;
}

/* ==========================================================================
   ALERTS, TOASTS & BADGES
   ========================================================================== */
.alert-box {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.alert-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

/* ==========================================================================
   PROGRESS BAR
   ========================================================================== */
.progress-container {
  margin: 20px 0;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer-custom {
  margin-top: auto;
  background: white;
  border-top: 1px solid #e2e8f0;
  padding: 16px 24px;
  text-align: center;
  font-size: 0.84rem;
  color: #64748b;
}

/* Animación de latido suave para el corazón en el footer */
.heart-pulse {
  display: inline-block;
  color: #ef4444;
  animation: heartPulse 1.35s ease-in-out infinite;
  transform-origin: center;
  vertical-align: -1px;
  margin: 0 3px;
  font-size: 1rem;
}

@keyframes heartPulse {
  0% {
    transform: scale(1);
  }
  14% {
    transform: scale(1.3);
  }
  28% {
    transform: scale(1);
  }
  42% {
    transform: scale(1.22);
  }
  70% {
    transform: scale(1);
  }
}

/* ==========================================================================
   ADMIN PANEL & CODE EDITOR STYLES
   ========================================================================== */
.btn-admin-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
  border: 1px solid #475569;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-admin-nav:hover {
  background: #0f172a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.modal-card-xl {
  max-width: 1080px;
  width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 20px;
}

.admin-tab-btn {
  background: none;
  border: none;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.admin-tab-btn.active {
  color: var(--primary);
}

.admin-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

.admin-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding-right: 4px;
}

.admin-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 768px) {
  .admin-grid-2col {
    grid-template-columns: 1fr;
  }
}

.form-group-admin {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label-admin {
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control-admin {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: #1e293b;
  background: white;
  transition: var(--transition);
}

.form-control-admin:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

/* Comparador de Columnas */
.comparator-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 14px;
}

.comparator-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.column-chip {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chip-matched {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.chip-missing {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.chip-extra {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Editor de Código Python */
.code-editor-wrapper {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.code-editor-header {
  background: #1e293b;
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #334155;
}

.code-editor-title {
  font-size: 0.8rem;
  color: #94a3b8;
  font-family: 'SFMono-Regular', Consolas, monospace;
  display: flex;
  align-items: center;
  gap: 6px;
}

.code-editor-actions {
  display: flex;
  gap: 8px;
}

.btn-editor-action {
  background: #334155;
  color: #e2e8f0;
  border: 1px solid #475569;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-editor-action:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.code-textarea {
  width: 100%;
  height: 240px;
  background: #0f172a;
  color: #f1f5f9;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  padding: 12px 16px;
  border: none;
  resize: vertical;
  tab-size: 4;
}

.code-textarea:focus {
  outline: none;
}

/* Consola de Output de Pruebas */
.test-console-box {
  background: #020617;
  color: #38bdf8;
  border: 1px solid #1e293b;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.8rem;
  max-height: 120px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ==========================================================================
   DASHBOARD SIDEBAR & FULL VIEW LAYOUT
   ========================================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background-color: #f8fafc;
}

.app-sidebar {
  width: 215px;
  background: #0f172a;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 300;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.12);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.95);
}

.sidebar-logo-container {
  width: 42px;
  height: 42px;
  background: #ffffff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.sidebar-logo-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.sidebar-logo-icon {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.sidebar-brand-title {
  font-size: 0.96rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.sidebar-brand-subtitle {
  font-size: 0.68rem;
  color: #38bdf8;
  font-weight: 600;
  letter-spacing: 0.02em;
}

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

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.nav-category {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #64748b;
  padding: 10px 8px 3px 8px;
  letter-spacing: 0.08em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  text-decoration: none;
  user-select: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(0, 102, 204, 0.9) 0%, rgba(0, 168, 143, 0.8) 100%);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3);
  border-color: rgba(255, 255, 255, 0.15);
}

.nav-item-icon {
  font-size: 0.92rem;
  width: 18px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 8px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 15, 29, 0.7);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.72rem;
  color: white;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.76rem;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.64rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 3px;
}

.btn-sidebar-logout {
  width: 100%;
  padding: 5px 8px;
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: var(--transition);
}

.btn-sidebar-logout:hover {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

/* Main Content Area */
.app-main-content {
  margin-left: 215px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #f8fafc;
}

.top-header {
  height: 44px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.top-header-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-header-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-container {
  flex: 1;
  padding: 14px 18px 28px 18px;
  max-width: 100%;
  width: 100%;
  margin: 0;
  display: none;
}

.view-container.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

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

.view-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.view-subtitle {
  font-size: 0.76rem;
  color: #64748b;
  margin-top: 2px;
}

.view-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

.view-card-header {
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.view-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
}

@media (max-width: 1024px) {
  .app-sidebar {
    width: 190px;
  }
  .app-main-content {
    margin-left: 190px;
  }
  .view-container {
    padding: 12px 14px 24px 14px;
  }
  .top-header {
    padding: 0 14px;
  }
}

/* ==========================================================================
   PASSWORD FIELD WITH TOGGLE EYE & CHARACTER COUNTER
   ========================================================================== */
.password-field-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-field-wrapper input.form-control,
.password-field-wrapper input.form-control-admin {
  padding-right: 42px !important;
}

.btn-toggle-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
  z-index: 2;
}

.btn-toggle-eye:hover {
  color: var(--primary);
  background: rgba(0, 102, 204, 0.08);
}

.btn-toggle-eye:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
}

.password-counter-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  margin-top: 4px;
}

.password-counter-badge.short {
  background: #fee2e2;
  color: #b91c1c;
}

.password-counter-badge.progress {
  background: #fef3c7;
  color: #b45309;
}

.password-counter-badge.ready {
  background: #dcfce7;
  color: #15803d;
}

.password-match-badge {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  margin-top: 4px;
  transition: all 0.2s ease;
}

.password-match-badge.mismatch {
  color: #dc2626;
}

.password-match-badge.match {
  color: #16a34a;
}

/* ==========================================================================
   DOWNLOAD OVERLAY LOADER (CDC - CLC)
   ========================================================================== */
.download-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.90);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: downloadFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: all;
  user-select: none;
}

@keyframes downloadFadeIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.download-card {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.75), 0 0 35px rgba(2, 132, 199, 0.25);
  border-radius: 20px;
  padding: 32px 36px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.download-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0284c7, #0d9488, #0284c7);
  background-size: 200% 100%;
  animation: downloadBarShimmer 2s linear infinite;
}

@keyframes downloadBarShimmer {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

.download-logo-box {
  background: #ffffff;
  border-radius: 14px;
  padding: 12px 24px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  animation: logoPulseAura 3s ease-in-out infinite;
}

@keyframes logoPulseAura {
  0%, 100% {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 15px rgba(2, 132, 199, 0.2);
  }
  50% {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 30px rgba(13, 148, 136, 0.4);
  }
}

.download-logo-img {
  max-width: 240px;
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.download-spinner-container {
  margin: 8px 0 16px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.download-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: #0284c7;
  border-right-color: #0d9488;
  border-radius: 50%;
  animation: downloadSpin 0.85s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
}

@keyframes downloadSpin {
  to { transform: rotate(360deg); }
}

.download-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f8fafc;
  margin: 0 0 6px 0;
  letter-spacing: -0.2px;
}

.download-status {
  font-size: 0.88rem;
  color: #94a3b8;
  margin: 0 0 16px 0;
  min-height: 22px;
  transition: all 0.2s ease;
}

.download-tips {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 12px;
}

.download-badge {
  background: rgba(2, 132, 199, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.download-subtext {
  font-size: 0.75rem;
  color: #64748b;
  margin: 0;
}

/* ==========================================================================
   DATATABLE MODAL & RECORD VIEWER (1000 ROWS + LIVE FILTER)
   ========================================================================== */
.badge-record-counter {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  border-radius: 9999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-record-limit {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  padding: 3px 10px;
  font-size: 0.76rem;
  font-weight: 600;
}

.datatable-interactive {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.84rem;
}

.datatable-interactive th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #1e293b;
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 2px solid #cbd5e1;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background 0.15s ease;
  z-index: 5;
}

.datatable-interactive th:hover {
  background: #e2e8f0;
  color: #0284c7;
}

.datatable-interactive th .sort-icon {
  margin-left: 5px;
  font-size: 0.75rem;
  color: #94a3b8;
}

.datatable-interactive th.sorted-asc .sort-icon,
.datatable-interactive th.sorted-desc .sort-icon {
  color: #0284c7;
  font-weight: bold;
}

.datatable-interactive td {
  padding: 9px 14px;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #334155;
}

.datatable-interactive tr:hover td {
  background-color: #f8fafc;
}

.btn-page-item {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-page-item:hover:not(:disabled) {
  border-color: #0284c7;
  color: #0284c7;
  background: #f0f9ff;
}

.btn-page-item.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.btn-page-item:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}




