/*
 * Exotica AI Chatbot — chatbot.css v1.1.0
 *
 * All rules scoped to .exotica-chatbot-* or .ecb-*
 * Google Fonts (Inter / Space Grotesk) loaded via PHP wp_enqueue_style
 * CSS variables defined on :root wrapper element so child elements inherit
 */

/* ── Design tokens (scoped inside the window element) ───── */
.exotica-chatbot-window,
.exotica-chatbot-fab {
  --ecb-primary:       270 80% 60%;
  --ecb-primary-fg:    0 0% 100%;
  --ecb-accent:        300 90% 50%;
  --ecb-card:          250 25% 10%;
  --ecb-secondary:     250 25% 14%;
  --ecb-secondary-fg:  0 0% 98%;
  --ecb-fg:            0 0% 98%;
  --ecb-muted:         250 15% 20%;
  --ecb-muted-fg:      250 10% 60%;
  --ecb-border:        250 20% 18%;
  --ecb-cta:           linear-gradient(135deg, hsl(270 80% 55%), hsl(300 90% 50%));
  --ecb-purple:        linear-gradient(135deg, hsl(270 80% 60%), hsl(300 80% 55%));
  --ecb-glow:          0 0 30px rgba(168,85,247,.4);
  --ecb-card-shadow:   0 4px 24px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.05);

  /* Reset only inside our elements */
  box-sizing: border-box;
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Ensure all children also use border-box */
.exotica-chatbot-window *,
.exotica-chatbot-window *::before,
.exotica-chatbot-window *::after {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
}

/* ── Floating Action Button ──────────────────────────────── */
.exotica-chatbot-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999990;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--ecb-cta);
  color: hsl(var(--ecb-primary-fg));
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
  transition: transform .2s, box-shadow .2s;
}
.exotica-chatbot-fab:hover,
.exotica-chatbot-fab:focus-visible {
  box-shadow: var(--ecb-glow);
  transform: scale(1.05);
  outline: none;
}
.exotica-chatbot-fab svg {
  width: 1.5rem;
  height: 1.5rem;
  pointer-events: none;
}
.exotica-chatbot-fab.ecb-hidden {
  display: none;
}

/* ── Chat Window ─────────────────────────────────────────── */
.exotica-chatbot-window {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999991;
  width: 380px;
  max-width: calc(100vw - 2rem);
  height: 580px;
  max-height: calc(100vh - 3rem);
  background: hsl(var(--ecb-card));
  border-radius: 1rem;
  box-shadow: var(--ecb-card-shadow);
  overflow: hidden;
  display: none;
  flex-direction: column;
}
.exotica-chatbot-window.ecb-open {
  display: flex;
  animation: ecbSlideUp .28s cubic-bezier(.22,.68,0,1.2) both;
}
@keyframes ecbSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(.94); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

/* Responsive: on small screens, fill almost the whole viewport */
@media (max-width: 420px) {
  .exotica-chatbot-window {
    width: calc(100vw - 1rem);
    height: calc(100vh - 5rem);
    bottom: 4.5rem;
    right: .5rem;
    border-radius: .75rem;
  }
}

/* ── Header ──────────────────────────────────────────────── */
.ecb-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.25rem;
  background: var(--ecb-cta);
  flex-shrink: 0;
}
.ecb-header img {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.3);
  flex-shrink: 0;
}
.ecb-header-info {
  flex: 1;
  min-width: 0;
}
.ecb-header-info p {
  font-size: .875rem;
  font-weight: 600;
  color: hsl(var(--ecb-primary-fg));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ecb-header-info small {
  font-size: .75rem;
  color: rgba(255,255,255,.7);
}
.ecb-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  padding: .25rem;
  display: flex;
  align-items: center;
  border-radius: .25rem;
  transition: color .2s;
  flex-shrink: 0;
}
.ecb-close:hover,
.ecb-close:focus-visible {
  color: #fff;
  outline: 2px solid rgba(255,255,255,.4);
}
.ecb-close svg {
  width: 1.25rem;
  height: 1.25rem;
  pointer-events: none;
}

/* ── Messages ────────────────────────────────────────────── */
.ecb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: rgba(255,255,255,.015);
  scroll-behavior: smooth;
}
.ecb-messages::-webkit-scrollbar { width: 4px; }
.ecb-messages::-webkit-scrollbar-track { background: transparent; }
.ecb-messages::-webkit-scrollbar-thumb { background: hsl(var(--ecb-muted)); border-radius: 2px; }

