:root {
  --primary-blue: #00aeef;
  --primary-green: #39b54a;
  --primary-purple: #6b3fa0;
  --text-dark: #1a1a1a;
  --bg-gray: #f3f3f3;
  --white: #ffffff;
  --border-soft: #e2e8f0;
}

#nbai-widget-root {
  width: 0;
  height: 0;
  max-width: none;
}

.nbai-widget,
#clarence-widget {
  width: 100%;
  max-width: 420px;
  height: 650px;
  background: var(--white);
  border-radius: 1.25rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.chat-header {
  background: var(--primary-purple);
  padding: 1.25rem;
  color: var(--white);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.nbai-widget-placeholder {
  width: 100%;
  max-width: 420px;
  height: 650px;
  border-radius: 1.25rem;
  background: #f3f3f3;
  border: 1px solid #e5e7eb;
}

.status-pill {
  background: rgba(255, 255, 255, 0.15);
  padding: 0.3rem 0.6rem;
  border-radius: 2rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  background: var(--bg-gray);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message-row {
  display: flex;
  gap: 0.75rem;
  max-width: 90%;
  animation: nbaiSlideUp 0.3s ease-out;
}

.row-clarence {
  align-self: flex-start;
}

.row-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--white);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.bubble {
  padding: 0.85rem 1rem;
  border-radius: 1.25rem;
  font-size: 0.95rem;
  line-height: 1.45;
}

.bubble-clarence {
  background: var(--white);
  border-top-left-radius: 0.2rem;
  border: 1px solid var(--border-soft);
  color: var(--text-dark);
}

.bubble-user {
  background: var(--primary-purple);
  color: var(--white);
  border-top-right-radius: 0.2rem;
}

.reframe {
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  display: block;
}

.list {
  margin: 0.5rem 0;
  padding-left: 1.2rem;
  font-size: 0.9rem;
  color: #4b5563;
}

.nbai-followup {
  margin-top: 0.75rem;
}

.cta-button,
.nbai-email-btn {
  display: inline-block;
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.75rem;
  background: var(--primary-green);
  color: var(--white);
  border: none;
  border-radius: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.cta-button:hover,
.nbai-email-btn:hover {
  transform: scale(1.02);
}

.chat-footer {
  padding: 1.25rem;
  background: var(--white);
  border-top: 1px solid var(--border-soft);
  position: relative;
}

.limit-alert {
  position: absolute;
  top: -2.5rem;
  left: 0;
  right: 0;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 0.75rem;
  text-align: center;
  padding: 0.5rem;
  font-weight: 600;
}

.input-wrapper,
.nbai-email-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chat-input {
  flex: 1;
  min-width: 0;
  padding: 0.85rem 1.25rem;
  border: 1.5px solid var(--border-soft);
  border-radius: 3rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.chat-input:focus {
  border-color: var(--primary-blue);
}

.send-btn {
  background: var(--primary-blue);
  color: var(--white);
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.typing {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 0 1.25rem 1rem;
  background: var(--bg-gray);
}

.bubble-typing {
  padding: 0.9rem 1rem;
  min-width: 72px;
}

.nbai-typing-dots {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nbai-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  animation: nbaiTypingPulse 1.15s infinite ease-in-out;
}

.nbai-typing-dot:nth-child(2) {
  animation-delay: 0.16s;
}

.nbai-typing-dot:nth-child(3) {
  animation-delay: 0.32s;
}

.nbai-email-gate {
  margin-bottom: 1rem;
}

.nbai-email-card {
  background: #f8fafc;
  border: 1px solid var(--border-soft);
  border-radius: 1rem;
  padding: 1rem;
}

.nbai-email-title {
  margin: 0 0 0.35rem;
  font-weight: 800;
  color: var(--text-dark);
}

.nbai-email-text {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  color: #475569;
}

.nbai-email-error {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: #b91c1c;
}

.hidden {
  display: none !important;
}

/* CONTINUE GATE (YES / NO) */
.nbai-continue-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.nbai-continue-actions .nbai-email-btn {
  flex: 1;
  text-align: center;
}

/* Botón secundario (No thanks) */
.nbai-secondary-btn {
  background: transparent;
  border: 1px solid #ccc;
  color: #555;
}

.nbai-secondary-btn:hover {
  background: #f5f5f5;
  border-color: #999;
}

/* Mejora visual de la card */
#nbai-continue-gate .nbai-email-card {
  text-align: center;
}

/* Título un poco más fuerte */
#nbai-continue-gate .nbai-email-title {
  font-weight: 600;
}

/* Texto más suave */
#nbai-continue-gate .nbai-email-text {
  font-size: 14px;
  color: #666;
}

/* =========================
   LAUNCHER BUBBLE
========================= */

#clarence-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 65px;
  height: 65px;
  border-radius: 999px;
  background: var(--primary-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition:
    transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    box-shadow 0.3s ease;
  isolation: isolate;
  overflow: visible;
}

#clarence-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

#clarence-launcher img {
  width: 85%;
  height: 85%;
  object-fit: cover;
  border-radius: 999px;
  border: 2px solid var(--white);
  display: block;
  position: relative;
  z-index: 2;
}

/* halo animado */
#clarence-launcher .pulse-effect {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--primary-purple);
  opacity: 0.55;
  z-index: 1;
  animation: nbaiLauncherPulse 2s infinite;
  pointer-events: none;
}

/* opcional: cuando el chat esté abierto */
#clarence-launcher.is-open {
  transform: scale(0.96);
}

/* panel flotante del chat */
.nbai-widget-panel {
  position: fixed;
  right: 20px;
  bottom: 100px;
  width: 400px;
  max-width: calc(100vw - 40px);
  height: 650px;
  max-height: calc(100vh - 120px);
  z-index: 999;
}

/* header controls */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nbai-close-btn {
  background: transparent;
  border: none;
  color: var(--white);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.82;
  transition:
    opacity 0.2s ease,
    background 0.2s ease;
}

.nbai-close-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.12);
}

.nbai-close-btn svg {
  display: block;
}

@keyframes nbaiLauncherPulse {
  0% {
    transform: scale(1);
    opacity: 0.55;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

@keyframes nbaiSlideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes nbaiTypingPulse {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0) scale(0.9);
  }

  40% {
    opacity: 1;
    transform: translateY(-2px) scale(1);
  }
}
