/*!
 * Kidoz Chat v2.0.0 — widget styles
 * All selectors scoped under .kidoz-wrap or use kidoz- prefix to avoid
 * collisions with Tailwind (Summer2026.html) and the Fable theme (WP).
 * CSS custom properties let the whole widget be retuned in one place.
 */

.kidoz-wrap {
  /* Design tokens — only scoped inside the widget */
  --kb-primary: #F97316;
  --kb-primary-600: #EA580C;
  --kb-primary-100: #FFF7ED;
  --kb-accent: #F59E0B;
  --kb-text: #111827;
  --kb-text-muted: #6B7280;
  --kb-surface: #FFFFFF;
  --kb-surface-2: #F9FAFB;
  --kb-border: #E5E7EB;
  --kb-danger: #DC2626;
  --kb-success: #16A34A;
  --kb-whatsapp: #25D366;
  --kb-shadow: 0 20px 50px -12px rgba(15, 23, 42, 0.25), 0 4px 12px rgba(15, 23, 42, 0.08);
  --kb-radius-lg: 20px;
  --kb-radius-md: 14px;
  --kb-radius-sm: 10px;
  --kb-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  font-family: var(--kb-font);
  color: var(--kb-text);
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  box-sizing: border-box;
}
.kidoz-wrap *,
.kidoz-wrap *::before,
.kidoz-wrap *::after { box-sizing: border-box; }

/* ─ Floating mode wrapper ─ */
.kidoz-wrap--floating {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483000; /* above most overlays */
}

/* ─ Inline mode — takes width of its container ─ */
.kidoz-wrap--inline {
  width: 100%;
  max-width: 420px;
  margin: 24px auto;
}
.kidoz-wrap--inline .kidoz-panel {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 560px;
  max-height: 80vh;
  right: auto;
  bottom: auto;
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

/* ─────────────────────── FAB ─────────────────────── */
.kidoz-fab {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--kb-primary) 0%, var(--kb-primary-600) 100%);
  color: #fff;
  box-shadow: var(--kb-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-left: auto;
}
.kidoz-fab:hover   { transform: scale(1.06); box-shadow: 0 24px 60px -12px rgba(249, 115, 22, 0.45); }
.kidoz-fab:focus-visible { box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.3); }
.kidoz-fab__icon { display: inline-flex; align-items: center; justify-content: center; transition: opacity 0.2s ease, transform 0.2s ease; }
.kidoz-fab__icon--close { position: absolute; opacity: 0; transform: rotate(-45deg); }
.kidoz-fab.is-open .kidoz-fab__icon--chat  { opacity: 0; transform: rotate(45deg); }
.kidoz-fab.is-open .kidoz-fab__icon--close { opacity: 1; transform: rotate(0); }
.kidoz-fab__pulse {
  position: absolute; inset: 0; border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.5);
  animation: kidoz-pulse 2.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  pointer-events: none;
}
.kidoz-fab.is-open .kidoz-fab__pulse { animation: none; }
@keyframes kidoz-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.45); }
  70%  { box-shadow: 0 0 0 18px rgba(249, 115, 22, 0); }
  100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
}

/* ─ Teaser bubble ─ */
.kidoz-teaser {
  position: absolute;
  right: 76px;
  bottom: 8px;
  background: var(--kb-surface);
  color: var(--kb-text);
  border-radius: 24px 24px 6px 24px;
  padding: 12px 16px;
  padding-right: 36px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  max-width: 240px;
  cursor: pointer;
  animation: kidoz-teaser-in 0.6s ease 1.2s both;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.kidoz-teaser:hover { transform: translateY(-1px); }
.kidoz-teaser.is-hidden { opacity: 0; pointer-events: none; transform: translateY(6px); }
.kidoz-teaser__close {
  position: absolute;
  top: 4px; right: 6px;
  background: transparent; border: none; cursor: pointer;
  color: var(--kb-text-muted);
  width: 22px; height: 22px; line-height: 1;
  font-size: 18px;
  border-radius: 50%;
}
.kidoz-teaser__close:hover { background: var(--kb-surface-2); color: var(--kb-text); }
@keyframes kidoz-teaser-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ─────────────────────── Panel ─────────────────────── */
.kidoz-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: var(--kb-surface);
  border-radius: var(--kb-radius-lg);
  box-shadow: var(--kb-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transform-origin: bottom right;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.kidoz-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ─ Header ─ */
.kidoz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: linear-gradient(135deg, var(--kb-primary) 0%, var(--kb-primary-600) 100%);
  color: #fff;
  flex: 0 0 auto;
}
.kidoz-header__brand { display: flex; align-items: center; gap: 12px; }
.kidoz-header__avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.30);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.kidoz-header__title { display: flex; flex-direction: column; }
.kidoz-header__name { font-weight: 600; font-size: 15px; line-height: 1.2; }
.kidoz-header__status { font-size: 12px; opacity: 0.85; display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.kidoz-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.35);
}
.kidoz-header__close {
  background: rgba(255, 255, 255, 0.25);
  border: none;
  width: 32px; height: 32px; border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease;
}
.kidoz-header__close:hover { background: rgba(255, 255, 255, 0.25); }

