/**
 * Zara Interview Widget — widget.css
 * Chat-based discovery interview for Workweaver landing page.
 * All classes are prefixed `.zi-` to avoid collisions.
 *
 * Design language inherits from the Workweaver landing page:
 *   --ink-900: #0d172e  (deep navy, primary text)
 *   --ink-700: #354d77  (secondary text)
 *   --ink-500: #61759b  (muted / captions)
 *   --line:    #d3deef  (borders)
 *   --surface: #f2f7ff  (page background tint)
 *   --card:    #ffffff  (card / bubble backgrounds)
 *
 * Font: 'SF Pro Text', 'SF Pro Display', -apple-system, BlinkMacSystemFont,
 *       'Segoe UI', 'Helvetica Neue', Arial, sans-serif
 */

/* ─────────────────────────────────────────────────────────
   Custom Properties (scoped to widget root)
───────────────────────────────────────────────────────── */
.zi-widget {
  /* Brand palette */
  --zi-ink-900: #0d172e;
  --zi-ink-700: #354d77;
  --zi-ink-500: #61759b;
  --zi-line:    #d3deef;
  --zi-surface: #f2f7ff;
  --zi-card:    #ffffff;

  /* Accent colours */
  --zi-blue:        #2563eb;
  --zi-blue-light:  rgba(37, 99, 235, 0.10);
  --zi-blue-mid:    rgba(37, 99, 235, 0.18);
  --zi-green:       #10b981;
  --zi-green-light: rgba(16, 185, 129, 0.12);
  --zi-red:         #ef4444;

  /* Zara (agent) bubble */
  --zi-bubble-agent-bg:     #eef3fc;
  --zi-bubble-agent-border: rgba(37, 99, 235, 0.14);
  --zi-bubble-agent-text:   var(--zi-ink-900);

  /* User bubble */
  --zi-bubble-user-bg:     var(--zi-ink-900);
  --zi-bubble-user-border: rgba(13, 23, 46, 0.22);
  --zi-bubble-user-text:   #ffffff;

  /* Radii */
  --zi-radius-widget:  18px;
  --zi-radius-card:    14px;
  --zi-radius-bubble:  16px;
  --zi-radius-pill:    999px;

  /* Shadows */
  --zi-shadow-widget: 0 24px 64px rgba(13, 23, 46, 0.13), 0 4px 16px rgba(13, 23, 46, 0.07);
  --zi-shadow-card:   0 2px 12px rgba(13, 23, 46, 0.08);

  /* Transitions */
  --zi-t-fast:   120ms ease;
  --zi-t-normal: 200ms ease;
  --zi-t-slow:   320ms ease;

  /* Typography */
  font-family: 'SF Pro Text', 'SF Pro Display', -apple-system, BlinkMacSystemFont,
               'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--zi-ink-900);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  box-sizing: border-box;
}

.zi-widget *,
.zi-widget *::before,
.zi-widget *::after {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
}

/* ─────────────────────────────────────────────────────────
   Widget Container
───────────────────────────────────────────────────────── */
.zi-widget {
  width: 100%;
  max-width: 520px;
  border-radius: var(--zi-radius-widget);
  border: 1px solid var(--zi-line);
  background:
    radial-gradient(720px 340px at 15% 0%, rgba(37, 99, 235, 0.07), transparent 60%),
    radial-gradient(820px 380px at 88% 10%, rgba(16, 185, 129, 0.06), transparent 64%),
    var(--zi-card);
  box-shadow: var(--zi-shadow-widget);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  /* Prevents layout collapse before JS initialises */
  min-height: 480px;
}

/* ─────────────────────────────────────────────────────────
   State modifiers on the widget root
───────────────────────────────────────────────────────── */

/* Loading skeleton pulse */
.zi-widget--loading .zi-chat,
.zi-widget--loading .zi-input,
.zi-widget--loading .zi-options {
  opacity: 0.5;
  pointer-events: none;
}

/* Complete state hides the input row */
.zi-widget--complete .zi-input,
.zi-widget--complete .zi-options {
  display: none;
}

/* Active state shows all sections */
.zi-widget--active .zi-report {
  display: none;
}

