/* Estilos específicos para tooltips mejorados */
/* Archivo dedicado para tooltips del sistema WhatsApp */

/* ===== RESET COMPLETO DE TOOLTIPS DAISYUI ===== */

/* Resetear cualquier estilo previo de tooltips */
.tooltip:before,
.tooltip:after {
  all: unset !important;
}

/* ===== FIX PARA TOOLTIPS DE DAISYUI ===== */

/* Asegurar que los tooltips de DaisyUI funcionen correctamente */
.tooltip {
  position: relative !important;
  display: inline-block !important;
}

/* Sobrescribir estilos de DaisyUI para tooltips del header */
.wa-header .tooltip:before {
  /* Posicionamiento */
  position: absolute !important;
  z-index: 1001 !important;
  
  /* Contenido */
  content: attr(data-tip) !important;
  
  /* Estilo visual */
  background-color: rgba(15, 23, 42, 0.95) !important;
  color: white !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  line-height: 1.3 !important;
  padding: 0.5rem 0.75rem !important;
  border-radius: 0.5rem !important;
  
  /* Efectos visuales */
  box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.2) !important;
  backdrop-filter: blur(8px) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  
  /* Comportamiento */
  white-space: nowrap !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(8px) !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  pointer-events: none !important;
  
  /* Posición por defecto (bottom) */
  top: calc(100% + 8px) !important;
  left: 50% !important;
  transform: translateX(-50%) translateY(8px) !important;
}

/* Flecha del tooltip */
.wa-header .tooltip:after {
  content: '' !important;
  position: absolute !important;
  z-index: 1000 !important;
  
  /* Flecha */
  width: 0 !important;
  height: 0 !important;
  border-style: solid !important;
  border-width: 0 6px 8px 6px !important;
  border-color: transparent transparent rgba(15, 23, 42, 0.95) transparent !important;
  
  /* Posicionamiento */
  top: 100% !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  margin-top: 0px !important;
  
  /* Comportamiento */
  opacity: 0 !important;
  visibility: hidden !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  pointer-events: none !important;
}

/* Mostrar tooltip en hover */
.wa-header .tooltip:hover:before,
.wa-header .tooltip:hover:after {
  opacity: 1 !important;
  visibility: visible !important;
}

.wa-header .tooltip:hover:before {
  transform: translateX(-50%) translateY(0) !important;
}

/* Tema oscuro */
[data-theme="dark"] .wa-header .tooltip:before {
  background-color: rgba(248, 250, 252, 0.95) !important;
  color: #1e293b !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="dark"] .wa-header .tooltip:after {
  border-bottom-color: rgba(248, 250, 252, 0.95) !important;
}

/* ===== TOOLTIPS RESPONSIVOS ===== */
@media (max-width: 768px) {
  /* En móviles, hacer tooltips más pequeños */
  .wa-header .tooltip:before {
    font-size: 0.675rem !important;
    padding: 0.375rem 0.5rem !important;
    max-width: 120px !important;
    white-space: normal !important;
    text-align: center !important;
  }
}

@media (max-width: 640px) {
  /* En pantallas muy pequeñas, ocultar tooltips */
  .wa-header .tooltip:before,
  .wa-header .tooltip:after {
    display: none !important;
  }
}

/* ===== MEJORAS DE ACCESIBILIDAD ===== */

/* Soporte para focus */
.wa-header .tooltip:focus:before,
.wa-header .tooltip:focus:after {
  opacity: 1 !important;
  visibility: visible !important;
}

.wa-header .tooltip:focus:before {
  transform: translateX(-50%) translateY(0) !important;
}

/* Mejorar contraste en modo de alto contraste */
@media (prefers-contrast: high) {
  .wa-header .tooltip:before {
    background-color: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
  }
  
  [data-theme="dark"] .wa-header .tooltip:before {
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
  }
}

/* Respetar preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  .wa-header .tooltip:before,
  .wa-header .tooltip:after {
    transition: none !important;
  }
}

/* ===== TOOLTIP PERSONALIZADO PARA BOTONES ESPECÍFICOS ===== */

/* Tooltip especial para el botón de regreso */
#back-btn.tooltip:before {
  content: "Regresar al sistema principal" !important;
}

/* Tooltips específicos para botones del menú */
.wa-header .tooltip[data-tip*="WhatsApp"]:before {
  max-width: 140px !important;
}

.wa-header .tooltip[data-tip*="Contactos"]:before,
.wa-header .tooltip[data-tip*="Embudo"]:before,
.wa-header .tooltip[data-tip*="Estadísticas"]:before,
.wa-header .tooltip[data-tip*="Análisis"]:before {
  max-width: 160px !important;
}

/* ===== TOOLTIPS PARA DRAWER DE CONTACTOS ===== */

/* Estilos base para tooltips del drawer */
.drawer .tooltip {
  position: relative !important;
  display: inline-block !important;
}

