/* Chatbot Mewset - Estilos */
:root {
  --chat-bg: #0f172a;
  --chat-header-bg: linear-gradient(135deg, #0b2b45, #051523);
  --chat-text: #e5e7eb;
  --chat-accent: #59b8ff;
  --chat-user-msg-bg: #2563eb;
  --chat-bot-msg-bg: #1e293b;
  --chat-border: rgba(148, 163, 184, 0.2);
  --chat-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  --chat-font: "Inter", system-ui, sans-serif;
}

/* Botón flotante */
#mewbot-trigger {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  background: var(--chat-header-bg);
  border-radius: 50%;
  box-shadow: 0 4px 20px rgba(89, 184, 255, 0.4);
  border: 1px solid var(--chat-accent);
  cursor: pointer;
  z-index: 2147483647;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.27);
}

#mewbot-trigger:hover {
  transform: scale(1.1);
}

#mewbot-trigger svg {
  width: 32px;
  height: 32px;
  fill: var(--chat-accent);
}

/* Ventana del chat */
#mewbot-window {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 350px;
  height: 500px;
  background: var(--chat-bg);
  border-radius: 16px;
  box-shadow: var(--chat-shadow);
  border: 1px solid var(--chat-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2147483646;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s ease;
  font-family: var(--chat-font);
}

#mewbot-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Cabecera */
.mewbot-header {
  padding: 15px 20px;
  background: var(--chat-header-bg);
  border-bottom: 1px solid var(--chat-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mewbot-title {
  font-weight: 600;
  color: var(--chat-text);
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mewbot-status {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 5px #22c55e;
}

.mewbot-close {
  background: none;
  border: none;
  color: var(--chat-text);
  cursor: pointer;
  font-size: 1.2rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.mewbot-close:hover {
  opacity: 1;
}

/* Cuerpo de mensajes */
.mewbot-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  scroll-behavior: smooth;
}

/* Mensajes */
.mewbot-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  position: relative;
  word-wrap: break-word;
}

.mewbot-msg.bot {
  align-self: flex-start;
  background: var(--chat-bot-msg-bg);
  color: var(--chat-text);
  border-bottom-left-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.mewbot-msg.user {
  align-self: flex-end;
  background: var(--chat-user-msg-bg);
  color: white;
  border-bottom-right-radius: 2px;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

/* Opciones / Botones */
.mewbot-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 5px;
}

.mewbot-option-btn {
  background: rgba(89, 184, 255, 0.1);
  border: 1px solid rgba(89, 184, 255, 0.3);
  color: var(--chat-accent);
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.mewbot-option-btn:hover {
  background: rgba(89, 184, 255, 0.2);
  transform: translateY(-1px);
}

/* Animación de escribiendo */
.mewbot-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--chat-bot-msg-bg);
  border-radius: 12px;
  align-self: flex-start;
  width: fit-content;
  border-bottom-left-radius: 2px;
}

.mewbot-dot {
  width: 6px;
  height: 6px;
  background: var(--chat-text);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
  opacity: 0.6;
}

.mewbot-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.mewbot-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {

  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}

/* Scrollbar */
.mewbot-body::-webkit-scrollbar {
  width: 6px;
}

.mewbot-body::-webkit-scrollbar-track {
  background: transparent;
}

.mewbot-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

/* Mobile */
@media (max-width: 480px) {
  #mewbot-window {
    width: calc(100% - 40px);
    bottom: 100px;
    right: 20px;
    left: 20px;
    height: 60vh;
  }
}

/* Input Area (ChatGPT/Gemini Style) */
.mewbot-input-area {
  padding: 16px;
  background: var(--chat-bg);
  border-top: 1px solid var(--chat-border);
  display: flex;
  gap: 10px;
  align-items: center;
}

#mewbot-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--chat-border);
  border-radius: 24px;
  padding: 12px 18px;
  color: var(--chat-text);
  font-family: var(--chat-font);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

#mewbot-input::placeholder {
  color: rgba(229, 231, 235, 0.4);
}

#mewbot-input:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--chat-accent);
  box-shadow: 0 0 0 3px rgba(89, 184, 255, 0.15);
}

#mewbot-send {
  background: var(--chat-accent);
  color: #020617;
  border: none;
  border-radius: 24px;
  padding: 0 20px;
  height: 42px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#mewbot-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(89, 184, 255, 0.3);
}

#mewbot-send:active {
  transform: translateY(0);
}

.mewbot-open-modal-btn {
  margin-top: 12px;
  padding: 10px 16px;
  background: var(--chat-accent);
  color: #020617;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mewbot-open-modal-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(89, 184, 255, 0.32);
}

.mewbot-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 2147483647 !important;
}

.mewbot-modal>* {
  pointer-events: none;
}

.mewbot-modal.open {
  opacity: 1;
  pointer-events: all;
  visibility: visible;
}

.mewbot-modal.open>* {
  pointer-events: auto;
}

.mewbot-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
}

.mewbot-modal.open .mewbot-modal-backdrop {
  pointer-events: auto;
}

.mewbot-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: #ffffff;
  color: #0f172a;
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 22px 80px rgba(15, 23, 42, 0.45);
  font-family: var(--chat-font);
}

.mewbot-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: none;
  background: transparent;
  font-size: 1.4rem;
  color: rgba(15, 23, 42, 0.55);
  cursor: pointer;
  transition: color 0.2s ease;
}

.mewbot-modal-close:hover {
  color: rgba(15, 23, 42, 0.85);
}

.mewbot-modal-lead {
  margin: 0 0 20px 0;
  color: rgba(15, 23, 42, 0.7);
  font-size: 0.95rem;
}

.mewbot-modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mewbot-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: rgba(15, 23, 42, 0.75);
}

.mewbot-field input,
.mewbot-field textarea {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  font-family: var(--chat-font);
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mewbot-field input:focus,
.mewbot-field textarea:focus {
  outline: none;
  border-color: var(--chat-accent);
  box-shadow: 0 0 0 3px rgba(89, 184, 255, 0.2);
}

.mewbot-field textarea {
  resize: vertical;
  min-height: 90px;
}

.mewbot-modal-submit {
  margin-top: 6px;
  background: var(--chat-accent);
  color: #020617;
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mewbot-modal-submit:disabled {
  opacity: 0.65;
  cursor: wait;
}

.mewbot-modal-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(89, 184, 255, 0.28);
}

.mewbot-modal-status {
  min-height: 18px;
  font-size: 0.8rem;
  color: #ef4444;
}

.mewbot-modal-status.error {
  color: #ef4444;
}

.mewbot-modal-status.success {
  color: #16a34a;
}

body.mewbot-modal-open {
  overflow: hidden;
}

@media (max-width: 540px) {
  .mewbot-modal-dialog {
    padding: 28px 22px;
  }
}