/* 
 * MODERN UI IMPROVEMENTS
 * Mejoras modernas para la interfaz de usuario
 * 2025-07-19
 */

/* ========== VARIABLES MODERNAS ========== */
:root {
  /* Paleta de colores moderna - Tema Turquesa */
  --primary-gradient: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
  --success-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
  --warning-gradient: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  --danger-gradient: linear-gradient(135deg, #dc2626 0%, #f87171 100%);
  --turquoise-bg: radial-gradient(ellipse at bottom left, #0f172a 0%, #1e293b 25%, #0891b2 60%, #67e8f9 100%);
  
  /* Colores de fondo mejorados */
  --bg-primary: #1a1d29;
  --bg-secondary: #242938;
  --bg-accent: #2d3748;
  
  /* Sombras modernas */
  --shadow-soft: 0 2px 15px rgba(0, 0, 0, 0.08);
  --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.15);
  --shadow-strong: 0 15px 35px rgba(0, 0, 0, 0.1), 0 3px 10px rgba(0, 0, 0, 0.07);
  
  /* Bordes y radio */
  --border-radius: 12px;
  --border-radius-lg: 20px;
  --border-width: 1px;
  
  /* Transiciones suaves */
  --transition-fast: all 0.15s ease;
  --transition-normal: all 0.3s ease;
  --transition-slow: all 0.45s ease;
}

/* ========== MEJORAS GENERALES ========== */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--turquoise-bg);
  background-attachment: fixed;
  line-height: 1.6;
  min-height: 100vh;
}

/* Fondo específico para dashboard moderno */
body:has(.enhanced-dashboard-body) {
  background: radial-gradient(ellipse at bottom left, #0f172a 0%, #1e293b 25%, #164e63 50%, #0891b2 75%, #67e8f9 100%);
}

.container-fluid, .container {
  backdrop-filter: blur(10px);
}

/* ========== TARJETAS MODERNAS ========== */
.card {
  border: none;
  border-radius: var(--border-radius);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(15px);
  box-shadow: var(--shadow-medium);
  transition: var(--transition-normal);
  overflow: hidden;
  position: relative;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-strong);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
  opacity: 0;
  transition: var(--transition-fast);
}

.card:hover::before {
  opacity: 1;
}

/* Tarjetas de métricas mejoradas */
.metric-card {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.metric-card.success {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
}

.metric-card.danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

.metric-card.warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
}

/* ========== NAVEGACIÓN MEJORADA ========== */
.navbar {
  background: rgba(26, 29, 41, 0.95) !important;
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem 0;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
  color: #fff !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  color: rgba(255, 255, 255, 0.8) !important;
  transition: var(--transition-fast);
  border-radius: 8px;
  margin: 0 2px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

/* ========== BOTONES MODERNOS ========== */
.btn {
  border-radius: 10px;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border: none;
  transition: var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
}

.btn-success {
  background: var(--success-gradient);
  color: white;
}

.btn-warning {
  background: var(--warning-gradient);
  color: white;
}

.btn-danger {
  background: var(--danger-gradient);
  color: white;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* ========== TABLAS MODERNAS ========== */
.table {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.table thead th {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.85rem;
  padding: 1rem;
}

.table tbody tr {
  transition: var(--transition-fast);
  border: none;
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: scale(1.01);
}

.table tbody td {
  border: none;
  padding: 1rem;
  vertical-align: middle;
}

/* ========== BADGES MODERNOS ========== */
.badge {
  border-radius: 50px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* ========== ALERTS MEJORADAS ========== */
.alert {
  border: none;
  border-radius: var(--border-radius);
  backdrop-filter: blur(10px);
  border-left: 4px solid;
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border-left-color: #22c55e;
  color: #dcfce7;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border-left-color: #ef4444;
  color: #fecaca;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border-left-color: #f59e0b;
  color: #fed7aa;
}

/* ========== FORMULARIOS MODERNOS ========== */
.form-control, .form-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #fff;
  transition: var(--transition-fast);
  padding: 0.75rem 1rem;
}

.form-control:focus, .form-select:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: #667eea;
  box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
  color: #fff;
}

.form-label {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 0.5rem;
}

/* ========== LOADING ANIMATIONS ========== */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #667eea;
  animation: spin 1s ease-in-out infinite;
}

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

/* ========== TOOLTIPS MEJORADOS ========== */
.tooltip {
  font-size: 0.875rem;
}

.tooltip-inner {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}

/* ========== DROPDOWN MENUS MODERNOS ========== */
.dropdown-menu {
  background: rgba(26, 29, 41, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-strong);
}

.dropdown-item {
  color: rgba(255, 255, 255, 0.8);
  transition: var(--transition-fast);
  border-radius: 6px;
  margin: 2px;
}

.dropdown-item:hover {
  background: rgba(102, 126, 234, 0.2);
  color: #fff;
}

/* ========== RESPONSIVE MEJORADO ========== */
@media (max-width: 768px) {
  .card {
    margin-bottom: 1.5rem;
  }
  
  .metric-card .card-body {
    text-align: center;
    padding: 1.5rem 1rem;
  }
  
  .navbar-brand {
    font-size: 1.25rem;
  }
  
  .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }
}