/* ─────────────────────────────────────────────────────────
   Header
───────────────────────────────────────────────────────── */
.zi-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--zi-line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
}

.zi-header__avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--zi-radius-pill);
  background: linear-gradient(135deg, var(--zi-blue) 0%, #5b21b6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  position: relative;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
  overflow: visible;
}

.zi-header__avatar svg,
.zi-header__avatar-initials {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  user-select: none;
}

/* Green online dot */
.zi-header__status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  border-radius: var(--zi-radius-pill);
  background: var(--zi-green);
  border: 2px solid var(--zi-card);
  animation: ziPulse 2.4s ease-in-out infinite;
}

.zi-header__info {
  flex: 1 1 0;
  min-width: 0;
}

.zi-header__name {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--zi-ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zi-header__subtitle {
  font-size: 12px;
  font-weight: 500;
  color: var(--zi-ink-500);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zi-header__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.zi-header__btn {
  width: 30px;
  height: 30px;
  border-radius: var(--zi-radius-pill);
  border: 1px solid var(--zi-line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--zi-ink-500);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--zi-t-fast), color var(--zi-t-fast), transform var(--zi-t-fast);
  outline: none;
}

.zi-header__btn:hover {
  background: var(--zi-surface);
  color: var(--zi-ink-700);
  transform: translateY(-1px);
}

.zi-header__btn:active {
  transform: translateY(0);
}

.zi-header__btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

/* ─────────────────────────────────────────────────────────
   Progress Bar — 5-stage dot/segment indicator
───────────────────────────────────────────────────────── */
.zi-progress {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 10px 18px 8px;
  background: rgba(242, 247, 255, 0.60);
  border-bottom: 1px solid var(--zi-line);
  position: relative;
  z-index: 1;
}

/* Connecting line behind segments */
.zi-progress::before {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  top: 50%;
  height: 2px;
  background: var(--zi-line);
  z-index: 0;
}

.zi-progress__stage {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  position: relative;
  z-index: 1;
  cursor: default;
}

.zi-progress__dot {
  width: 10px;
  height: 10px;
  border-radius: var(--zi-radius-pill);
  background: var(--zi-line);
  border: 2px solid var(--zi-card);
  box-shadow: 0 0 0 1.5px var(--zi-line);
  transition: background var(--zi-t-normal), box-shadow var(--zi-t-normal), transform var(--zi-t-normal);
}

.zi-progress__label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--zi-ink-500);
  white-space: nowrap;
  text-align: center;
  opacity: 0.7;
  transition: color var(--zi-t-normal), opacity var(--zi-t-normal);
}

/* Active stage */
.zi-progress__stage--active .zi-progress__dot {
  background: var(--zi-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.20);
  transform: scale(1.25);
}

.zi-progress__stage--active .zi-progress__label {
  color: var(--zi-blue);
  opacity: 1;
}

/* Completed stages */
.zi-progress__stage--done .zi-progress__dot {
  background: var(--zi-green);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.22);
}

.zi-progress__stage--done .zi-progress__label {
  color: var(--zi-green);
  opacity: 0.9;
}

/* ─────────────────────────────────────────────────────────
   Chat Area
───────────────────────────────────────────────────────── */
.zi-chat {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;

  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--zi-line) transparent;
}

.zi-chat::-webkit-scrollbar {
  width: 4px;
}

.zi-chat::-webkit-scrollbar-track {
  background: transparent;
}

.zi-chat::-webkit-scrollbar-thumb {
  background: var(--zi-line);
  border-radius: var(--zi-radius-pill);
}

/* Constrain desktop height */
@media (min-width: 640px) {
  .zi-chat {
    max-height: 420px;
  }
}

/* Date / session separator */
.zi-chat__separator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0;
}

.zi-chat__separator::before,
.zi-chat__separator::after {
  content: '';
  flex: 1 1 0;
  height: 1px;
  background: var(--zi-line);
}

.zi-chat__separator-text {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--zi-ink-500);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* ─────────────────────────────────────────────────────────
   Message Groups & Bubbles
───────────────────────────────────────────────────────── */
.zi-msg {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 82%;
  animation: ziFadeIn 240ms var(--zi-t-slow) both;
}

