/* =========================================================
   TurboTax Intelligent Onboarding — Conversational variant
   Chat-style UI inspired by ChatGPT × Stripe × Cursor Agent.
   Pairs with styles.css (shares tokens + brand chrome).
   ========================================================= */

:root {
  --chat-bg:        #FAFBFC;
  --chat-system:    #FFFFFF;
  --chat-user:      var(--tt-blue);
  --chat-user-text: #FFFFFF;
  --chat-border:    var(--ink-200);
  --max-chat-width: 720px;
}

/* ---------- Page chrome ---------- */
body[data-variant="conversational"] {
  background: var(--chat-bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.chat-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  max-width: var(--max-chat-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Concierge bar (Aisha presence) ---------- */
.concierge-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin: 16px 0;
  background: #fff;
  border: 1px solid var(--chat-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.concierge-bar__photo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(15, 30, 60, .14);
  flex-shrink: 0;
}
.concierge-bar__meta { flex: 1; min-width: 0; }
.concierge-bar__name {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-900);
}
.concierge-bar__status {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-600);
  display: flex;
  align-items: center;
  gap: 6px;
}
.concierge-bar__pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tt-green);
  box-shadow: 0 0 0 0 rgba(0, 163, 122, .45);
  animation: pulseDotGreen 1.6s ease-out infinite;
  flex-shrink: 0;
}
@keyframes pulseDotGreen {
  0%   { box-shadow: 0 0 0 0 rgba(0, 163, 122, .45); }
  70%  { box-shadow: 0 0 0 6px rgba(0, 163, 122, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 163, 122, 0); }
}
.concierge-bar__action {
  font-size: 12px;
  font-weight: 700;
  color: var(--tt-blue);
  background: transparent;
  border: 0;
  cursor: pointer;
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: 999px;
}
.concierge-bar__action:hover {
  background: var(--tt-blue-50);
}

/* ---------- Chat thread ---------- */
.chat-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0 24px;
}

.bubble {
  max-width: 82%;
  padding: 12px 16px;
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: bubbleIn .25s cubic-bezier(.22,1,.36,1) both;
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.bubble--system {
  align-self: flex-start;
  background: var(--chat-system);
  color: var(--ink-900);
  border: 1px solid var(--chat-border);
  border-radius: 4px 18px 18px 18px;
}
.bubble--user {
  align-self: flex-end;
  background: var(--chat-user);
  color: var(--chat-user-text);
  border-radius: 18px 4px 18px 18px;
}
.bubble strong { font-weight: 700; }
.bubble--system strong { color: var(--ink-900); }
.bubble--user strong { color: #fff; }

/* Streaming caret while text appears */
.bubble--streaming::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 14px;
  background: var(--ink-700);
  margin-left: 2px;
  vertical-align: -2px;
  animation: caretBlink 1s steps(1) infinite;
}
@keyframes caretBlink {
  50% { opacity: 0; }
}

/* Typing indicator (3 dots) */
.typing {
  align-self: flex-start;
  padding: 14px 18px;
  background: var(--chat-system);
  border: 1px solid var(--chat-border);
  border-radius: 4px 18px 18px 18px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  animation: bubbleIn .2s ease both;
}
.typing__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-400);
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing__dot:nth-child(2) { animation-delay: .15s; }
.typing__dot:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0);   opacity: .55; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* ---------- Inline cards (return summary, BofA confirm, expert match, etc.) ---------- */
.inline-card {
  align-self: flex-start;
  width: 100%;
  max-width: 560px;
  background: #fff;
  border: 1px solid var(--chat-border);
  border-radius: var(--radius-lg);
  padding: 18px 18px;
  margin: 4px 0;
  box-shadow: var(--shadow-sm);
  animation: bubbleIn .3s ease both;
}
.inline-card__eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--tt-red);
  margin: 0 0 6px;
}
.inline-card__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-900);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.inline-card__sub {
  font-size: 13px;
  color: var(--ink-600);
  margin: 0 0 12px;
  line-height: 1.5;
}

/* Return summary list inside inline card */
.return-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.return-list li {
  font-size: 14px;
  color: var(--ink-800);
  display: flex;
  align-items: center;
  gap: 8px;
}
.return-list__check {
  color: var(--tt-green);
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

/* BofA confirm card actions inside inline-card */
.inline-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* Reasoning panel (streaming "thought log") */
.reasoning-panel {
  align-self: flex-start;
  width: 100%;
  max-width: 480px;
  background: var(--ink-50);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 4px 0;
  font-size: 13px;
  color: var(--ink-700);
  line-height: 1.55;
  font-family: var(--font-display);
  animation: bubbleIn .25s ease both;
}
.reasoning-panel__title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-500);
  margin: 0 0 8px;
}
.reasoning-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 3px 0;
  opacity: 0;
  animation: lineFade .3s ease forwards;
}
.reasoning-line__dot {
  color: var(--tt-blue);
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}
.reasoning-line__check {
  color: var(--tt-green);
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
}
@keyframes lineFade {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: none; }
}

