:root{
  --bg:#ffffff;
  --panel:#fefefe;
  --panel-2:#f1f5f9;
  --text:#0f172a;
  --muted:#64748b;
  --brand:#2563eb;
  --brand-light:#3b82f6;
  --accent:#111827;
  --danger:#ef4444;
  --border:#e1e7ef;
  --shadow-sm:0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md:0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --banner-image:none;
}
*{ box-sizing:border-box }
html,body{ height:100% }
body{
  margin:0; 
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, var(--panel-2) 0%, var(--border) 100%);
  color:var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.hidden{ display:none }

#app{ display:flex; flex-direction:column; min-height:100vh }

/* ===============================================
   HEADER MODERNO Y MINIMALISTA
   =============================================== */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  /* ✨ Transiciones suaves para show/hide */
  opacity: 1;
  transform: translateY(0);
  max-height: 100px;
  overflow: visible; /* Cambiar a visible para permitir dropdown */
}

.app-header.hidden {
  /* ✨ Animación elegante de salida */
  opacity: 0;
  transform: translateY(-100%);
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

.app-header:hover {
  box-shadow: 0 8px 32px rgba(var(--brand-rgb), 0.08);
}

/* Header Left - Logo Section */
.header-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo-section {
  display: flex;
  align-items: center;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(var(--brand-rgb), 0.05) 0%, rgba(var(--brand-light-rgb), 0.02) 100%);
  border: 1px solid rgba(var(--brand-rgb), 0.1);
  transition: all 0.3s ease;
}