/* Agent (Zara) messages — left side */
.zi-msg--agent {
  align-self: flex-start;
  align-items: flex-start;
}

/* User messages — right side */
.zi-msg--user {
  align-self: flex-end;
  align-items: flex-end;
}

.zi-msg__row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}

.zi-msg--user .zi-msg__row {
  flex-direction: row-reverse;
}

/* Small agent avatar in chat */
.zi-msg__avatar {
  width: 26px;
  height: 26px;
  border-radius: var(--zi-radius-pill);
  background: linear-gradient(135deg, var(--zi-blue) 0%, #5b21b6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  align-self: flex-end;
  margin-bottom: 2px;
}

.zi-msg__avatar svg,
.zi-msg__avatar-initials {
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.zi-msg__bubble {
  padding: 9px 13px;
  border-radius: var(--zi-radius-bubble);
  font-size: 13.5px;
  line-height: 1.52;
  word-break: break-word;
  position: relative;
  transition: box-shadow var(--zi-t-fast);
}

/* Agent bubble shape — flat bottom-left corner */
.zi-msg--agent .zi-msg__bubble {
  background: var(--zi-bubble-agent-bg);
  border: 1px solid var(--zi-bubble-agent-border);
  color: var(--zi-bubble-agent-text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.07);
}

/* User bubble shape — flat bottom-right corner */
.zi-msg--user .zi-msg__bubble {
  background: var(--zi-bubble-user-bg);
  border: 1px solid var(--zi-bubble-user-border);
  color: var(--zi-bubble-user-text);
  border-bottom-right-radius: 4px;
  box-shadow: 0 1px 4px rgba(13, 23, 46, 0.14);
}

/* Consecutive messages from same sender compress gap */
.zi-msg + .zi-msg--agent.zi-msg--consecutive {
  margin-top: -5px;
}

.zi-msg + .zi-msg--user.zi-msg--consecutive {
  margin-top: -5px;
}

.zi-msg--consecutive .zi-msg__avatar {
  visibility: hidden;
}

/* Timestamp */
.zi-msg__meta {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 3px;
}

.zi-msg__time {
  font-size: 10px;
  font-weight: 500;
  color: var(--zi-ink-500);
  opacity: 0.7;
  letter-spacing: 0.01em;
}

/* Read receipt / delivered indicator for user messages */
.zi-msg--user .zi-msg__time {
  opacity: 0.65;
}

.zi-msg__check {
  display: inline-flex;
  align-items: center;
  color: var(--zi-ink-500);
  opacity: 0.65;
}

.zi-msg__check svg {
  width: 12px;
  height: 12px;
}

/* Message with rich content (links, code) */
.zi-msg__bubble a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.85;
}

.zi-msg--agent .zi-msg__bubble a {
  color: var(--zi-blue);
}

.zi-msg__bubble code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 4px;
  padding: 1px 5px;
}

.zi-msg--user .zi-msg__bubble code {
  background: rgba(255, 255, 255, 0.14);
}

/* ─────────────────────────────────────────────────────────
   Typing Indicator
───────────────────────────────────────────────────────── */
.zi-typing {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  align-self: flex-start;
  animation: ziFadeIn 180ms ease both;
}

.zi-typing__bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 13px;
  background: var(--zi-bubble-agent-bg);
  border: 1px solid var(--zi-bubble-agent-border);
  border-radius: var(--zi-radius-bubble);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.07);
}

.zi-typing__dot {
  width: 6px;
  height: 6px;
  border-radius: var(--zi-radius-pill);
  background: var(--zi-ink-500);
  opacity: 0.55;
  animation: ziBounce 1.2s ease-in-out infinite;
}

.zi-typing__dot:nth-child(2) {
  animation-delay: 0.18s;
}

.zi-typing__dot:nth-child(3) {
  animation-delay: 0.36s;
}

/* Collapsed when Zara is not typing */
.zi-typing--hidden {
  display: none;
}

/* ─────────────────────────────────────────────────────────
   Voice / Phone Options Row
───────────────────────────────────────────────────────── */
.zi-options {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 0;
}

