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

/* Flip animation helpers — two separate classes so we can
   restore visibility first (while transitions are still killed)
   and only re-enable transitions on the next frame. */
.flip-notransition,
.flip-notransition *,
.flip-notransition *::before,
.flip-notransition *::after {
  transition: none !important;
  animation: none !important;
}
.flip-invisible {
  opacity: 0 !important;
  pointer-events: none !important;
}

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-light01 {
  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-light01 .text-white {
    color: #334155 !important; /* Slate 700 */
}

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

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

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

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

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


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

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

/* Iconos de botones de acción deben ser oscuros */
.card-light01 .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-light01 .action-button.action-button-toggle i {
     /* Dejar que el estilo inline/JS mande, o forzar el verde oscuro */
     color: #166534 !important; 
}
.card-light01 .action-button.action-button-toggle span {
     color: #166534 !important; 
}

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

/* Fix text color for the major charge button inside light cards */
.card-light01 .btn-charge-main,
.card-light01 .btn-charge-main span,
.card-light01 .btn-charge-main i,
.card-light01 .btn-options-main i {
    color: #ffffff !important;
}

.card-light01 .btn-options-main {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

/* 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-light01 span[id^="status-badge-"]:not(.status-badge-in-use) {
    background-color: rgba(226, 232, 240, 0.8) !important; /* Slate 200 más solido */
}

/* Badge EN USO: mantener verde legible en tarjeta clara y oscura */
span[id^="status-badge-"].status-badge-in-use {
  background-color: #86efac !important; /* Green 300 */
  color: #14532d !important; /* Green 900 */
}

/* Si el badge es verde (Online) */
/* --- MICRO-GRILLAS (BENTO TÉCNICO) --- */
.micro-grid-cell {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-light01 .micro-grid-cell {
    background-color: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: none;
}

.micro-grid-value {
    color: #ffffff;
}
.card-light01 .micro-grid-value {
    color: #334155 !important;
}

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

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

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

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

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

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

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

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

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

/* Botón EDITAR - fondo más visible */
.card-light01 .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-light01 .action-button.primary {
    background: #3b82f6 !important;
    color: white !important;
}
.card-light01 .action-button.primary i,
.card-light01 .action-button.primary span {
    color: white !important;
}

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

/* Excepción de estilos para botones de filtro activos */
.card-light01 button.filter-btn.bg-blue-600 {
    background-color: #2563eb !important;
    color: #ffffff !important;
}
.card-light01 button.filter-btn.bg-blue-600 i {
    color: #ffffff !important;
}

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

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

.card-light01 .btn-charge-main {
  background: #2563eb !important;
  border-color: #2563eb !important;
}

.card-light01 .btn-charge-main:hover {
  background: #1d4ed8 !important;
}

/* --- DEVICE STAT ROWS (Nuevas pastillas de datos) --- */

/* Stat labels en tarjeta Light01 (fondo claro) */
.card-light01 .device-stat-label {
    color: #475569 !important; /* Slate 600 */
}

/* Stat value pills en tarjeta Light01 - azul claro sobre fondo blanco */
.card-light01 .device-stat-value {
    background: rgba(59, 130, 246, 0.12) !important;
    color: #2563eb !important; /* Blue 600 */
}

/* PILL CONTENT (versión minimizada) */
.card-light01.is-pill .pill-content span.text-white {
    color: #334155 !important; /* Slate 700 */
}
.card-light01.is-pill .pill-content i.text-white {
    color: #64748b !important; /* Slate 500 */
}
.card-light01.is-pill .pill-content i.text-white\/40 {
    color: #94a3b8 !important; /* Slate 400 */
}
.card-light01.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-dark01 {
  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-dark01::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;
  transition: transform 0.4s cubic-bezier(0.2, 0, 0, 1);
}

.nav-container.nav-hidden {
  transform: translateY(150%);
}

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

/* 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: #475569; /* Gris más oscuro para asegurar la legibilidad sobre el diseño glass */
  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-dark01 .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);
}

/* BOTTOM SHEET: ACCIONES DE DISPOSITIVO */
#deviceActionsSheet.active {
  visibility: visible;
}