.logo-container:hover {
  background: linear-gradient(135deg, rgba(var(--brand-rgb), 0.08) 0%, rgba(var(--brand-light-rgb), 0.04) 100%);
  border-color: rgba(var(--brand-rgb), 0.2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.logo-image {
  height: 32px;
  width: 32px;
  object-fit: contain;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-subtitle {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Navigation */
.main-navigation {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: center;
}

.nav-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-2);
  padding: 8px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.nav-item:hover::before {
  opacity: 0.08;
}

.nav-item.active {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  color: white;
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.nav-item.active::before {
  display: none;
}

.nav-item.active .nav-indicator {
  opacity: 1;
  transform: scale(1);
}

.nav-item-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.nav-icon {
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
  z-index: 1;
  position: relative;
}

.nav-text {
  z-index: 1;
  position: relative;
}

.nav-indicator {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s ease;
}

.coming-soon-badge {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: var(--shadow-sm);
  z-index: 1;
  position: relative;
}

/* Header Right - User Section */
.header-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.user-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.user-info:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(59, 130, 246, 0.02) 100%);
  border-color: var(--brand);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-email {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}

.user-role {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

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

.action-button {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.action-button:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: rgba(37, 99, 235, 0.05);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.action-button:active {
  transform: translateY(0);
}

.logout-button {
  background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
  color: white;
  border-color: var(--danger);
  gap: 8px;
  width: auto;
  padding: 0 16px;
}

.logout-button:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  border-color: #dc2626;
  color: white;
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

.logout-text {
  font-size: 0.875rem;
  font-weight: 600;
}

/* Notification Badge */
.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  border: 2px solid var(--panel);
  animation: pulse 2s infinite;
}

.notification-badge.hidden {
  display: none;
}

/* ===============================================
   HEADER RESPONSIVE
   =============================================== */

@media (max-width: 1200px) {
  .app-header {
    padding: 16px 24px;
  }
  
  .logo-container {
    gap: 12px;
    padding: 6px 12px;
  }
  
  .brand-name {
    font-size: 1.125rem;
  }
  
  .nav-item {
    padding: 10px 16px;
    gap: 10px;
  }
  
  .user-details {
    display: none; /* Ocultar detalles del usuario en pantallas medianas */
  }
}

@media (max-width: 960px) {
  .app-header {
    padding: 12px 20px;
    flex-wrap: wrap;
    gap: 16px;
  }
  
  .header-left,
  .header-right {
    flex: 1;
  }
  
  .main-navigation {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 12px;
  }
  
  .nav-wrapper {
    width: 100%;
    justify-content: center;
  }
  
  .logo-container {
    gap: 10px;
    padding: 4px 8px;
  }
  
  .brand-name {
    font-size: 1rem;
  }
  
  .brand-subtitle {
    font-size: 0.6875rem;
  }
  
  .nav-item {
    flex: 1;
    justify-content: center;
    padding: 8px 12px;
    font-size: 0.8125rem;
  }
  
  .nav-text {
    display: none; /* Solo mostrar íconos en móvil */
  }
  
  .coming-soon-badge {
    display: none;
  }
  
  .user-info {
    gap: 8px;
    padding: 6px 12px;
  }
  
  .user-avatar {
    width: 32px;
    height: 32px;
  }
  
  .action-button {
    width: 40px;
    height: 40px;
  }
  
  .logout-text {
    display: none; /* Solo mostrar ícono en móvil */
  }
  
  .logout-button {
    width: 40px;
    padding: 0;
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 10px 16px;
    gap: 12px;
  }
  
  .logo-container {
    gap: 8px;
    padding: 4px 6px;
    border-radius: 12px;
  }
  
  .brand-name {
    font-size: 0.9375rem;
  }
  
  .brand-subtitle {
    display: none;
  }
  
  .main-navigation {
    margin-top: 8px;
  }
  
  .nav-wrapper {
    padding: 6px;
    border-radius: 12px;
  }
  
  .nav-item {
    padding: 6px 10px;
    border-radius: 8px;
  }
  
  .nav-icon svg {
    width: 18px;
    height: 18px;
  }
  
  .user-info {
    padding: 4px 8px;
    gap: 6px;
  }
  
  .user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }
  
  .user-avatar svg {
    width: 16px;
    height: 16px;
  }
  
  .header-actions {
    gap: 6px;
  }
  
  .action-button {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
  
  .action-button svg {
    width: 16px;
    height: 16px;
  }
  
  .notification-badge {
    width: 16px;
    height: 16px;
    font-size: 0.5625rem;
    top: -2px;
    right: -2px;
  }
}

/* Navegación móvil con mejor UX */
@media (max-width: 480px) {
  .app-header {
    padding: 8px 12px;
  }
  
  .logo-image {
    height: 24px;
    width: 24px;
  }
  
  .brand-name {
    font-size: 0.875rem;
  }
  
  .nav-wrapper {
    gap: 4px;
    padding: 4px;
  }
  
  .nav-item {
    padding: 4px 8px;
    min-width: 44px; /* Área táctil mínima */
  }
}

/* ===============================================
   MENÚ DESPLEGABLE DE MÓDULOS
   =============================================== */

.dropdown-container {
  position: relative;
  display: flex;
  align-items: center;
  z-index: 1001; /* Mayor que el header para crear contexto de apilamiento */
}

.nav-dropdown-trigger {
  background: transparent !important;
  border: none !important;
  cursor: pointer;
  position: relative;
}

.nav-dropdown-trigger:hover::before {
  opacity: 0.08;
}

.nav-dropdown-trigger.active {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%) !important;
  color: white !important;
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.nav-dropdown-trigger.active::before {
  display: none;
}

.nav-dropdown-trigger.active .nav-indicator {
  opacity: 1;
  transform: scale(1);
}

.dropdown-arrow {
  display: flex;
  align-items: center;
  margin-left: 4px;
  transition: transform 0.2s ease;
  z-index: 1;
  position: relative;
}

.nav-dropdown-trigger.active .dropdown-arrow {
  transform: rotate(180deg);
}

/* Menú desplegable */
.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  min-width: 280px;
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9999; /* Z-index muy alto para estar por encima de todo */
  margin-top: 8px;
  padding: 8px;
  max-height: 0;
  overflow: hidden;
}

.nav-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  max-height: 400px;
}

/* Items del menú desplegable */
.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  margin-bottom: 4px;
}

.nav-dropdown-item:last-child {
  margin-bottom: 0;
}

.nav-dropdown-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.nav-dropdown-item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.nav-dropdown-item:hover::before {
  opacity: 0.08;
}

.nav-dropdown-item.active {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  color: white;
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

.nav-dropdown-item.active::before {
  display: none;
}

.nav-dropdown-item.nav-item-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.nav-dropdown-item .nav-icon {
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
  z-index: 1;
  position: relative;
}

.nav-dropdown-item .nav-text {
  z-index: 1;
  position: relative;
}

.nav-dropdown-item .coming-soon-badge {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: var(--shadow-sm);
  z-index: 1;
  position: relative;
  margin-left: auto;
}

/* Estados especiales para touch devices */
@media (pointer: coarse) {
  .nav-item,
  .nav-dropdown-trigger,
  .nav-dropdown-item,
  .action-button,
  .footer-nav-link {
    min-height: 44px; /* Área táctil recomendada */
    min-width: 44px;
  }
  
  .nav-item:hover,
  .nav-dropdown-trigger:hover,
  .nav-dropdown-item:hover,
  .action-button:hover {
    transform: none; /* Desactivar hover transforms en touch */
  }
  
  .nav-item:active,
  .nav-dropdown-trigger:active,
  .nav-dropdown-item:active,
  .action-button:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
  
  /* En touch devices, usar click en lugar de hover */
  .dropdown-container:focus-within .nav-dropdown,
  .nav-dropdown-trigger:focus + .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    max-height: 400px;
  }
}

.app-main{ 
  flex:1; 
  display:flex; 
  align-items: center;
  justify-content: center;
  padding:24px;
  min-height: 70vh;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ✨ Login fullscreen cuando header está oculto */
.app-header.hidden ~ .app-main {
  min-height: 100vh;
  padding-top: 20px;
}

/* App Outlet - Contenido principal del módulo */
#app-outlet {
  margin-top: 32px;
  margin-bottom: 32px;
  flex: 1;
}

/* App Outlet Responsive */
@media (max-width: 960px) {
  #app-outlet {
    margin-top: 24px;
    margin-bottom: 24px;
  }
}