.zi-options__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: var(--zi-radius-pill);
  border: 1px solid var(--zi-line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--zi-ink-700);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background var(--zi-t-fast), border-color var(--zi-t-fast),
              color var(--zi-t-fast), transform var(--zi-t-fast), box-shadow var(--zi-t-fast);
  outline: none;
  white-space: nowrap;
}

.zi-options__btn svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  stroke-width: 2;
}

.zi-options__btn:hover {
  background: var(--zi-surface);
  border-color: rgba(37, 99, 235, 0.30);
  color: var(--zi-blue);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.10);
}

.zi-options__btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.zi-options__btn--voice svg {
  color: var(--zi-green);
}

.zi-options__btn--phone svg {
  color: var(--zi-blue);
}

.zi-options__divider {
  flex: 1 1 0;
}

/* ─────────────────────────────────────────────────────────
   Input Area
───────────────────────────────────────────────────────── */
.zi-input {
  flex: 0 0 auto;
  padding: 10px 12px 14px;
  border-top: 1px solid var(--zi-line);
  background: rgba(255, 255, 255, 0.80);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 2;
}

/* Left-side auxiliary buttons (mic, phone) */
.zi-input__aux {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.zi-input__icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--zi-radius-pill);
  border: 1px solid var(--zi-line);
  background: transparent;
  color: var(--zi-ink-500);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--zi-t-fast), color var(--zi-t-fast),
              border-color var(--zi-t-fast), transform var(--zi-t-fast);
  outline: none;
}

.zi-input__icon-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}

.zi-input__icon-btn:hover {
  background: var(--zi-surface);
  border-color: rgba(37, 99, 235, 0.28);
  color: var(--zi-blue);
  transform: scale(1.06);
}

.zi-input__icon-btn:active {
  transform: scale(1);
}

/* Mic button recording state */
.zi-input__icon-btn--recording {
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.30);
  color: var(--zi-red);
  animation: ziPulse 1.2s ease-in-out infinite;
}

/* Text field wrapper */
.zi-input__field-wrap {
  flex: 1 1 0;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}

.zi-input__field {
  width: 100%;
  padding: 9px 14px;
  border-radius: var(--zi-radius-pill);
  border: 1px solid var(--zi-line);
  background: var(--zi-surface);
  color: var(--zi-ink-900);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  resize: none;
  outline: none;
  transition: border-color var(--zi-t-normal), box-shadow var(--zi-t-normal),
              background var(--zi-t-normal);
  /* Multi-line auto-grow handled via JS; set a sensible max here */
  max-height: 120px;
  overflow-y: auto;
}

.zi-input__field::placeholder {
  color: var(--zi-ink-500);
  opacity: 0.7;
}

.zi-input__field:focus {
  border-color: rgba(37, 99, 235, 0.40);
  background: var(--zi-card);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

/* Send button */
.zi-input__send {
  width: 36px;
  height: 36px;
  border-radius: var(--zi-radius-pill);
  border: none;
  background: var(--zi-line);
  color: var(--zi-ink-500);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background var(--zi-t-fast), color var(--zi-t-fast),
              transform var(--zi-t-fast), box-shadow var(--zi-t-fast);
  outline: none;
}

.zi-input__send svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
  margin-left: 1px; /* optical centering for arrow */
}

/* Send active — lights up when text is present */
.zi-input__send--active {
  background: var(--zi-ink-900);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(13, 23, 46, 0.22);
}

.zi-input__send--active:hover {
  background: var(--zi-blue);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.30);
  transform: scale(1.06);
}

.zi-input__send--active:active {
  transform: scale(0.97);
}

/* Disabled state while Zara is responding */
.zi-input--blocked .zi-input__field,
.zi-input--blocked .zi-input__send {
  opacity: 0.55;
  pointer-events: none;
}

/* ─────────────────────────────────────────────────────────
   Character count (optional, shown near send)
───────────────────────────────────────────────────────── */
.zi-input__count {
  position: absolute;
  right: 14px;
  bottom: -16px;
  font-size: 10px;
  color: var(--zi-ink-500);
  opacity: 0;
  transition: opacity var(--zi-t-fast);
  pointer-events: none;
}

