/* Kwamle Media — Floating AI Chat Widget styles */

.kwc-widget {
  position: fixed;
  bottom: 24px;
  inset-inline-end: 24px;
  z-index: 9999;
  font-family: inherit;
  --kwc-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
  --kwc-brand: #6366f1;
  --kwc-ink: #0f172a;
  --kwc-ink-2: #475569;
  --kwc-line: #e2e8f0;
  --kwc-bg: #ffffff;
  --kwc-bg-soft: #f8fafc;
}

/* ----- Launcher ----- */
.kwc-launcher {
  position: relative;
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 0;
  background: var(--kwc-grad);
  color: #fff;
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 18px 40px -10px rgba(99,102,241,.55), 0 6px 18px -4px rgba(15,23,42,.18);
  transition: transform .25s ease, box-shadow .25s ease;
}
.kwc-launcher:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 22px 50px -10px rgba(99,102,241,.65); }
.kwc-launcher:active { transform: scale(.96); }
.kwc-launcher-icon { width: 28px; height: 28px; }
.kwc-pulse {
  position: absolute;
  top: 6px; right: 6px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(34,197,94,.35);
  animation: kwc-pulse 2s infinite;
}
[dir="rtl"] .kwc-pulse { right: auto; left: 6px; }
@keyframes kwc-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(34,197,94,.35); }
  50% { box-shadow: 0 0 0 8px rgba(34,197,94,.0); }
}

/* ----- Panel ----- */
.kwc-panel {
  position: absolute;
  bottom: 76px;
  inset-inline-end: 0;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 110px);
  background: var(--kwc-bg);
  border-radius: 20px;
  box-shadow: 0 30px 80px -20px rgba(15,23,42,.35), 0 18px 36px -18px rgba(15,23,42,.25);
  display: flex; flex-direction: column;
  opacity: 0;
  transform: translateY(20px) scale(.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity .25s ease, transform .3s cubic-bezier(.2,.8,.3,1.1);
  border: 1px solid rgba(226,232,240,.7);
  overflow: hidden;
}
[dir="rtl"] .kwc-panel { transform-origin: bottom left; }
.kwc-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

/* ----- Header ----- */
.kwc-head {
  background: var(--kwc-grad);
  color: #fff;
  padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.kwc-head-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.kwc-avatar {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: rgba(255,255,255,.18);
  display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.25);
  flex-shrink: 0;
}
.kwc-avatar svg { width: 22px; height: 22px; }
.kwc-title { font-weight: 700; font-size: 1rem; line-height: 1.2; }
.kwc-status { font-size: 0.78rem; opacity: .85; display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.kwc-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.35); }
.kwc-head-actions { display: flex; gap: 4px; }
.kwc-icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,.1);
  border: 0;
  color: #fff;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s ease;
}
.kwc-icon-btn:hover { background: rgba(255,255,255,.2); }
.kwc-icon-btn svg { width: 16px; height: 16px; }