/* ─ Messages ─ */
.kidoz-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  background: var(--kb-surface-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.kidoz-messages::-webkit-scrollbar         { width: 6px; }
.kidoz-messages::-webkit-scrollbar-thumb   { background: #CBD5E1; border-radius: 3px; }
.kidoz-messages::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

.kidoz-msg { display: flex; animation: kidoz-msg-in 0.25s ease both; }
.kidoz-msg--user      { justify-content: flex-end; }
.kidoz-msg--assistant { justify-content: flex-start; }
@keyframes kidoz-msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.kidoz-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--kb-radius-md);
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.kidoz-bubble p  { margin: 0; }
.kidoz-bubble p + p  { margin-top: 6px; }
.kidoz-bubble a  { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.kidoz-bubble__list {
  margin: 6px 0 0 0;
  padding-left: 18px;
  list-style: disc;
}
.kidoz-bubble__list li { margin: 2px 0; }

.kidoz-msg--user .kidoz-bubble {
  background: var(--kb-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.kidoz-msg--assistant .kidoz-bubble {
  background: #fff;
  color: var(--kb-text);
  border: 1px solid var(--kb-border);
  border-bottom-left-radius: 4px;
}

.kidoz-bubble--typing { padding: 14px 18px; display: inline-flex; gap: 4px; align-items: center; }
.kidoz-bubble--typing span {
  width: 7px; height: 7px; background: var(--kb-text-muted); border-radius: 50%;
  animation: kidoz-typing 1.2s infinite ease-in-out both;
  opacity: 0.4;
}
.kidoz-bubble--typing span:nth-child(1) { animation-delay: -0.32s; }
.kidoz-bubble--typing span:nth-child(2) { animation-delay: -0.16s; }
@keyframes kidoz-typing {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1; }
}

/* ─ Chips ─ */
.kidoz-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 14px 12px;
  background: var(--kb-surface-2);
}
.kidoz-chips:empty { display: none; }
.kidoz-chip {
  background: #fff;
  border: 1px solid var(--kb-border);
  color: var(--kb-primary);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.kidoz-chip:hover  { background: var(--kb-primary-100); border-color: var(--kb-primary); }
.kidoz-chip:active { transform: translateY(1px); }

/* ─ Input ─ */
.kidoz-input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 14px 16px;
  background: #fff;
  border-top: 1px solid var(--kb-border);
  flex: 0 0 auto;
}
.kidoz-input__field {
  flex: 1 1 auto;
  border: 1px solid var(--kb-border);
  background: var(--kb-surface-2);
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--kb-text);
  resize: none;
  line-height: 1.4;
  max-height: 140px;
  outline: none;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.kidoz-input__field:focus { border-color: var(--kb-primary); background: #fff; }

.kidoz-input__send {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--kb-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease;
}
.kidoz-input__send:hover:not(:disabled)  { background: var(--kb-primary-600); }
.kidoz-input__send:active               { transform: scale(0.94); }
.kidoz-input__send:disabled             { opacity: 0.5; cursor: not-allowed; }

/* ─ Footer ─ */
.kidoz-footer {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 6px 8px 8px;
  background: #fff;
  border-top: 1px solid var(--kb-border);
  gap: 4px;
  animation: kidoz-footer-in 0.3s ease both;
}
@keyframes kidoz-footer-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.kidoz-footer__action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--kb-text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.kidoz-footer__action:hover { background: var(--kb-surface-2); color: var(--kb-text); }
.kidoz-footer__action svg   { display: inline-block; vertical-align: middle; }

/* ─────────────────────── Mobile ─────────────────────── */
@media (max-width: 480px) {
  .kidoz-wrap--floating { right: 16px; bottom: 16px; }
  .kidoz-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 100px);
    max-height: calc(100vh - 100px);
    right: 0;
    bottom: 72px;
  }
  .kidoz-teaser { max-width: 200px; font-size: 12.5px; padding: 10px 14px; padding-right: 30px; }
}

/* ─────────────────────── Reduced motion ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .kidoz-fab__pulse, .kidoz-bubble--typing span, .kidoz-teaser { animation: none !important; }
  .kidoz-panel, .kidoz-msg, .kidoz-fab, .kidoz-fab__icon { transition: none !important; }
}
