/* ── Embedded shortcode widget ─────────────────────────────────────────────── */
#dairect-chat-widget {
  max-width: 600px;
  margin: 20px auto;
  padding: 16px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #ccc;
  font-family: sans-serif;
  font-size: 16px;
  box-sizing: border-box;
}
#chat-messages {
  height: 300px;
  overflow-y: auto;
  margin-bottom: 10px;
}

/* ── Shared message bubble styles (embedded + drawer) ──────────────────────── */
.chat-user, .chat-ai {
  max-width: 75%;
  padding: 12px;
  margin: 6px;
  border-radius: 12px;
  animation: dairect-fade-in 0.3s ease-in-out;
  word-break: break-word;
}
.chat-user {
  background: #dcf8c6;
  margin-left: auto;
}
.chat-ai {
  background: #f1f0f0;
  margin-right: auto;
}

/* ── Input wrapper (mic inside text field) ─────────────────────────────────── */
.dairect-input-wrap {
  position: relative;
  display: block;
  margin-bottom: 0;
}
.dairect-input-wrap input {
  padding-right: 40px; /* room for mic button */
}

/* ── Mic button ────────────────────────────────────────────────────────────── */
.dairect-mic-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #9ca3af;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
  line-height: 0;
}
.dairect-mic-btn:hover {
  color: #6b7280;
  background: rgba(0, 0, 0, 0.05);
}
.dairect-mic-btn.is-listening {
  color: var(--dairect-accent, #6366f1);
  animation: dairect-pulse 1.4s ease-in-out infinite;
}
.dairect-mic-btn.is-error {
  color: #d63638;
}

/* ── Embedded widget controls ──────────────────────────────────────────────── */
#dairect-chat-widget button:not(.dairect-mic-btn) {
  padding: 10px 14px;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
}
#chat-send {
  background: var(--dairect-accent, #6366f1);
  color: #fff;
  border: none;
}
#chat-clear {
  display: none !important;
}
input#chat-input {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  box-sizing: border-box;
}

/* ── Floating button ───────────────────────────────────────────────────────── */
#dairect-float-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  z-index: 100000;
  background: var(--dairect-accent, #6366f1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Pop-in applied by JS then removed after playing — prevents hover reflow from restarting it */
#dairect-float-btn.dairect-pop-in {
  animation: dairect-pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s both;
}
#dairect-float-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
#dairect-float-btn svg {
  pointer-events: none;
}
#dairect-float-btn.dairect-jump {
  animation: dairect-jump 0.75s ease-in-out forwards;
}
#dairect-float-btn.is-behind {
  z-index: 99998;
  transform: translateY(120px);
  opacity: 0;
}
#dairect-float-btn.is-dropping {
  animation: dairect-btn-drop 0.35s ease-in forwards;
}
#dairect-float-btn.is-returning {
  animation: dairect-btn-return 0.6s ease-out forwards;
}

/* ── Floating drawer ───────────────────────────────────────────────────────── */
#dairect-float-drawer {
  position: fixed;
  top: 0;
  right: 0;
  max-width: 100vw;
  height: 100%;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  font-family: sans-serif;
  font-size: 16px;
}
#dairect-float-drawer.is-open {
  transform: translateX(0);
}

/* Drawer header */
#dairect-float-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--dairect-accent, #6366f1);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}
#dairect-float-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
#dairect-float-close:hover {
  opacity: 0.8;
}

/* Drawer message list */
#dairect-float-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* Drawer input area */
#dairect-float-input-area {
  padding: 12px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  flex-shrink: 0;
}
#dairect-float-input-area .dairect-input-wrap {
  margin-bottom: 8px;
}
#dairect-float-input {
  width: 100%;
  padding: 10px;
  font-size: 15px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-sizing: border-box;
}
#dairect-float-input-area .dairect-actions {
  display: flex;
  gap: 8px;
}
#dairect-float-input-area .dairect-actions button {
  padding: 8px 14px;
  font-size: 15px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
}
#dairect-float-send {
  background: var(--dairect-accent, #6366f1) !important;
  color: #fff !important;
  border-color: var(--dairect-accent, #6366f1) !important;
}
#dairect-float-input-area #dairect-float-clear {
  color: #4b5563 !important;
  background-color: #f3f4f6 !important;
  border-color: #d1d5db !important;
  font-size: 15px !important;
  opacity: 1 !important;
  visibility: visible !important;
}
#dairect-float-input-area #dairect-float-clear:hover {
  color: #111827 !important;
  background-color: #e5e7eb !important;
}

/* ── Animations ────────────────────────────────────────────────────────────── */
@keyframes dairect-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

@keyframes dairect-btn-drop {
  0%   { transform: translateY(0);     opacity: 1; }
  100% { transform: translateY(120px); opacity: 0; }
}

@keyframes dairect-btn-return {
  0%   { transform: translateY(120px); opacity: 0; }
  22%  { opacity: 1; }
  58%  { transform: translateY(-14px); }
  74%  { transform: translateY(4px);  }
  87%  { transform: translateY(-5px); }
  100% { transform: translateY(0);    opacity: 1; }
}

@keyframes dairect-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes dairect-pop-in {
  0%   { transform: scale(0);    opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  80%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}

@keyframes dairect-jump {
  0%   { transform: translateY(0)     scale(1);    }
  35%  { transform: translateY(-16px) scale(1.05); }
  65%  { transform: translateY(-11px) scale(1.02); }
  82%  { transform: translateY(-14px) scale(1.03); }
  100% { transform: translateY(0)     scale(1);    }
}