@media (max-width: 640px) {
  #app-outlet {
    margin-top: 16px;
    margin-bottom: 16px;
  }
}

.card{
  width:100%; 
  max-width:420px; 
  margin:48px auto; 
  padding:32px; 
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
  border:1px solid var(--border); 
  border-radius:20px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ✨ Login card optimizada cuando header está oculto */
.app-header.hidden ~ .app-main .card {
  margin: 0 auto;
  transform: scale(1.02);
  box-shadow: 0 20px 40px rgba(var(--brand-rgb), 0.15);
}
.card h2{
  margin-top: 0;
  margin-bottom: 24px;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}
label{ 
  display:block; 
  font-size:14px; 
  color:var(--text); 
  font-weight: 500;
  margin:16px 0 6px;
}
input[type="email"], input[type="password"], input[type="text"]{
  width:100%; 
  padding:14px 16px; 
  border-radius:12px; 
  border:2px solid var(--border); 
  background:var(--panel-2); 
  color:var(--text);
  font-size: 16px;
  transition: all .2s ease;
  box-shadow: var(--shadow-sm);
}

/* Excepción para campos con clases específicas del livechat */
input[type="text"].modern-search,
input[type="text"].modern-select {
  padding: 14px 48px 14px 48px; /* Padding específico para íconos */
  font-size: 0.875rem;
}
input[type="email"]:focus, input[type="password"]:focus, input[type="text"]:focus{
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
  transform: translateY(-1px);
}
.btn{ 
  padding:14px 20px; 
  border-radius:12px; 
  border:2px solid var(--border); 
  color:var(--text); 
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
  cursor:pointer; 
  transition: all .2s ease;
  font-weight: 500;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.btn:active{ transform:translateY(2px) scale(0.98) }
.btn-primary{ 
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  color:#fff; 
  border-color:transparent; 
  box-shadow: var(--shadow-md);
  font-weight: 600;
}
.btn-primary:hover{
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.btn-secondary{ 
  background: linear-gradient(135deg, var(--panel-2) 0%, var(--border) 100%);
  border-color: var(--border);
}
.btn:hover{ 
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Animaciones mejoradas */
@keyframes fadeInUp {
  from { opacity:0; transform: translateY(8px); }
  to { opacity:1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity:0; transform: translateX(-20px); }
  to { opacity:1; transform: translateX(0); }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.conversation-item{ animation: fadeInUp .2s ease both }
.nav-link{ animation: slideIn .3s ease both }
.card{ animation: fadeInUp .4s ease both }
.error{ color:var(--danger); margin-top:8px; min-height:20px }

/* 🎯 Banner Premium - Optimizado para legibilidad de texto */
.banner{ 
  border-bottom:1px solid var(--border); 
  background: linear-gradient(
    135deg, 
    rgba(var(--brand-rgb),0.85) 0%,     /* Marca semi-transparente fuerte */
    rgba(var(--brand-light-rgb),0.75) 50%,   /* Gradiente medio */
    rgba(17,24,39,0.80) 100%     /* Gris oscuro para contraste */
  ), var(--banner-image); 
  background-size:cover; 
  background-position:center;
  position: relative;
  overflow: hidden;
  min-height: 60px;  /* Móvil mínimo */
  height: clamp(60px, 12vh, 120px); /* Responsive fluido */
}

/* Overlay adicional para máxima legibilidad */
.banner::before{
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.2); /* Sombra sutil para contraste */
  z-index: 1;
}

/* Shimmer effect sutil */
.banner::after{
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.08) 50%, transparent 70%);
  animation: shimmer 3s ease-in-out infinite;
  z-index: 1;
}

.banner-inner{ 
  padding:16px 24px; 
  position: relative; 
  z-index: 2; 
  display: flex;
  align-items: center;
  height: 100%;
}

/* Texto con máximo contraste y legibilidad */
.banner-text{ 
  color: #ffffff !important;           /* Blanco puro */
  font-weight: 600;                    /* Semi-bold */
  font-size: 1rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5); /* Sombra fuerte */
  letter-spacing: 0.025em;             /* Mejor legibilidad */
  opacity: 1 !important;               /* Máxima opacidad */
}

/* Ajustes responsive del banner */
@media (min-width: 768px) {
  .banner { height: clamp(80px, 15vh, 150px); }
}

@media (min-width: 1200px) {
  .banner { height: clamp(100px, 18vh, 180px); }
}

/* Responsive text sizing para móviles */
@media (max-width: 768px) {
  .banner-text { 
    font-size: 0.875rem; 
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  }
}

/* ===============================================
   MODALES LEGALES - TÉRMINOS Y PRIVACIDAD
   =============================================== */

.legal-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.legal-modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.modal-content {
  position: relative;
  background: linear-gradient(135deg, var(--panel) 0%, #fafbfc 100%);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  max-width: 700px;
  max-height: 90vh;
  width: 90%;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.legal-modal.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  color: white;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 0;
  max-height: calc(90vh - 100px);
  overflow-y: auto;
}

.legal-content {
  padding: 32px;
  line-height: 1.6;
}

.legal-content h3 {
  color: var(--brand);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 32px 0 16px 0;
}

.legal-content h3:first-child {
  margin-top: 0;
}

.legal-content p {
  margin: 16px 0;
  color: var(--text);
}

.legal-content ul {
  margin: 16px 0;
  padding-left: 24px;
}

.legal-content li {
  margin: 8px 0;
  color: var(--text);
}

.legal-footer {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  background: linear-gradient(135deg, var(--panel-2) 0%, rgba(248, 250, 252, 0.8) 100%);
  border-radius: 16px;
  padding: 24px;
}

.legal-footer p {
  margin: 4px 0;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ✨ Estilos especiales para botón home */
.nav-item-home {
  position: relative;
}

.nav-item-home .nav-icon {
  background: linear-gradient(135deg, rgba(var(--brand-rgb), 0.1) 0%, rgba(var(--brand-light-rgb), 0.05) 100%);
  border: 1px solid rgba(var(--brand-rgb), 0.2);
  border-radius: 8px;
  padding: 2px;
}

/* Responsive modales */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    max-height: 95vh;
  }
  
  .modal-header {
    padding: 20px 24px;
  }
  
  .modal-header h2 {
    font-size: 1.25rem;
  }
  
  .legal-content {
    padding: 24px 20px;
  }
  
  .legal-content h3 {
    font-size: 1.125rem;
  }
}
/* ===============================================
   FOOTER MODERNO Y MINIMALISTA
   =============================================== */

.app-footer {
  border-top: 1px solid var(--border);
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
  backdrop-filter: blur(20px);
  margin-top: auto;
  box-shadow: 0 -4px 20px rgba(var(--brand-rgb), 0.04);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  gap: 32px;
}

/* Footer Left */
.footer-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

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

.footer-logo-image {
  height: 24px;
  width: 24px;
  object-fit: contain;
  border-radius: 6px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-brand-name {
  font-weight: 700;
  font-size: 1rem;
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-version {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  color: white;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.625rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.footer-description {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  max-width: 300px;
}

/* Footer Center */
.footer-center {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.footer-navigation {
  display: flex;
  gap: 24px;
}

.footer-nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
  position: relative;
}

.footer-nav-link:hover {
  color: var(--brand);
  background: rgba(37, 99, 235, 0.05);
  transform: translateY(-1px);
}

.footer-nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--brand);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.footer-nav-link:hover::after {
  width: 80%;
}

/* Footer Right */
.footer-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

.footer-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: all 0.3s ease;
}

.status-indicator:hover {
  background: rgba(16, 185, 129, 0.05);
  border-color: #10b981;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
}

.status-online {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.status-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.footer-time {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 4px 8px;
  background: var(--panel-2);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.footer-time:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: rgba(37, 99, 235, 0.05);
  transform: translateY(-1px);
}

/* Footer Bottom */
.footer-bottom {
  border-top: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.02) 0%, rgba(59, 130, 246, 0.01) 100%);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-credits {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.heart-icon {
  color: #ef4444;
  animation: heartbeat 2s ease-in-out infinite;
}

.footer-tech {
  display: flex;
  align-items: center;
}

.tech-stack {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Animaciones del footer */
@keyframes heartbeat {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Footer Responsive */
@media (max-width: 960px) {
  .footer-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 24px;
    padding: 20px 24px;
  }
  
  .footer-left,
  .footer-center,
  .footer-right {
    align-items: center;
    text-align: center;
  }
  
  .footer-navigation {
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
  }
  
  .footer-status {
    align-items: center;
  }
  
  .footer-description {
    text-align: center;
    max-width: 100%;
  }
  
  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
    padding: 16px 24px;
  }
}

@media (max-width: 640px) {
  .footer-inner {
    padding: 16px 20px;
    gap: 20px;
  }
  
  .footer-navigation {
    gap: 12px;
  }
  
  .footer-nav-link {
    padding: 6px 10px;
    font-size: 0.8125rem;
  }
  
  .footer-logo {
    justify-content: center;
  }
  
  .footer-bottom {
    padding: 12px 20px;
  }
  
  .footer-credits,
  .tech-stack {
    font-size: 0.6875rem;
  }
}
/* Estilos específicos de Livechat pasaron a modules/livechat/styles.css */

/* ==== MEJORAS DEL LOGIN ==== */
.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h2 {
  margin-bottom: 8px;
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0;
  font-weight: 500;
}

.form-field {
  margin-bottom: 24px;
}

.form-field:last-of-type {
  margin-bottom: 32px;
}

.form-field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  padding: 16px 48px 16px 16px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 16px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
  transform: translateY(-1px);
}

.input-wrapper input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.input-wrapper input.success {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.08);
}

.input-icon {
  position: absolute;
  right: 16px;
  color: var(--muted);
  pointer-events: none;
  transition: all 0.2s ease;
}

.input-wrapper input:focus + .input-icon {
  color: var(--brand);
}

.password-toggle {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  z-index: 2;
}

.password-toggle:hover {
  color: var(--text);
  background: rgba(var(--brand-rgb, 37, 99, 235), 0.08);
}

.password-toggle:focus {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.field-error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 6px;
  min-height: 16px;
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.field-error.show {
  opacity: 1;
  transform: translateY(0);
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 12px;
}

/* Checkbox personalizado */
.checkbox-container {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-size: 0.875rem;
  color: var(--text);
}

.checkbox-container input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  margin-right: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
}

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

.checkbox-container input:checked + .checkmark::after {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: 600;
}

.checkbox-container:hover .checkmark {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.08);
}

