/* ==========================================================================
   INSTITUTO NEUMOLÓGICO DEL ORIENTE (INO) - UNIFIED DESIGN SYSTEM
   Paleta Médica Profesional Dark Slate • Tipografía Plus Jakarta Sans
   ========================================================================== */

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

:root {
  /* Surface & Backgrounds */
  --bg-main: #0b0f19;
  --bg-surface: #111a2e;
  --bg-card: #131d33;
  --bg-card-hover: #182542;
  --bg-input: #1a2744;
  --bg-input-focus: #1f2f52;
  --bg-glass: rgba(19, 29, 51, 0.85);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-card: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.2);
  --border-focus: #06b6d4;

  /* Brand Accents */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);

  --cyan: #06b6d4;
  --cyan-hover: #0891b2;
  --cyan-glow: rgba(6, 182, 212, 0.35);

  --emerald: #10b981;
  --emerald-hover: #059669;
  --emerald-glow: rgba(16, 185, 129, 0.3);

  --amber: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.3);

  --rose: #f43f5e;
  --rose-glow: rgba(244, 63, 94, 0.3);

  /* Typography Colors */
  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 40px -10px rgba(0, 0, 0, 0.6);
  --shadow-modal: 0 25px 60px -15px rgba(0, 0, 0, 0.8);

  /* Border Radii */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   RESET & BASE TYPOGRAPHY
   ========================================================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(6, 182, 212, 0.1) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #243356;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #334774;
}

.hidden { display: none !important; }

/* ==========================================================================
   UNIFIED APP HEADER NAVBAR (MASTER DEFINITION - 100% HOMOGENEOUS)
   ========================================================================== */
.app-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 100 !important;
  background: rgba(11, 17, 32, 0.95) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  padding: 0.75rem 1.5rem !important;
  width: 100% !important;
}

.header-container, .header-content {
  max-width: 1400px !important;
  margin: 0 auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 1.5rem !important;
  width: 100% !important;
}

.brand-logo, .brand-section {
  display: flex !important;
  align-items: center !important;
  gap: 0.85rem !important;
  text-decoration: none !important;
  color: var(--text-main) !important;
  flex-shrink: 0 !important;
}

.logo-icon {
  width: 38px !important;
  height: 38px !important;
  background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%) !important;
  border-radius: 9px !important;
  display: grid !important;
  place-content: center !important;
  font-size: 1.25rem !important;
  color: white !important;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.35) !important;
  flex-shrink: 0 !important;
}

.brand-text {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.15rem !important;
}

.brand-name, .brand-text h1 {
  font-size: 1rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
  color: #ffffff !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  margin: 0 !important;
  line-height: 1.2 !important;
}

.brand-sub, .brand-text p {
  font-size: 0.72rem !important;
  color: #94a3b8 !important;
  font-weight: 400 !important;
  margin: 0 !important;
  line-height: 1.2 !important;
}

/* Navigation Links */
.nav-links {
  display: flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
}

.nav-item {
  color: #94a3b8 !important;
  text-decoration: none !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  padding: 0.5rem 0.95rem !important;
  border-radius: 8px !important;
  border: 1px solid transparent !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  white-space: nowrap !important;
  background: transparent !important;
}

.nav-item:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.05) !important;
}

.nav-item.active {
  color: #ffffff !important;
  background: rgba(99, 102, 241, 0.18) !important;
  border: 1px solid rgba(99, 102, 241, 0.45) !important;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.22) !important;
  font-weight: 600 !important;
}

.header-actions {
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  flex-shrink: 0 !important;
}

/* User Profile Badge */
.user-profile-badge {
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.09) !important;
  padding: 0.35rem 0.85rem !important;
  border-radius: 9999px !important;
}

.user-avatar {
  width: 32px !important;
  height: 32px !important;
  background: linear-gradient(135deg, #0284c7, #38bdf8) !important;
  color: white !important;
  font-weight: 800 !important;
  border-radius: 50% !important;
  display: grid !important;
  place-content: center !important;
  font-size: 0.85rem !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4) !important;
  flex-shrink: 0 !important;
}

