/* CONFIGURACIÓN BASE */
:root {
  --primary: #3b82f6;
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-surface: rgba(255, 255, 255, 0.65);
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: #f0f4f8;
  overflow-x: hidden;
  /* Prevenir rebote en iOS */
  overscroll-behavior-y: none;
}

/* 1. MESH GRADIENT ANIMADO DE FONDO */
.mesh-background {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: -1;
  overflow: hidden;
  background: #f1f5f9;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: float-orb 10s infinite ease-in-out alternate;
  opacity: 0.6;
}

.orb-1 { width: 400px; height: 400px; background: #60a5fa; top: -100px; left: -100px; animation-duration: 12s; }
.orb-2 { width: 300px; height: 300px; background: #818cf8; bottom: 10%; right: -50px; animation-duration: 15s; }
.orb-3 { width: 200px; height: 200px; background: #34d399; top: 40%; left: 30%; animation-duration: 18s; opacity: 0.4; }

@keyframes float-orb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, 50px) scale(1.1); }
}

/* 2. GLASSMORPHISM BENTO CARDS */
.glass-card {
  background: var(--glass-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 32px; /* Bordes extra redondeados (Tendencia 2026) */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.glass-card:active {
  transform: scale(0.98);
}

.glass-dark {
  background: rgba(15, 23, 42, 0.85); /* Slate 900 con transparencia */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
}

/* 3. INPUTS MODERNOS (FILLED) */
.modern-input-group {
  position: relative;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.modern-input-group:focus-within {
  background: #ffffff;
  border-color: #bfdbfe; /* Blue 200 */
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
  transform: translateY(-2px);
}

.modern-input {
  width: 100%;
  padding: 24px 20px 8px 20px; /* Espacio para label flotante */
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  border-radius: 20px;
}

.modern-label {
  position: absolute;
  left: 20px;
  top: 18px;
  font-size: 14px;
  color: #64748b;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
}

.modern-input:focus ~ .modern-label,
.modern-input:not(:placeholder-shown) ~ .modern-label {
  top: 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #3b82f6;
  font-weight: 700;
}

/* 4. BOTONES TÁCTILES */
.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  border: none;
  border-radius: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  box-shadow: 0 10px 20px -5px rgba(37, 99, 235, 0.4);
  transition: all 0.2s ease;
}

.btn-primary:active {
  transform: scale(0.96);
  box-shadow: 0 5px 10px -5px rgba(37, 99, 235, 0.3);
}

.btn-secondary-dark {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 16px;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-secondary-dark:active {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(0.96);
}

.btn-secondary {
  background: rgba(100, 116, 139, 0.1);
  border: 2px solid rgba(100, 116, 139, 0.2);
  color: #475569;
  border-radius: 20px;
  font-weight: 700;
  transition: all 0.2s;
}

.btn-secondary:active {
  background: rgba(100, 116, 139, 0.2);
  transform: scale(0.96);
}

/* Animaciones de entrada */
.fade-in-up {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateY(30px);
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

@keyframes fadeInUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ANIMACIÓN SHAKE PARA ERRORES */
.animate-shake {
  animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* 4. FLOATING BOTTOM NAVIGATION (PILOLA) */
.glass-nav {
  /* Apple-style premium glass: Mas translúcido, blur intenso para distorsión */
  background: rgba(255, 255, 255, 0.1); 
  backdrop-filter: blur(35px) saturate(200%);
  -webkit-backdrop-filter: blur(35px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1),
              inset 0 0 0 0.5px rgba(255, 255, 255, 0.5);
}

.nav-item {
  color: #64748b; /* Slate 500 */
}

.nav-item:hover {
  color: #334155; /* Slate 700 */
}

.nav-item.active {
  color: var(--primary);
}

.nav-item .icon-container {
  /* Fondo transparente por defecto */
  background: transparent; 
}

.nav-item.active .icon-container {
  /* Fondo azul suave cuando activo */
  background: rgba(59, 130, 246, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.nav-item:hover .icon-container {
  background: rgba(241, 245, 249, 0.8);
}


/* ESTADOS DE TARJETA (ON/OFF) */
.card-inactive {
  background: rgba(255, 255, 255, 0.65) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  box-shadow: none !important;
  border-radius: 40px !important;
}

/* FORZAR COLORES OSCUROS EN TARJETA INACTIVA - Sobrescribir text-white de Tailwind */
.card-inactive .text-white {
    color: #334155 !important; /* Slate 700 */
}

.card-inactive .full-content h2, 
.card-inactive .full-content h3 {
    color: #334155 !important; /* Slate 700 */
}

/* El texto pequeño debajo de la hora (tiene text-white/40) */
.card-inactive .full-content p,
.card-inactive [class*="text-white/"] {
    color: #64748b !important; /* Slate 500 */
}

/* Icono principal */
.card-inactive .full-content .w-12.h-12 {
    background-color: #e2e8f0 !important; /* Slate 200 */
    box-shadow: none !important;
}
.card-inactive .full-content .w-12.h-12 i {
    color: #64748b !important;
}

/* Iconos generales dentro de la tarjeta inactiva */
.card-inactive i {
    color: #64748b; 
}

/* Excepción para el botón de activación (verde) */
.card-inactive .action-button-toggle i {
    color: inherit !important; 
}
.card-inactive .action-button-toggle span {
    color: inherit !important;
}


/* --- MEJORAS DE CONTRASTE PARA TARJETA INACTIVA --- */

/* Textos de botones de acción (EDITAR, CARGAR) */
.card-inactive .action-button span {
    color: #334155 !important; /* Slate 700 */
}

/* Iconos de botones de acción deben ser oscuros */
.card-inactive .action-button i {
    color: #475569 !important; /* Slate 600 */
}

/* Excepción: El botón de TOGGLE (ACTIVAR) tiene sus propios colores definidos inline por JS,
   pero aseguramos que el texto 'ACTIVAR' (verde) se vea bien.
   El JS pone text-green-800 (#166534), que es oscuro y se ve bien sobre blanco.
   Solo nos aseguramos que esta regla general no lo pise si usamos !important.
   Como la regla de arriba usa !important, necesitamos excluir el botón toggle o ser más específicos.
*/
.card-inactive .action-button.action-button-toggle i {
     /* Dejar que el estilo inline/JS mande, o forzar el verde oscuro */
     color: #166534 !important; 
}
.card-inactive .action-button.action-button-toggle span {
     color: #166534 !important; 
}

/* Botón de colapsar (flecha arriba) */
.card-inactive button.rounded-full.bg-white\/10 {
    background-color: rgba(0, 0, 0, 0.05) !important;
}
.card-inactive button.rounded-full i {
    color: #475569 !important; /* Slate 600 */
}

/* Badges de estado (Online, Offline, Cargando) */
/* Forzamos versiones más oscuras de los colores para que se lean sobre fondo claro */

/* Badge Container Base */
.card-inactive span[id^="status-badge-"] {
    background-color: rgba(226, 232, 240, 0.8) !important; /* Slate 200 más solido */
}

/* Si el badge es verde (Online) */
.card-inactive .text-green-400 {
    color: #15803d !important; /* Green 700 */
}
.card-inactive .bg-green-500\/20 {
    background-color: rgba(187, 247, 208, 0.5) !important; /* Green 200 */
}
/* El punto animado */
.card-inactive .bg-green-400 {
    background-color: #15803d !important;
}

/* Si el badge es rojo (Offline) */
.card-inactive .text-red-400 {
    color: #b91c1c !important; /* Red 700 */
}
.card-inactive .bg-red-500\/20 {
    background-color: rgba(254, 202, 202, 0.5) !important; /* Red 200 */
}
/* El punto rojo */
.card-inactive .bg-red-400 {
    background-color: #b91c1c !important;
}

/* Si el badge es slate (Cargando) */
.card-inactive .text-slate-300 {
    color: #475569 !important; /* Slate 600 */
}
.card-inactive .bg-slate-500\/30 {
    background-color: rgba(203, 213, 225, 0.5) !important; /* Slate 300 */
}
.card-inactive .bg-slate-400 {
    background-color: #475569 !important;
}

/* --- SOBRESCRIBIR CLASES TEXT-WHITE EN TARJETA INACTIVA --- */

/* Nombre del controlador (h3.text-white) */
.card-inactive .full-content h3.text-white {
    color: #1e293b !important; /* Slate 800 - bien oscuro para contraste */
}

/* Tiempo restante grande (h2.text-white) */
.card-inactive .full-content h2.text-white {
    color: #334155 !important; /* Slate 700 */
}

/* Texto de estado "TIEMPO DISPONIBLE" / "EQUIPO INACTIVO" */
.card-inactive .full-content p[id^="status-text-"] {
    color: #64748b !important; /* Slate 500 */
}

/* Botón EDITAR - icono */
.card-inactive .action-button:not(.action-button-toggle):not(.primary) i {
    color: #475569 !important; /* Slate 600 */
}

/* Botón EDITAR - texto */
.card-inactive .action-button:not(.action-button-toggle):not(.primary) span {
    color: #334155 !important; /* Slate 700 */
}

/* Botón EDITAR - fondo más visible */
.card-inactive .action-button:not(.action-button-toggle):not(.primary) {
    background: rgba(100, 116, 139, 0.15) !important; /* Slate con algo de opacidad */
    border-color: rgba(100, 116, 139, 0.25) !important;
}

/* Botón CARGAR (primary) en estado inactivo - mantener visible */
.card-inactive .action-button.primary {
    background: #3b82f6 !important;
    color: white !important;
}
.card-inactive .action-button.primary i,
.card-inactive .action-button.primary span {
    color: white !important;
}

/* Botón colapsar (chevron) */
.card-inactive button.rounded-full {
    background: rgba(100, 116, 139, 0.1) !important;
}
.card-inactive button.rounded-full i.text-white {
    color: #475569 !important; /* Slate 600 */
}

/* Icono principal (wind) en el header */
.card-inactive .full-content .w-12.h-12 i.text-white {
    color: #64748b !important; /* Slate 500 */
}

/* Barras de progreso - hacerlas más visibles */
.card-inactive .bg-blue-600 {
    background-color: #94a3b8 !important; /* Slate 400 */
}
.card-inactive .bg-blue-600\/30 {
    background-color: rgba(148, 163, 184, 0.3) !important;
}
.card-inactive .bg-blue-600\/10 {
    background-color: rgba(148, 163, 184, 0.1) !important;
}

/* PILL CONTENT (versión minimizada) */
.card-inactive.is-pill .pill-content span.text-white {
    color: #334155 !important; /* Slate 700 */
}
.card-inactive.is-pill .pill-content i.text-white {
    color: #64748b !important; /* Slate 500 */
}
.card-inactive.is-pill .pill-content i.text-white\/40 {
    color: #94a3b8 !important; /* Slate 400 */
}
.card-inactive.is-pill .pill-content .bg-blue-600 {
    background-color: #94a3b8 !important; /* Slate 400 para el círculo del icono */
}

/* ============================================
   ESTILOS DE EQUIPOS.HTML (CONSOLIDADOS)
   ============================================ */

/* BENTO CARD CON PROFUNDIDAD (LAYERED DEPTH) */
.bento-card {
  position: relative;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 40px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 
    0 4px 6px -1px rgba(0, 0, 0, 0.02),
    0 20px 40px -12px rgba(0, 0, 0, 0.05);
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  overflow: hidden;
}

/* Efecto de borde iluminado tendencia 2026 */
.bento-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 50%, rgba(255,255,255,0.2) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.card-active {
  background: #0f172a !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  color: white;
  border: none;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
}

.card-active::before {
  background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 100%);
}

/* BOTONES TÁCTILES (MODERN NEUMORPHISM) */
.action-button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
  cursor: pointer;
}

.action-button:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.15);
}

.action-button.primary {
  background: #3b82f6;
  color: white;
  box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.4);
  border: none;
}

/* BARRA DE NAVEGACIÓN GLASS iOS */
.nav-container {
  position: fixed;
  bottom: 35px;
  left: 0; width: 100%;
  display: flex;
  justify-content: center;
  z-index: 100;
  pointer-events: none;
}

.nav-glass {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  padding: 8px;
  border-radius: 44px;
  display: flex;
  gap: 8px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.05);
  min-width: 280px;
}

/* Sobreescribir .nav-item para equipos (navegación flotante) */
.nav-glass .nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  border-radius: 36px;
  color: #94a3b8;
  transition: all 0.4s cubic-bezier(0.2, 0, 0, 1);
  cursor: pointer;
}

