/**
 * Fastalk Embed Styles
 * Version: 8.0.0 (FINAL - CORRECCIÓN Z-INDEX DESKTOP)
 */

/* =================================================================== */
/* == ESTILOS BASE Y GLOBALES ======================================== */
/* =================================================================== */

.fastalk-widget-container {
  position: relative;
  z-index: 1000;
}

.fastalk-iframe {
  border: none;
}

/* ¡¡¡ESTA ES LA CORRECCIÓN CLAVE PARA ESCRITORIO!!! */
/* Oculta el widget de voz cuando el chat está abierto en CUALQUIER vista. */
body.fastalk-chat-mobile-open .fastalk-voice-widget,
body.fastalk-chat-desktop-open .fastalk-voice-widget {
  display: none;
}


/* =================================================================== */
/* == WIDGET ASISTENTE DE VOZ  ========================================= */
/* =================================================================== */
.fastalk-voice-widget .fastalk-toggle-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 65px;
  height: 65px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 990;
  transition: background 0.3s ease, transform 0.2s ease, bottom 0.4s ease, box-shadow 0.3s ease;
}

.fastalk-voice-widget .fastalk-toggle-button:hover {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 6px 16px var(--fastalk-voice-shadow-color, rgba(0, 0, 0, 0.15));
  transform: scale(1.05);
}

.fastalk-voice-widget .fastalk-toggle-button:active {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(0.95);
}

.fastalk-voice-widget .fastalk-toggle-button.moved {
  bottom: 355px;
}

.fastalk-voice-widget .fastalk-iframe-wrapper {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 448px;
  height: 252px;
  border-radius: 30px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  z-index: 999;
  background: white;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}

.fastalk-voice-widget .fastalk-iframe-wrapper.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.fastalk-voice-widget .fastalk-iframe {
  width: 1280px;
  height: 720px;
  transform: scale(0.35);
  transform-origin: top left;
}

/* =================================================================== */
/* == WIDGET CHATBOT DE TEXTO ======================================== */
/* =================================================================== */
.fastalk-chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 65px;
  height: 65px;
  z-index: 991;
}

.fastalk-chat-widget .fastalk-toggle-button,
.fastalk-chat-widget .fastalk-close-button {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.fastalk-chat-widget .fastalk-toggle-button:hover,
.fastalk-chat-widget .fastalk-close-button:hover {
  transform: scale(1.1);
}

.fastalk-chat-widget .fastalk-toggle-button {
  opacity: 1;
  transform: scale(1);
}

.fastalk-chat-widget .fastalk-close-button {
  opacity: 0;
  transform: scale(0.5);
  pointer-events: none;
}

.fastalk-chat-widget.is-open .fastalk-toggle-button {
  opacity: 0;
  transform: scale(0.5);
  pointer-events: none;
}

.fastalk-chat-widget.is-open .fastalk-close-button {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.fastalk-chat-widget .welcome-message {
  padding: 20px;
  align-items: center;
  width: 220px;
  position: absolute;
  bottom: 100%;
  right: 0;
  background-color: white;
  border-radius: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  margin-bottom: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.fastalk-chat-widget .welcome-message p {
  padding: 10px;
  font-size: 16px;
  font-family: system-ui, sans-serif;
  font-weight: 300;
  margin: 0;
}

.fastalk-chat-widget:not(.is-open):hover .welcome-message {
  opacity: 1;
}

.fastalk-chat-widget .fastalk-iframe {
  display: block;
  width: 350px;
  height: 700px;
  max-height: calc(100vh - 105px);
  border-radius: 20px;
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease;
  transform-origin: bottom right;
  transform: scale(0);
  opacity: 0;
  position: fixed;
  bottom: 95px;
  right: 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  /* El z-index ya no es necesario aquí, la visibilidad se controla con display */
}

.fastalk-chat-widget.is-open .fastalk-iframe {
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
}

.fastalk-chat-widget .fastalk-mobile-close-button {
  position: fixed;
  top: 15px;
  right: 15px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 10002;
}

body.fastalk-chat-mobile-open .fastalk-chat-widget .fastalk-mobile-close-button {
  display: flex;
}

/* =================================================================== */
/* == POSICIONAMIENTO DINÁMICO ======================================= */
/* =================================================================== */
body.fastalk-multiple-widgets-active .fastalk-voice-widget .fastalk-toggle-button {
  bottom: 100px;
}

body.fastalk-multiple-widgets-active .fastalk-voice-widget .fastalk-toggle-button.moved {
  bottom: 365px;
}

/* =================================================================== */
/* == MEDIA QUERIES ================================================== */
/* =================================================================== */
@media (max-width: 768px) {

  .fastalk-chat-widget.is-open .fastalk-close-button,
  .fastalk-chat-widget.is-open .fastalk-toggle-button {
    display: none;
  }

  .fastalk-chat-widget .fastalk-iframe {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    bottom: 0;
    right: 0;
    transform: translateY(100%);
    opacity: 1;
    z-index: 10001;
  }

  .fastalk-chat-widget.is-open .fastalk-iframe {
    transform: translateY(0);
  }
}

@media (max-width: 600px) {
  .fastalk-voice-widget .fastalk-iframe-wrapper {
    width: 320px;
    height: 180px;
  }

  .fastalk-voice-widget .fastalk-iframe {
    transform: scale(0.25);
  }

  .fastalk-voice-widget .fastalk-toggle-button.moved {
    bottom: 280px;
  }

  body.fastalk-multiple-widgets-active .fastalk-voice-widget .fastalk-toggle-button.moved {
    bottom: 290px;
  }
}