/* ----- Body ----- */
.kwc-body {
  flex: 1;
  background: var(--kwc-bg-soft);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.kwc-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 8px;
  display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.kwc-msgs::-webkit-scrollbar { width: 6px; }
.kwc-msgs::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.kwc-msg { display: flex; max-width: 100%; }
.kwc-msg.kwc-user { justify-content: flex-end; }
.kwc-msg.kwc-assistant { justify-content: flex-start; }
.kwc-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.55;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.kwc-user .kwc-bubble {
  background: var(--kwc-grad);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 6px 14px -4px rgba(99,102,241,.4);
}
[dir="rtl"] .kwc-user .kwc-bubble { border-bottom-right-radius: 14px; border-bottom-left-radius: 4px; }
.kwc-assistant .kwc-bubble {
  background: #fff;
  color: var(--kwc-ink);
  border: 1px solid var(--kwc-line);
  border-bottom-left-radius: 4px;
}
[dir="rtl"] .kwc-assistant .kwc-bubble { border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
.kwc-bubble a { color: inherit; text-decoration: underline; }
.kwc-user .kwc-bubble a { color: #fff; }

/* ----- Typing ----- */
.kwc-typing { display: inline-flex; align-items: center; gap: 4px; padding: 14px; }
.kwc-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: kwc-bounce 1.4s infinite ease-in-out;
}
.kwc-typing span:nth-child(2) { animation-delay: .15s; }
.kwc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes kwc-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .4; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* ----- Suggestions ----- */
.kwc-suggestions {
  padding: 4px 16px 12px;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.kwc-chip {
  padding: 7px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--kwc-line);
  color: var(--kwc-ink-2);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.kwc-chip:hover {
  border-color: var(--kwc-brand);
  color: var(--kwc-brand);
  background: rgba(99,102,241,.05);
}

/* ----- Footer / Input ----- */
.kwc-foot {
  padding: 12px 14px 14px;
  background: #fff;
  border-top: 1px solid var(--kwc-line);
}
.kwc-input-wrap {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--kwc-bg-soft);
  border: 1px solid var(--kwc-line);
  border-radius: 14px;
  padding: 8px 10px;
  transition: border-color .15s;
}
.kwc-input-wrap:focus-within { border-color: var(--kwc-brand); background: #fff; }
.kwc-input {
  flex: 1;
  border: 0;
  background: transparent;
  resize: none;
  font: inherit;
  font-size: 0.94rem;
  color: var(--kwc-ink);
  outline: none;
  padding: 4px 0;
  max-height: 120px;
  line-height: 1.4;
}
.kwc-input::placeholder { color: #94a3b8; }
.kwc-send {
  width: 36px; height: 36px;
  border: 0;
  border-radius: 10px;
  background: var(--kwc-grad);
  color: #fff;
  cursor: pointer;
  display: grid; place-items: center;
  transition: all .15s;
  flex-shrink: 0;
}
.kwc-send:hover { transform: scale(1.05); }
.kwc-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.kwc-send svg { width: 16px; height: 16px; }
[dir="rtl"] .kwc-send svg { transform: scaleX(-1); }
.kwc-powered {
  text-align: center;
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 8px;
  letter-spacing: 0.02em;
}

@media (max-width: 480px) {
  .kwc-widget { bottom: 14px; inset-inline-end: 14px; }
  .kwc-panel {
    width: calc(100vw - 28px);
    height: calc(100vh - 100px);
    bottom: 74px;
  }
  .kwc-launcher { width: 56px; height: 56px; }
  .kwc-launcher-icon { width: 26px; height: 26px; }
}


/* ============================================================
   v3 — Professional bot avatar + welcome popup
   ============================================================ */

/* Professional BotChar SVG launcher (replaces simple chat icon) */
.kwc-bot-avatar {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  position: relative;
}
.kwc-bot-avatar svg {
  width: 70%;
  height: 70%;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
  animation: kwcBotBob 3.5s ease-in-out infinite;
}
@keyframes kwcBotBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-2px) rotate(-1.5deg); }
}

/* Make launcher background clean white so the colored bot pops */
.kwc-launcher {
  background: #ffffff;
  border: 2px solid rgba(99, 102, 241, 0.15);
  box-shadow:
    0 8px 24px rgba(99, 102, 241, 0.25),
    0 4px 10px rgba(6, 182, 212, 0.15);
}
.kwc-launcher:hover {
  border-color: rgba(99, 102, 241, 0.30);
  transform: translateY(-3px) scale(1.04);
  box-shadow:
    0 12px 32px rgba(99, 102, 241, 0.35),
    0 6px 14px rgba(6, 182, 212, 0.20);
}

/* Hide the old simple chat-bubble icon (.kwc-launcher-icon) — replaced by .kwc-bot-avatar */
.kwc-launcher .kwc-launcher-icon { display: none; }

/* Online green dot on launcher (top-end corner) */
.kwc-online-dot {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #22c55e;
  border: 2.5px solid #ffffff;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
  animation: kwcOnlinePulse 2s ease-out infinite;
  z-index: 2;
  pointer-events: none;
}
@keyframes kwcOnlinePulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
  70%  { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ============================================================
   Welcome Popup (10s after page load) — country-aware greeting
   ============================================================ */
.kwc-popup {
  position: absolute;
  bottom: 80px;
  inset-inline-end: 0;
  width: 290px;
  background: #ffffff;
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 18px;
  box-shadow:
    0 16px 48px rgba(15, 23, 42, 0.20),
    0 6px 18px rgba(99, 102, 241, 0.15);
  padding: 18px 18px 16px 18px;
  font-family: inherit;
  font-size: 0.93rem;
  line-height: 1.6;
  color: #1e293b;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px) scale(.95);
  transition: opacity .35s cubic-bezier(.4,0,.2,1), transform .35s cubic-bezier(.4,0,.2,1);
  pointer-events: auto;
  z-index: 1;
}
.kwc-popup.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.kwc-popup:hover {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow:
    0 20px 56px rgba(15, 23, 42, 0.25),
    0 8px 22px rgba(99, 102, 241, 0.20);
}

/* Speech-bubble tail pointing to the launcher */
.kwc-pop-arrow {
  position: absolute;
  bottom: -8px;
  inset-inline-end: 28px;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-right: 1px solid rgba(99, 102, 241, 0.18);
  border-bottom: 1px solid rgba(99, 102, 241, 0.18);
  transform: rotate(45deg);
  border-radius: 0 0 4px 0;
}

/* Close (×) button */
.kwc-pop-close {
  position: absolute;
  top: 8px;
  inset-inline-end: 10px;
  width: 26px;
  height: 26px;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: all .15s;
  display: grid;
  place-items: center;
  padding: 0;
}
.kwc-pop-close:hover {
  background: rgba(99, 102, 241, 0.08);
  color: #1e293b;
}

.kwc-pop-text {
  font-weight: 500;
  color: #0f172a;
  margin-bottom: 12px;
  padding-inline-end: 22px;
  word-wrap: break-word;
}

.kwc-pop-cta {
  display: inline-block;
  width: 100%;
  padding: 9px 16px;
  background: var(--kwc-grad);
  color: #ffffff;
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.kwc-pop-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(99, 102, 241, 0.30);
}

/* Dark theme support */
:root[data-theme="dark"] .kwc-launcher {
  background: #1e293b;
  border-color: rgba(99, 102, 241, 0.40);
}
:root[data-theme="dark"] .kwc-online-dot {
  border-color: #1e293b;
}
:root[data-theme="dark"] .kwc-popup {
  background: #1e293b;
  border-color: rgba(99, 102, 241, 0.30);
  color: #e2e8f0;
}
:root[data-theme="dark"] .kwc-pop-text { color: #f1f5f9; }
:root[data-theme="dark"] .kwc-pop-arrow {
  background: #1e293b;
  border-right-color: rgba(99, 102, 241, 0.30);
  border-bottom-color: rgba(99, 102, 241, 0.30);
}
:root[data-theme="dark"] .kwc-pop-close { color: #94a3b8; }
:root[data-theme="dark"] .kwc-pop-close:hover { background: rgba(99, 102, 241, 0.18); color: #f1f5f9; }

/* RTL: keep arrow under launcher */
[dir="rtl"] .kwc-pop-arrow { inset-inline-end: 28px; }

/* Tiny screens */
@media (max-width: 380px) {
  .kwc-popup {
    width: calc(100vw - 36px);
    inset-inline-end: -10px;
  }
}
@media (max-width: 480px) {
  .kwc-popup { width: calc(100vw - 28px); max-width: 320px; }
}