.nav-glass .nav-item.active {
  background: white;
  color: #3b82f6;
  box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.05);
}

.nav-glass .nav-item:active { transform: scale(0.9); }

.nav-text {
  font-size: 9px;
  font-weight: 700;
  margin-top: 4px;
  letter-spacing: 0.5px;
}

/* ESTADO PÍLDORA */
.is-pill {
  padding: 16px 24px !important;
  border-radius: 30px !important;
}
.is-pill .full-content { display: none; }
.pill-content { display: none; }
.is-pill .pill-content { display: flex; width: 100%; align-items: center; justify-content: space-between; }

/* ANIMACIÓN PULSO AZUL */
.pulse-blue {
  box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  animation: pulse-ring 2s infinite;
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* Animación de pulso rojo para "MENOS de 1 MINUTO" */
.pulse-red-text {
  color: #ef4444 !important;
  font-weight: 800 !important;
  letter-spacing: 0.15em !important;
  animation: pulse-red-glow 1s ease-in-out infinite;
}

@keyframes pulse-red-glow {
  0%, 100% {
    opacity: 1;
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.8), 0 0 16px rgba(239, 68, 68, 0.4);
  }
  50% {
    opacity: 0.6;
    text-shadow: 0 0 4px rgba(239, 68, 68, 0.4), 0 0 8px rgba(239, 68, 68, 0.2);
  }
}

/* Texto rojo pulsante en tarjeta activa (fondo oscuro) */
.card-active .pulse-red-text {
  color: #f87171 !important;
  text-shadow: 0 0 12px rgba(248, 113, 113, 0.9), 0 0 24px rgba(248, 113, 113, 0.5);
}

/* Utility for hidden */
.hidden { display: none !important; }


/* 4. STATUS BADGE INTERACTIVO (Tendencia 2026) */
.status-badge-interactive {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
  user-select: none;
}

.status-badge-interactive:active {
  transform: scale(0.92);
  opacity: 0.8;
}

/* 5. BOTTOM SHEET CONTEXTUAL */
/* El contenedor padre #statusHelpSheet controla la visibilidad y pointer-events */
#statusHelpSheet.active {
  visibility: visible;
}

/* Animación del overlay */
#statusHelpSheet.active #statusHelpOverlay {
  opacity: 1;
  pointer-events: auto;
}

/* Animación del contenido */
#statusHelpSheet.active #statusHelpContent {
  transform: translateY(0);
}