#deviceActionsSheet.active #deviceActionsOverlay {
  opacity: 1;
  pointer-events: auto;
}

#deviceActionsSheet.active #deviceActionsContent {
  transform: translateY(0);
}

.device-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.device-action-btn {
  border: 1px solid rgba(0, 0, 0, 0.04);
  background: rgba(248, 250, 252, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 18px;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.device-action-btn:active {
  transform: scale(0.96);
  background: rgba(241, 245, 249, 0.75);
  border-color: rgba(0, 0, 0, 0.08);
}

.device-action-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.05);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.device-action-icon {
  width: 20px;
  height: 20px;
  color: #1e293b;
}

.device-action-label {
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  text-align: center;
  letter-spacing: 0.02em;
}

/* ============================================
   ESTILOS DE PERFIL Y TARJETAS COLAPSABLES
   ============================================ */

/* Tarjeta de perfil (glass light) */
.profile-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Tarjeta oscura para MercadoPago */
.profile-card-dark {
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  color: white;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

/* --- TARJETAS COLAPSABLES --- */
.card-header {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  -webkit-tap-highlight-color: transparent;
  transition: margin-bottom 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.card-header:active {
  opacity: 0.7;
}

/* Misma dinamica de equipos: full-content + pill-content */
.profile-card .full-content,
.profile-card-dark .full-content {
  display: block;
}

.profile-card .pill-content,
.profile-card-dark .pill-content {
  display: none;
}

.profile-card.is-pill,
.profile-card-dark.is-pill {
  padding: 16px 24px !important;
  border-radius: 30px !important;
}

.profile-card.is-pill .full-content,
.profile-card-dark.is-pill .full-content {
  display: none;
}

.profile-card.is-pill .pill-content,
.profile-card-dark.is-pill .pill-content {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
}

.collapse-icon {
  transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Botón de colapsar - REDONDO como en equipos.html */
.collapse-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  cursor: pointer;
}

.collapse-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  transform: scale(1.05);
}

.collapse-btn:active {
  transform: scale(0.95);
}

/* Botón colapsar para tarjeta oscura */
.profile-card-dark .collapse-btn {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
}

.profile-card-dark .collapse-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

/* --- CAMPOS EDITABLES (PERFIL) --- */
.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.field-row:last-child {
  border-bottom: none;
}

.field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  margin-bottom: 2px;
}

.field-value {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
}

.field-value.empty {
  color: #94a3b8;
  font-style: italic;
}

.field-input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  background: white;
  outline: none;
  transition: all 0.2s;
}

.field-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* --- BOTONES DE ACCIÓN (EDIT, SAVE, CANCEL) --- */
.edit-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.1);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3b82f6;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.edit-btn:hover {
  background: rgba(59, 130, 246, 0.2);
}

.edit-btn:active {
  transform: scale(0.95);
}

.save-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #22c55e;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.save-btn:active {
  transform: scale(0.95);
}

.cancel-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #f1f5f9;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.cancel-btn:active {
  transform: scale(0.95);
}