.user-meta {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.15rem !important;
}

.user-name {
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  max-width: 150px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  line-height: 1.2 !important;
}

.user-roles {
  display: flex !important;
  gap: 0.25rem !important;
}

.badge-role {
  font-size: 0.62rem !important;
  font-weight: 800 !important;
  padding: 0.12rem 0.45rem !important;
  border-radius: 4px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.25rem !important;
  line-height: 1.2 !important;
}

.badge-role.admin { background: rgba(239, 68, 68, 0.16) !important; color: #f87171 !important; border: 1px solid rgba(239, 68, 68, 0.3) !important; }
.badge-role.gestor { background: rgba(16, 185, 129, 0.16) !important; color: #34d399 !important; border: 1px solid rgba(16, 185, 129, 0.3) !important; }
.badge-role.educador { background: rgba(14, 165, 233, 0.16) !important; color: #38bdf8 !important; border: 1px solid rgba(14, 165, 233, 0.3) !important; }
.badge-role.auditor { background: rgba(245, 158, 11, 0.16) !important; color: #fbbf24 !important; border: 1px solid rgba(245, 158, 11, 0.3) !important; }

.btn-logout {
  background: transparent !important;
  border: none !important;
  color: #f87171 !important;
  cursor: pointer !important;
  padding: 0.3rem 0.45rem !important;
  font-size: 0.95rem !important;
  border-radius: 4px !important;
  transition: all 0.2s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.18) !important;
  color: #ef4444 !important;
  transform: scale(1.1) !important;
}

/* ==========================================================================
   UNIFIED HERO BANNER
   ========================================================================== */
.hero-banner {
  background: linear-gradient(135deg, rgba(19, 29, 51, 0.95), rgba(15, 23, 42, 0.98));
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.12), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-text {
  flex: 1;
  max-width: 800px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(6, 182, 212, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.hero-banner h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.hero-banner p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.hero-stats {
  display: flex;
  gap: 1rem;
  flex-shrink: 0;
}

.stat-card {
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid var(--border-card);
  padding: 1.1rem 1.4rem;
  border-radius: var(--radius-md);
  text-align: center;
  min-width: 120px;
  transition: var(--transition);
}

.stat-card:hover {
  background: rgba(11, 15, 25, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.stat-num {
  font-size: 1.7rem;
  font-weight: 800;
  color: #ffffff;
  display: block;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.2rem;
  display: block;
}

/* ==========================================================================
   UNIFIED BUTTONS
   ========================================================================== */
.btn {
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: var(--border-hover);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.btn-success {
  background: linear-gradient(135deg, var(--emerald), var(--emerald-hover));
  color: white;
  box-shadow: 0 4px 14px var(--emerald-glow);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fca5a5;
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.25);
  color: #ffffff;
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.78rem;
  border-radius: var(--radius-xs);
}

/* ==========================================================================
   UNIFIED FORM INPUTS
   ========================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  color: #ffffff;
  padding: 0.75rem 0.95rem;
  font-size: 0.88rem;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  background: var(--bg-input-focus);
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

.form-control::placeholder {
  color: var(--text-dim);
}

/* ==========================================================================
   UNIFIED MODALS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 650px;
  box-shadow: var(--shadow-modal);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.modal-title h3 {
  font-size: 1.18rem;
  font-weight: 800;
  color: #ffffff;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  transition: var(--transition);
}

.btn-close-modal:hover {
  color: #ffffff;
  transform: scale(1.1);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   UNIFIED TABLES & BADGES
   ========================================================================== */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

table th {
  background: rgba(11, 17, 32, 0.95);
  padding: 0.9rem 1.1rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-card);
}

table td {
  padding: 1rem 1.1rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.status-badge.enviado, .status-badge.success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.fallido, .status-badge.danger {
  background: rgba(244, 63, 94, 0.15);
  color: #f87171;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.status-badge.pendiente, .status-badge.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
