/* Gliro Chatbot — estilos del widget. Usa valores directos (no variables
   CSS del tema) para no depender de que el tema defina --dark, --green, etc. */

#chat-widget * {
  box-sizing: border-box;
}

/* El atributo HTML "hidden" no gana por si solo si otra regla de la misma
   especificidad (ej. ".chat-form{display:flex}") tambien aplica display.
   Forzamos que gane siempre, para que el formulario de registro y el chat
   nunca se muestren los dos a la vez. */
#chat-widget [hidden] {
  display: none !important;
}

#chat-toggle {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #282c2f;
  color: #ffffff;
  border: none;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 25px -8px rgba(40, 44, 47, 0.5);
  z-index: 999999;
  transition: transform 0.2s ease, background 0.2s ease;
  line-height: 1;
}
#chat-toggle:hover {
  transform: scale(1.08);
  background: #3c3e41;
}

#chat-panel {
  position: fixed;
  bottom: 90px;
  right: 22px;
  width: 340px;
  max-width: calc(100vw - 32px);
  height: 460px;
  max-height: calc(100vh - 140px);
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 24px 50px -20px rgba(40, 44, 47, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999999;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
#chat-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chat-header {
  background: #282c2f;
  color: #ffffff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.chat-header strong {
  display: block;
  font-size: 14.5px;
}
.chat-header .chat-status {
  font-size: 11.5px;
  color: #1ff080;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.chat-header .chat-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1ff080;
  display: inline-block;
}
#chat-close {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
}
#chat-close:hover {
  opacity: 1;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #ffffff;
}
.chat-bubble {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.chat-bubble-assistant {
  align-self: flex-start;
  background: rgba(31, 240, 128, 0.14);
  color: #282c2f;
  border-bottom-left-radius: 4px;
}
.chat-bubble-user {
  align-self: flex-end;
  background: #282c2f;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
.chat-note {
  align-self: center;
  font-size: 11.5px;
  font-weight: 600;
  color: #282c2f;
  background: rgba(31, 240, 128, 0.14);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(31, 240, 128, 0.4);
}

.chat-typing span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3c3e41;
  margin-right: 3px;
  opacity: 0.4;
  animation: gliroChatTyping 1s infinite;
}
.chat-typing span:nth-child(2) {
  animation-delay: 0.15s;
}
.chat-typing span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes gliroChatTyping {
  0%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(40, 44, 47, 0.12);
  background: #ffffff;
  flex-shrink: 0;
}
.chat-form input {
  flex: 1;
  border: 1px solid rgba(40, 44, 47, 0.14);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: inherit;
  color: #282c2f;
  min-width: 0;
}
.chat-form input:focus {
  outline: 2px solid #1ff080;
  border-color: transparent;
}
.chat-form button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #1ff080;
  color: #282c2f;
  border: none;
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  transition: filter 0.15s ease;
}
.chat-form button:hover {
  filter: brightness(0.93);
}

@media (max-width: 480px) {
  #chat-panel {
    right: 16px;
    left: 16px;
    width: auto;
    bottom: 82px;
  }
  #chat-toggle {
    right: 16px;
  }
}

/* ---------- Formulario obligatorio previo al chat ---------- */
.chat-register {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #ffffff;
}
.chat-register-intro {
  margin: 0;
  font-size: 13.5px;
  color: #282c2f;
  line-height: 1.45;
}
.chat-register form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-register label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: #3c3e41;
}
.chat-register input {
  border: 1px solid rgba(40, 44, 47, 0.16);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 13.5px;
  font-family: inherit;
  color: #282c2f;
}
.chat-register input:focus {
  outline: 2px solid #1ff080;
  border-color: transparent;
}
.chat-register-hint {
  margin: 0;
  font-size: 11.5px;
  color: #636160;
}
.chat-register-error {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #8a2a1f;
  background: #fdeceb;
  border: 1px solid #e0a79f;
  border-radius: 8px;
  padding: 8px 10px;
}
.btn-register {
  margin-top: 4px;
  border: none;
  border-radius: 999px;
  background: #1ff080;
  color: #282c2f;
  font-weight: 700;
  font-size: 13.5px;
  padding: 11px 16px;
  cursor: pointer;
  transition: filter 0.15s ease;
}
.btn-register:hover {
  filter: brightness(0.93);
}
.btn-register:disabled {
  opacity: 0.6;
  cursor: default;
}