/* --- TOGGLE FACTURA A/B --- */
.invoice-toggle {
  display: flex;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.invoice-toggle-btn {
  flex: 1;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  background: transparent;
  color: #64748b;
}

.invoice-toggle-btn.active {
  background: white;
  color: #3b82f6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* --- STATUS BADGES (VINCULADO/NO VINCULADO) --- */
.status-linked {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(34, 197, 94, 0.2);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: #22c55e;
}

.status-unlinked {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(239, 68, 68, 0.2);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: #ef4444;
}

/* --- BOTONES MERCADOPAGO --- */
.unlink-btn {
  width: 100%;
  padding: 14px;
  border: 2px solid rgba(239, 68, 68, 0.3);
  border-radius: 14px;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.unlink-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}

.unlink-btn:active {
  transform: scale(0.98);
}

.link-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  background: #009ee3;
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.link-btn:hover {
  background: #007eb8;
}

.link-btn:active {
  transform: scale(0.98);
}

/* --- SPINNER DE CARGA --- */
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ============================================
   ESTILOS GLOBALES DE PÁGINA
   ============================================ */

/* Páginas internas (equipos, perfil) */
.page-internal {
  background-color: #fcfdfe;
  padding-bottom: 140px;
  color: #1e293b;
}

/* Mesh background con gradientes radiales */
.mesh-background-gradient {
  background: radial-gradient(at 0% 0%, #f1f5f9 0%, transparent 50%),
              radial-gradient(at 100% 100%, #e2e8f0 0%, transparent 50%);
}

/* ============================================
   OFFLINE MODE STYLES
   ============================================ */
/* Reducir opacidad y deshabilitar interacción en el contenido cuando no hay internet */
/* Para estructuras main > header + content (equipos.html, perfil.html) */
body.offline-mode main > *:not(header):not(#offline-alert-card) {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(0.8);
  transition: opacity 0.3s ease, filter 0.3s ease;
}

/* Para index.html y registro.html */
body.offline-mode .relative.z-10 > *:not(.text-center):not(#offline-alert-card),
body.offline-mode .w-full.max-w-sm > *:not(.text-center):not(#offline-alert-card) {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(0.8);
  transition: opacity 0.3s ease, filter 0.3s ease;
}

/* Asegurar que el Header y el Card Offline SIEMPRE sean visibles */
body.offline-mode header,
body.offline-mode .text-center.mb-10,
body.offline-mode .text-center.mb-8 {
  opacity: 1 !important;
  pointer-events: auto !important;
  filter: none !important;
}

/* =========================================
   TENANT APP STYLES (Migrated from index.html)
   ========================================= */

/* Code input boxes group */
.code-input-group {
    display: flex;
    justify-content: center;
    gap: 0.75rem; /* gap-3 equivalent */
}

/* Code input boxes */
.code-box {
    width: 100%;
    max-width: 56px;
    height: 64px;
    text-align: center;
    font-size: 28px;
    font-weight: 800;
    font-family: 'Plus Jakarta Sans', monospace;
    color: #1e293b;
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    outline: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    caret-color: #3b82f6;
    
    /* Responsive tweaks */
    flex: 1;
    min-width: 0;
}

.code-box:focus {
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15), 0 4px 12px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.code-box.valid {
    border-color: #22c55e;
    background: #f0fdf4;
}

.code-box.invalid {
    border-color: #ef4444;
    background: #fef2f2;
    animation: shake 0.4s ease-in-out;
}

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

/* Responsive adjustments for small screens */
@media (max-width: 380px) {
    .glass-card {
        padding-left: 1.25rem; 
        padding-right: 1.25rem;
    }

    .code-input-group {
        gap: 0.35rem; /* Tighter gap */
    }

    .code-box {
        height: 52px;
        font-size: 22px;
        border-radius: 12px;
    }
}

/* Balance result card */
.balance-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(99, 102, 241, 0.05) 100%);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 28px;
    padding: 28px 24px;
}

.balance-amount {
    font-size: 48px;
    font-weight: 800;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}

.time-remaining {
    font-size: 22px;
    font-weight: 700;
    color: #475569;
}

/* Status badges */
.status-online {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #dcfce7;
    color: #15803d;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 700;
}

.status-offline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #fee2e2;
    color: #b91c1c;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 700;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.status-online .status-dot {
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* QR scanner area */
#qr-reader-tenant {
    border-radius: 20px;
    overflow: hidden;
}
#qr-reader-tenant video {
    border-radius: 20px;
}

/* Owner login link */
.owner-link {
    color: #94a3b8;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}
.owner-link:hover {
    color: #3b82f6;
}

@keyframes scrollText {
    from {
        transform: translateX(0%);
    }
    to {
        transform: translateX(-50%);
    }
}

/* Fix para el badge "En Uso" en tarjeta Light01 */
.card-light01 .bg-green-500 {
    background-color: #22c55e !important; /* Mantiene un verde intenso en la tarjeta light para contraste */
}
.card-light01 .text-white.shadow-green-500\/30 {
    color: #ffffff !important;
}