/* Match card inside chat thread */
.match-card-inline {
  align-self: flex-start;
  width: 100%;
  max-width: 560px;
  background: #fff;
  border: 2px solid var(--tt-blue);
  border-radius: var(--radius-xl);
  padding: 0;
  margin: 6px 0;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: bubbleIn .35s ease both;
}
.match-card-inline__ribbon {
  background: linear-gradient(90deg, var(--tt-red) 0%, #E14C42 100%);
  color: #fff;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 7px 14px;
}
.match-card-inline__body {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
}
.match-card-inline__photo {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(15, 30, 60, .14);
}
.match-card-inline__meta { flex: 1; min-width: 0; }
.match-card-inline__sku {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--tt-red);
  margin: 0 0 4px;
}
.match-card-inline__name {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-900);
  margin: 0 0 2px;
  letter-spacing: -0.01em;
}
.match-card-inline__credentials {
  font-size: 12px;
  color: var(--ink-600);
  margin: 0 0 6px;
}
.match-card-inline__price {
  font-size: 13px;
  color: var(--ink-700);
  margin: 0;
}
.match-card-inline__price strong {
  color: var(--ink-900);
  font-weight: 800;
}
.match-card-inline__footer {
  background: var(--tt-blue-50);
  padding: 14px 18px;
  border-top: 1px solid var(--tt-blue-100);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Expandable "Why this match" inside match card */
.why-toggle {
  background: transparent;
  border: 0;
  padding: 8px 18px 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--tt-blue);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.why-toggle:hover { text-decoration: underline; }
.why-body {
  padding: 6px 18px 0;
  font-size: 13px;
  color: var(--ink-700);
  line-height: 1.5;
}
.why-body ul { margin: 8px 0 0; padding: 0 0 0 18px; display: grid; gap: 4px; }
.why-body li::marker { color: var(--tt-blue); }
.why-body[hidden] { display: none; }

/* ---------- Quick reply tray (sticky bottom) ---------- */
.quick-tray {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, transparent 0%, var(--chat-bg) 24%, var(--chat-bg) 100%);
  padding: 24px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.quick-reply {
  appearance: none;
  background: #fff;
  border: 1.5px solid var(--ink-200);
  border-radius: 999px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-800);
  cursor: pointer;
  transition: all .12s ease;
}
.quick-reply:hover {
  border-color: var(--tt-blue);
  background: var(--tt-blue-50);
  color: var(--tt-blue-dark);
}
.quick-reply--primary {
  background: var(--tt-blue);
  color: #fff;
  border-color: var(--tt-blue);
}
.quick-reply--primary:hover {
  background: var(--tt-blue-dark);
  border-color: var(--tt-blue-dark);
  color: #fff;
}
.quick-reply__icon {
  margin-right: 4px;
  font-size: 14px;
  line-height: 1;
}

.composer {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 999px;
  padding: 6px 6px 6px 18px;
  box-shadow: var(--shadow-sm);
}
.composer input {
  flex: 1;
  border: 0;
  outline: none;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink-900);
  background: transparent;
  padding: 8px 0;
  min-width: 0;
}
.composer input::placeholder { color: var(--ink-400); }
.composer__send {
  appearance: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--tt-blue);
  color: #fff;
  border: 0;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.composer__send:disabled {
  background: var(--ink-300);
  cursor: not-allowed;
}

/* ---------- Late-season urgency strip pinned under concierge bar ---------- */
body[data-season="late"] .concierge-bar {
  border-color: var(--tt-amber-border);
  background: var(--tt-amber-bg);
}
body[data-season="late"] .concierge-bar__name { color: var(--tt-amber); }

/* ---------- End-of-flow celebration card ---------- */
.celebrate-card {
  align-self: flex-start;
  width: 100%;
  max-width: 480px;
  background: linear-gradient(135deg, var(--tt-green-100) 0%, #E0F7E8 100%);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin: 6px 0;
  text-align: center;
  animation: bubbleIn .35s ease both;
}
.celebrate-card__icon {
  font-size: 32px;
  line-height: 1;
  margin-bottom: 8px;
}
.celebrate-card__title {
  font-size: 18px;
  font-weight: 800;
  color: var(--tt-green-dark);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.celebrate-card__sub {
  font-size: 14px;
  color: var(--ink-700);
  margin: 0;
  line-height: 1.5;
}

/* Mobile tweaks */
@media (max-width: 540px) {
  .bubble { max-width: 92%; font-size: 14.5px; }
  .inline-card, .match-card-inline, .reasoning-panel { max-width: 100%; }
}