.zi-input__field:focus ~ .zi-input__count {
  opacity: 0.7;
}

.zi-input__count--warn {
  color: var(--zi-red);
  opacity: 1;
}

/* ─────────────────────────────────────────────────────────
   Report Card — shown on completion
───────────────────────────────────────────────────────── */
.zi-report {
  flex: 0 0 auto;
  margin: 12px 14px 14px;
  border-radius: var(--zi-radius-card);
  border: 1px solid rgba(16, 185, 129, 0.22);
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.06) 0%, rgba(37, 99, 235, 0.05) 100%),
    var(--zi-card);
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 2px 16px rgba(16, 185, 129, 0.10);
  animation: ziFadeIn 300ms ease both;
}

/* Hidden in active mode */
.zi-widget--active .zi-report {
  display: none;
}

.zi-report__check {
  width: 42px;
  height: 42px;
  border-radius: var(--zi-radius-pill);
  background: var(--zi-green-light);
  border: 1.5px solid rgba(16, 185, 129, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--zi-green);
  align-self: flex-start;
}

.zi-report__check svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.5;
}

.zi-report__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zi-report__title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--zi-ink-900);
  line-height: 1.25;
}

.zi-report__subtitle {
  font-size: 12.5px;
  color: var(--zi-ink-500);
  line-height: 1.45;
}

/* Email capture row */
.zi-report__email-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.zi-report__email {
  flex: 1 1 0;
  min-width: 0;
  padding: 9px 13px;
  border-radius: var(--zi-radius-pill);
  border: 1px solid var(--zi-line);
  background: var(--zi-surface);
  color: var(--zi-ink-900);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color var(--zi-t-normal), box-shadow var(--zi-t-normal);
}

.zi-report__email::placeholder {
  color: var(--zi-ink-500);
  opacity: 0.7;
}

.zi-report__email:focus {
  border-color: rgba(16, 185, 129, 0.42);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.10);
}

/* Action buttons row */
.zi-report__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.zi-report__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--zi-radius-pill);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background var(--zi-t-fast), color var(--zi-t-fast),
              border-color var(--zi-t-fast), transform var(--zi-t-fast),
              box-shadow var(--zi-t-fast);
  outline: none;
  white-space: nowrap;
}

.zi-report__btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
  flex: 0 0 auto;
}

.zi-report__btn--primary {
  background: var(--zi-ink-900);
  color: #ffffff;
  border: 1px solid transparent;
  box-shadow: 0 2px 8px rgba(13, 23, 46, 0.18);
}

.zi-report__btn--primary:hover {
  background: var(--zi-blue);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
  transform: translateY(-1px);
}

.zi-report__btn--primary:active {
  transform: translateY(0);
}

.zi-report__btn--secondary {
  background: transparent;
  color: var(--zi-ink-700);
  border: 1px solid var(--zi-line);
}

.zi-report__btn--secondary:hover {
  border-color: var(--zi-ink-500);
  color: var(--zi-ink-900);
  background: var(--zi-surface);
  transform: translateY(-1px);
}

.zi-report__btn--secondary:active {
  transform: translateY(0);
}

/* ─────────────────────────────────────────────────────────
   Loading / Connection State
───────────────────────────────────────────────────────── */
.zi-connecting {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 24px;
  flex: 1 1 0;
  animation: ziFadeIn 200ms ease both;
}

.zi-widget--active .zi-connecting,
.zi-widget--complete .zi-connecting {
  display: none;
}

.zi-connecting__spinner {
  width: 36px;
  height: 36px;
  border-radius: var(--zi-radius-pill);
  border: 2.5px solid var(--zi-line);
  border-top-color: var(--zi-blue);
  animation: ziSpin 0.75s linear infinite;
}

.zi-connecting__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--zi-ink-500);
  letter-spacing: -0.01em;
}

/* ─────────────────────────────────────────────────────────
   Suggested Replies (quick-reply chips)
───────────────────────────────────────────────────────── */
.zi-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 2px 0 4px;
  align-self: flex-start;
  max-width: 100%;
  animation: ziFadeIn 220ms ease both;
}