/* ========== GLASSMORPHISM EFFECTS ========== */
.glass-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-medium);
}

.glass-nav {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(25px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* ========== ANIMACIONES SUAVES ========== */
.fade-in {
  animation: fadeIn 0.6s ease-out;
}

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

.slide-in {
  animation: slideIn 0.5s ease-out;
}

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

/* ========== STATUS INDICATORS ========== */
.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.5rem;
}

.status-online {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
  animation: pulse-green 2s infinite;
}

.status-offline {
  background: #ef4444;
}

.status-warning {
  background: #f59e0b;
  animation: pulse-yellow 2s infinite;
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes pulse-yellow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ========== TIPOGRAFÍA BLANCA PARA TEMA TURQUESA ========== */
[data-bs-theme="dark"] {
  --bs-body-bg: #1a1d29;
  --bs-body-color: #ffffff;
}

[data-bs-theme="dark"] .card {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

/* Forzar texto blanco en todos los elementos */
body, .card, .card-body, .card-header, .card-title, .card-text,
h1, h2, h3, h4, h5, h6, p, span, div, a, li, td, th,
.metric-label, .metric-value, .activity-item, .dropdown-item {
  color: #ffffff !important;
}

/* Excepciones para elementos que deben mantener otros colores */
.text-muted {
  color: rgba(255, 255, 255, 0.7) !important;
}

.text-success {
  color: #10b981 !important;
}

.text-danger {
  color: #f87171 !important;
}

.text-warning {
  color: #fbbf24 !important;
}

.text-info {
  color: #38bdf8 !important;
}

/* Navbar links */
.nav-link, .navbar-brand {
  color: #ffffff !important;
}

.nav-link:hover, .dropdown-item:hover {
  color: #67e8f9 !important;
}

/* Formularios */
.form-control, .form-select {
  color: #ffffff !important;
}

.form-label {
  color: #ffffff !important;
}

/* Tablas */
.table, .table th, .table td {
  color: #ffffff !important;
}

/* Dropdowns */
.dropdown-menu {
  color: #ffffff !important;
}

/* ========== EFECTOS HOVER AVANZADOS ========== */
.hover-lift {
  transition: var(--transition-normal);
}

.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-strong);
}

.hover-glow {
  transition: var(--transition-normal);
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

/* ========== ACCESOS RÁPIDOS (QUICK ACTIONS) ========== */
.quick-actions {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 1000;
}

.quick-action-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

.quick-action-btn:hover {
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.quick-action-btn.primary {
  background: linear-gradient(135deg, #0891b2 0%, #67e8f9 100%);
  border: 2px solid rgba(103, 232, 249, 0.3);
}

.quick-action-btn.primary:hover {
  background: linear-gradient(135deg, #67e8f9 0%, #0891b2 100%);
}

/* Responsive para móvil */
@media (max-width: 768px) {
  .quick-actions {
    bottom: 20px;
    right: 20px;
    gap: 12px;
  }
  
  .quick-action-btn {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }
}