.checkbox-label {
  font-weight: 500;
}

.forgot-password {
  color: var(--brand);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.forgot-password:hover {
  color: var(--accent);
  text-decoration: underline;
}

.btn-login {
  width: 100%;
  position: relative;
  overflow: hidden;
  font-size: 16px;
  padding: 16px 24px;
  border-radius: 12px;
  font-weight: 600;
  letter-spacing: 0.025em;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--shadow-sm);
}

.btn-login:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-login:not(:disabled):active {
  transform: translateY(0);
}

.btn-spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.btn-spinner svg {
  animation: spin 1s linear infinite;
}

.btn-text {
  transition: opacity 0.2s ease;
}

.btn-login.loading .btn-text {
  opacity: 0;
}

.btn-login.loading .btn-spinner {
  display: block;
}

.error-banner {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(220, 38, 38, 0.05) 100%);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger);
  padding: 16px;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 24px;
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 0;
  max-height: 0;
  overflow: hidden;
}

.error-banner.show {
  opacity: 1;
  transform: translateY(0);
  min-height: auto;
  max-height: 200px;
  margin-bottom: 0;
}

.error-banner:empty {
  display: none;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.form-field.shake input {
  animation: shake 0.4s ease-in-out;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .form-options {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  
  .checkbox-container {
    justify-content: center;
  }
  
  .forgot-password {
    text-align: center;
  }
  
  .card {
    margin: 24px auto;
    padding: 24px;
  }
}

/* ===============================================
   MODALES DE AUTENTICACIÓN
   =============================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--panel);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal.active .modal-content {
  transform: scale(1);
}

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

.modal-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--panel-2);
  color: var(--text);
}

.modal-body {
  padding: 0 24px 24px 24px;
}

.modal-body p {
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.modal-actions .btn {
  min-width: 120px;
}

/* Mensajes de éxito */
.success-message {
  text-align: center;
  padding: 24px;
}

.success-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.success-message h4 {
  color: var(--text);
  margin: 0 0 8px 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.success-message p {
  color: var(--muted);
  margin: 0 0 24px 0;
}

/* Requisitos de contraseña */
.password-requirements {
  margin: 16px 0;
  padding: 16px;
  background: var(--panel-2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.requirement {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.875rem;
}

.requirement:last-child {
  margin-bottom: 0;
}

.requirement-icon {
  font-size: 1rem;
  min-width: 20px;
}

.requirement-text {
  color: var(--muted);
}

.requirement.valid .requirement-text {
  color: #10b981;
}

.requirement.invalid .requirement-text {
  color: #f59e0b;
}

/* Responsive para modales */
@media (max-width: 480px) {
  .modal-content {
    width: 95%;
    margin: 20px;
  }
  
  .modal-header,
  .modal-body {
    padding-left: 20px;
    padding-right: 20px;
  }
  
  .modal-actions {
    flex-direction: column;
  }
  
  /* Estilos para invitaciones */
  .invitation-info {
    text-align: center;
    margin-bottom: 24px;
  }

  .invitation-info p {
    margin: 8px 0;
    color: var(--text-2);
  }

  .invitation-info .role-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    margin: 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .invitation-info .role-badge.doctor {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-light) 100%);
    color: white;
  }

  .invitation-info .role-badge.admin {
    background: linear-gradient(135deg, var(--warning) 0%, var(--warning-light) 100%);
    color: white;
  }

  .invitation-info .role-badge.superadmin {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-light) 100%);
    color: white;
  }

  .invitation-info .role-badge.viewer {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
    color: white;
  }

  .success-message {
    text-align: center;
    padding: 32px;
  }

  .success-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: scaleIn 0.5s ease;
  }

  @keyframes scaleIn {
    from {
      transform: scale(0);
    }
    to {
      transform: scale(1);
    }
  }

  .success-message h4 {
    color: var(--success);
    margin: 16px 0 8px;
  }

  .success-message p {
    color: var(--text-2);
    margin: 8px 0 24px;
  }

  .modal-actions .btn {
    min-width: auto;
    width: 100%;
  }
}


