/* Layout base */
.layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: white;
  overflow: hidden;
  padding: 20px;
  box-sizing: border-box;
}

.video-container {
  position: relative;
  width: 95vw;
  max-width: 900px;
  max-height: 95vh;
  aspect-ratio: 1 / 1;
}

#bg-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: white;
}

/* Player flotante refinado */
#custom-player {
  position: fixed;
  bottom: 40px; /* más separado del borde inferior */
  right: 40px; /* más separado del borde derecho */
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.75); /* negro semitransparente */
  backdrop-filter: blur(6px);
  border-radius: 40px;
  padding: 10px 18px;
  cursor: pointer;
  z-index: 20;
  gap: 12px;
  transform: scale(1.3); /* tamaño más balanceado */
  opacity: 0;
  animation: fadeIn 0.8s ease-out forwards;
}

/* Fade-in suave */
@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* Botón Play/Pause minimalista */
#play-button {
  width: 0;
  height: 0;
  border-left: 20px solid white;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
}
#play-button.playing {
  border: none;
  width: 16px;
  height: 16px;
  background: white;
  clip-path: polygon(
    0 0,
    30% 0,
    30% 100%,
    0 100%,
    70% 100%,
    70% 0,
    100% 0,
    100% 100%,
    0 100%
  );
}

/* Onda minimalista */
#wave {
  display: flex;
  align-items: flex-end;
  height: 20px;
}
#wave span {
  display: block;
  width: 2.5px; /* más delgadas */
  height: 6px;
  margin: 0 1px;
  background: white;
  animation: wave 1.2s infinite ease-in-out;
}
#wave span:nth-child(2) {
  animation-delay: 0.2s;
}
#wave span:nth-child(3) {
  animation-delay: 0.4s;
}
#wave span:nth-child(4) {
  animation-delay: 0.6s;
}
#wave span:nth-child(5) {
  animation-delay: 0.8s;
}

@keyframes wave {
  0%,
  40%,
  100% {
    height: 6px;
  }
  20% {
    height: 20px;
  }
}

/* === Chatbot widget === */
#chatbot-toggle {
  position: fixed;
  bottom: 110px; /* encima del player actual */
  right: 40px;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 22px;
  border-radius: 999px;
  cursor: pointer;
  z-index: 30;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, opacity 0.2s ease;
}
#chatbot-toggle:hover {
  transform: translateY(-2px) scale(1.02);
}

#chatbot-window {
  position: fixed;
  bottom: 180px;
  right: 40px;
  width: min(92vw, 360px);
  height: 520px;
  display: flex;
  flex-direction: column;
  background: rgba(10, 10, 10, 0.92);
  color: #fff;
  border-radius: 20px;
  backdrop-filter: blur(8px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  z-index: 40;
  overflow: hidden;
  opacity: 1;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
#chatbot-window.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
}

.cb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
#chatbot-close {
  background: transparent;
  color: #fff;
  border: 0;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.cb-messages {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.35;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.msg.bot {
  background: rgba(255, 255, 255, 0.08);
  align-self: flex-start;
}
.msg.user {
  background: rgba(255, 255, 255, 0.16);
  align-self: flex-end;
}

.cb-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
#chatbot-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  outline: none;
}
#chatbot-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}
#chatbot-send {
  padding: 10px 14px;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  background: #ffffff;
  color: #000;
  font-weight: 600;
}

/* Mobile tweaks (evitar choque con el player) */
@media (max-width: 520px) {
  #chatbot-toggle {
    right: 16px;
    bottom: 96px;
  }
  #chatbot-window {
    right: 16px;
    bottom: 160px;
    height: 60vh;
  }
}
/* Z-index muy alto y clics garantizados */
#chatbot-toggle,
#chatbot-window {
  z-index: 2147483647;
  pointer-events: auto;
}

#chatbot-toggle {
  position: fixed;
  bottom: 110px;
  right: 40px;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
#chatbot-window {
  position: fixed;
  bottom: 180px;
  right: 40px;
  width: min(92vw, 360px);
  height: 520px;
  display: flex;
  flex-direction: column;
  background: rgba(10, 10, 10, 0.92);
  color: #fff;
  border-radius: 20px;
  overflow: hidden;
}
#chatbot-window.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: 0.2s;
}
.cb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
}
.cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.35;
  white-space: pre-wrap;
}
.msg.bot {
  background: rgba(255, 255, 255, 0.08);
  align-self: flex-start;
}
.msg.user {
  background: rgba(255, 255, 255, 0.16);
  align-self: flex-end;
}
.cb-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.06);
}
#chatbot-input {
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
#chatbot-send {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: #fff;
  color: #000;
  font-weight: 600;
  cursor: pointer;
}
@media (max-width: 520px) {
  #chatbot-toggle,
  #chatbot-window {
    z-index: 2147483647; /* muy por encima de video y player */
    pointer-events: auto;
  }
}