.ecb-msg {
  display: flex;
  animation: ecbMsgIn .22s ease-out both;
}
@keyframes ecbMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}
.ecb-msg.ecb-user      { justify-content: flex-end; }
.ecb-msg.ecb-assistant { justify-content: flex-start; }

.ecb-msg-inner {
  max-width: 85%;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.ecb-bubble {
  padding: .875rem 1rem;
  font-size: .875rem;
  line-height: 1.65;
  border-radius: 1rem;
  word-break: break-word;
}
.ecb-msg.ecb-assistant .ecb-bubble {
  background: hsl(var(--ecb-secondary));
  color: hsl(var(--ecb-secondary-fg));
  border-bottom-left-radius: .25rem;
}
.ecb-msg.ecb-user .ecb-bubble {
  background: var(--ecb-cta);
  color: hsl(var(--ecb-primary-fg));
  border-bottom-right-radius: .25rem;
}

/* Quick replies */
.ecb-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
}
.ecb-quick-reply {
  font-size: .75rem;
  font-family: inherit;
  padding: .375rem .75rem;
  border-radius: 9999px;
  border: 1px solid hsl(var(--ecb-primary) / .35);
  color: hsl(var(--ecb-primary));
  background: transparent;
  cursor: pointer;
  transition: background .2s, box-shadow .2s;
}
.ecb-quick-reply:hover,
.ecb-quick-reply:focus-visible {
  background: hsl(var(--ecb-primary) / .12);
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--ecb-primary) / .3);
}

/* Typing indicator */
.ecb-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: .75rem 1rem;
  background: hsl(var(--ecb-secondary));
  border-radius: 1rem;
  border-bottom-left-radius: .25rem;
  width: 72px;
}
.ecb-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: hsl(var(--ecb-primary));
  animation: ecbDot 1.4s ease-in-out infinite;
}
.ecb-dot:nth-child(2) { animation-delay: .18s; }
.ecb-dot:nth-child(3) { animation-delay: .36s; }
@keyframes ecbDot {
  0%,60%,100% { opacity: .25; transform: translateY(0);    }
  30%          { opacity: 1;   transform: translateY(-5px); }
}

/* ── Input Area ──────────────────────────────────────────── */
.ecb-input-area {
  padding: .75rem 1rem;
  border-top: 1px solid hsl(var(--ecb-border) / .5);
  flex-shrink: 0;
}
.ecb-input-form {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: hsl(var(--ecb-secondary));
  border-radius: .75rem;
  padding: 0 .75rem;
  transition: box-shadow .2s;
}
.ecb-input-form:focus-within {
  box-shadow: 0 0 0 2px hsl(var(--ecb-primary) / .4);
}
.ecb-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: .875rem;
  font-family: inherit;
  color: hsl(var(--ecb-fg));
  padding: .75rem 0;
}
.ecb-input::placeholder { color: hsl(var(--ecb-muted-fg)); }
.ecb-send {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--ecb-cta);
  color: hsl(var(--ecb-primary-fg));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow .2s, opacity .2s;
  flex-shrink: 0;
}
.ecb-send:disabled { opacity: .3; cursor: not-allowed; }
.ecb-send:not(:disabled):hover,
.ecb-send:not(:disabled):focus-visible {
  box-shadow: var(--ecb-glow);
  outline: none;
}
.ecb-send svg { width: .875rem; height: .875rem; pointer-events: none; }

/* ── Tabs ────────────────────────────────────────────────── */
.ecb-tabs {
  display: flex;
  border-top: 1px solid hsl(var(--ecb-border) / .5);
  flex-shrink: 0;
}
.ecb-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: .65rem 0;
  font-size: 10px;
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
  color: hsl(var(--ecb-muted-fg));
  transition: color .2s;
}
.ecb-tab.ecb-active { color: hsl(var(--ecb-primary)); }
.ecb-tab:hover      { color: hsl(var(--ecb-fg)); }
.ecb-tab:focus-visible { outline: 2px solid hsl(var(--ecb-primary) / .5); outline-offset: -2px; }
.ecb-tab svg { width: 1rem; height: 1rem; pointer-events: none; }

/* ── Footer ──────────────────────────────────────────────── */
.ecb-footer {
  text-align: center;
  font-size: 10px;
  color: hsl(var(--ecb-muted-fg));
  padding: .5rem 0;
  border-top: 1px solid hsl(var(--ecb-border) / .5);
  flex-shrink: 0;
}
.ecb-footer span {
  font-weight: 600;
  background: var(--ecb-purple);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