.zi-suggestions__chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 13px;
  border-radius: var(--zi-radius-pill);
  border: 1px solid rgba(37, 99, 235, 0.24);
  background: var(--zi-blue-light);
  color: var(--zi-blue);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background var(--zi-t-fast), border-color var(--zi-t-fast),
              transform var(--zi-t-fast), box-shadow var(--zi-t-fast);
  outline: none;
  white-space: nowrap;
}

.zi-suggestions__chip:hover {
  background: var(--zi-blue-mid);
  border-color: rgba(37, 99, 235, 0.36);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.14);
}

.zi-suggestions__chip:active {
  transform: translateY(0);
}

/* ─────────────────────────────────────────────────────────
   Toast / Error Banner
───────────────────────────────────────────────────────── */
.zi-toast {
  position: absolute;
  bottom: 70px;
  left: 12px;
  right: 12px;
  border-radius: var(--zi-radius-card);
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 9px;
  z-index: 10;
  pointer-events: none;
  animation: ziFadeIn 180ms ease both;
}

.zi-toast--error {
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: #b91c1c;
}

.zi-toast--info {
  background: var(--zi-blue-light);
  border: 1px solid var(--zi-blue-mid);
  color: var(--zi-blue);
}

.zi-toast--hidden {
  display: none;
}

.zi-toast svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  stroke-width: 2;
}

/* ─────────────────────────────────────────────────────────
   Keyframe Animations
───────────────────────────────────────────────────────── */

/* Message entry: slide up + fade in */
@keyframes ziFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Typing indicator bounce */
@keyframes ziBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.55;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* Online status dot pulse */
@keyframes ziPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(16, 185, 129, 0);
  }
}

/* Spinner */
@keyframes ziSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Subtle entrance for the report card */
@keyframes ziSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─────────────────────────────────────────────────────────
   Responsive — Mobile First
───────────────────────────────────────────────────────── */

/* Mobile base (< 640px) */
@media (max-width: 639px) {
  .zi-widget {
    border-radius: 14px;
    min-height: 420px;
    max-width: 100%;
  }

  .zi-chat {
    max-height: none;
    padding: 12px 12px 6px;
    gap: 8px;
  }

  .zi-msg {
    max-width: 92%;
  }

  .zi-msg__bubble {
    font-size: 13px;
    padding: 8px 12px;
  }

  .zi-header {
    padding: 12px 14px 10px;
  }

  .zi-header__avatar {
    width: 34px;
    height: 34px;
  }

  .zi-header__name {
    font-size: 13.5px;
  }

  .zi-progress {
    padding: 8px 14px 7px;
  }

  .zi-progress__label {
    font-size: 8.5px;
  }

  .zi-options {
    padding: 6px 12px 0;
    gap: 6px;
    flex-wrap: wrap;
  }

  .zi-options__btn {
    font-size: 11.5px;
    padding: 5px 11px;
  }

  .zi-input {
    padding: 8px 10px 12px;
    gap: 7px;
  }

  .zi-input__field {
    font-size: 13px;
    padding: 8px 12px;
  }

  .zi-input__icon-btn {
    width: 32px;
    height: 32px;
  }

  .zi-input__send {
    width: 34px;
    height: 34px;
  }

  .zi-report {
    margin: 10px 10px 12px;
    padding: 16px 16px 14px;
    gap: 12px;
  }

  .zi-report__title {
    font-size: 14px;
  }

  .zi-report__btn {
    font-size: 12.5px;
    padding: 8px 15px;
  }

  .zi-suggestions__chip {
    font-size: 11.5px;
    padding: 5px 11px;
  }
}

/* Desktop (>= 640px) */
@media (min-width: 640px) {
  .zi-widget {
    min-height: 520px;
  }

  .zi-input {
    padding: 10px 14px 16px;
  }

  .zi-report {
    margin: 12px 16px 16px;
  }
}

/* Wide screens — cap the widget and center it */
@media (min-width: 900px) {
  .zi-widget {
    margin-left: auto;
    margin-right: auto;
  }
}

/* ─────────────────────────────────────────────────────────
   Reduced Motion
───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .zi-widget *,
  .zi-widget *::before,
  .zi-widget *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