/* Tooltip content para drawer */
.drawer .tooltip:before {
  /* Posicionamiento */
  position: absolute !important;
  z-index: 1001 !important;
  
  /* Contenido */
  content: attr(data-tip) !important;
  
  /* Estilo visual */
  background-color: rgba(15, 23, 42, 0.95) !important;
  color: white !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  line-height: 1.3 !important;
  padding: 0.5rem 0.75rem !important;
  border-radius: 0.5rem !important;
  
  /* Efectos visuales */
  box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.2) !important;
  backdrop-filter: blur(8px) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  
  /* Comportamiento */
  white-space: nowrap !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(-8px) !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  pointer-events: none !important;
  
  /* Posición por defecto (top para drawer) */
  bottom: calc(100% + 8px) !important;
  left: 50% !important;
  transform: translateX(-50%) translateY(-8px) !important;
}

/* Flecha del tooltip para drawer */
.drawer .tooltip:after {
  content: '' !important;
  position: absolute !important;
  z-index: 1000 !important;
  
  /* Flecha hacia abajo */
  width: 0 !important;
  height: 0 !important;
  border-style: solid !important;
  border-width: 8px 6px 0 6px !important;
  border-color: rgba(15, 23, 42, 0.95) transparent transparent transparent !important;
  
  /* Posicionamiento */
  bottom: 100% !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  margin-bottom: 0px !important;
  
  /* Comportamiento */
  opacity: 0 !important;
  visibility: hidden !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  pointer-events: none !important;
}

/* Mostrar tooltip en hover para drawer */
.drawer .tooltip:hover:before,
.drawer .tooltip:hover:after {
  opacity: 1 !important;
  visibility: visible !important;
}

.drawer .tooltip:hover:before {
  transform: translateX(-50%) translateY(0) !important;
}

/* Soporte para focus en drawer */
.drawer .tooltip:focus:before,
.drawer .tooltip:focus:after {
  opacity: 1 !important;
  visibility: visible !important;
}

.drawer .tooltip:focus:before {
  transform: translateX(-50%) translateY(0) !important;
}

/* Tema oscuro para drawer tooltips */
[data-theme="dark"] .drawer .tooltip:before {
  background-color: rgba(248, 250, 252, 0.95) !important;
  color: #1e293b !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="dark"] .drawer .tooltip:after {
  border-top-color: rgba(248, 250, 252, 0.95) !important;
}

/* Tooltips responsivos para drawer */
@media (max-width: 768px) {
  .drawer .tooltip:before {
    font-size: 0.675rem !important;
    padding: 0.375rem 0.5rem !important;
    max-width: 100px !important;
    white-space: normal !important;
    text-align: center !important;
  }
}

@media (max-width: 480px) {
  /* En pantallas muy pequeñas, posicionar tooltips hacia arriba siempre */
  .drawer .tooltip:before {
    max-width: 80px !important;
    font-size: 0.625rem !important;
  }
}

/* ===== ESTILOS ESPECÍFICOS PARA BOTONES DEL DRAWER ===== */

/* Contenedor de botones del drawer */
.drawer .buttons-container {
  gap: 0.75rem !important;
}

/* Mejorar la apariencia de los botones del drawer */
.drawer .buttons-container .tooltip {
  flex: 1;
  min-width: 0;
}

.drawer .buttons-container .btn {
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem 1rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.025em;
  border-radius: 0.5rem;
  transition: all 0.2s ease-in-out;
}

/* Efectos hover mejorados */
.drawer .buttons-container .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.drawer .buttons-container .btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Colores específicos */
.drawer .buttons-container .btn-outline {
  border-width: 2px;
  background: rgba(255, 255, 255, 0.05);
}

.drawer .buttons-container .btn-outline:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: currentColor;
}

.drawer .buttons-container .btn-primary:hover {
  background: hsl(var(--p) / 0.9);
}

.drawer .buttons-container .btn-success:hover {
  background: hsl(var(--su) / 0.9);
}

/* Iconos más prominentes */
.drawer .buttons-container .btn i {
  font-size: 1.1em;
  opacity: 0.9;
}

/* Responsive: ocultar texto en pantallas pequeñas pero mantener tooltips */
@media (max-width: 640px) {
  .drawer .buttons-container .btn {
    min-height: 2.75rem;
    padding: 0.5rem;
  }
  
  .drawer .buttons-container .btn i {
    font-size: 1.2em;
    margin: 0 !important;
  }
}

/* Estado de loading para botones */
.drawer .buttons-container .btn.loading {
  pointer-events: none;
}

.drawer .buttons-container .btn.loading i {
  opacity: 0.5;
}

/* ===== COMPATIBILIDAD CON OTROS COMPONENTES ===== */

/* Asegurar que los tooltips no interfieran con dropdowns */
.wa-header .dropdown.tooltip:before,
.wa-header .dropdown.tooltip:after {
  z-index: 999 !important; /* Menor que el dropdown */
}

/* Los tooltips deben ocultarse cuando un dropdown está abierto */
.wa-header .dropdown.dropdown-open .tooltip:before,
.wa-header .dropdown.dropdown-open .tooltip:after {
  opacity: 0 !important;
  visibility: hidden !important;
}
