/* Techoria assistant — floating chat widget for the landing page.
   Follows the landing's dark "slide" theme (landing.css, last :root block): navy surfaces, orange primary (like .btn.pri:
   translucent fill + orange border + soft glow), violet for the AI's own "thinking", Space Grotesk headings, JetBrains Mono labels.
   Tokens come from landing.css (--bg, --surface, --surface-2, --text, --muted, --line, --hover, --accent, --accent-ink, --accent-soft,
   --done, --glow-0, --serif, --sans, --mono); the fallbacks are the same dark values. All classes are tc-*. */
.tc-root {
  color-scheme: dark;
  --tc-bg: var(--bg, #191825); --tc-surface: var(--surface, #232232); --tc-card: var(--surface-2, #2A2939); --tc-well: #1E1D2B;
  --tc-text: var(--text, #F1EEF7); --tc-muted: var(--muted, #AEAABD); --tc-line: var(--line, rgba(255,255,255,.12)); --tc-hover: var(--hover, rgba(255,255,255,.07));
  --tc-accent: var(--accent, #F2994A); --tc-ink: var(--accent-ink, #F7B26B); --tc-soft: var(--accent-soft, rgba(242,153,74,.14));
  --tc-violet: var(--glow-0, #8B7CF6); --tc-done: var(--done, #3FC7A0); --tc-err: #F0566A;
  --tc-display: var(--serif, "Space Grotesk", "Inter", ui-sans-serif, system-ui, sans-serif);
  --tc-sans: var(--sans, "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
  --tc-mono: var(--mono, "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace);
  font-family: var(--tc-sans); color: var(--tc-text);
}
.tc-root *, .tc-root *::before, .tc-root *::after { box-sizing: border-box; }
.tc-root [hidden] { display: none !important; }
.tc-root button, .tc-root textarea { font: inherit; color: inherit; }

/* ── Launcher (same recipe as .btn.pri) ───────────────────────── */
.tc-fab {
  position: fixed; z-index: 60; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  display: grid; place-items: center; width: 58px; height: 58px; padding: 0; border-radius: 50%; cursor: pointer;
  background: linear-gradient(rgba(242,153,74,.2), rgba(242,153,74,.2)), var(--tc-surface);
  border: 1px solid rgba(242,153,74,.6); color: #FFD9B8;
  box-shadow: 0 0 22px rgba(242,153,74,.22), 0 10px 28px rgba(0,0,0,.45);
  transition: transform .15s, background .15s, color .15s, box-shadow .15s;
}
.tc-fab:hover { background: var(--tc-accent); color: #1A0F06; transform: translateY(-2px); box-shadow: 0 0 30px rgba(242,153,74,.45), 0 14px 32px rgba(0,0,0,.5); }
.tc-fab:active { transform: translateY(0); }
.tc-fab:focus-visible, .tc-icon-btn:focus-visible, .tc-chip:focus-visible, .tc-send:focus-visible, .tc-think-h:focus-visible, .tc-copy:focus-visible, .tc-retry:focus-visible {
  outline: 2px solid var(--tc-accent); outline-offset: 3px;
}
.tc-fab svg { width: 26px; height: 26px; transition: transform .2s, opacity .2s; }
.tc-fab .tc-ic-close { position: absolute; display: grid; opacity: 0; transform: rotate(-60deg) scale(.7); }
.tc-fab[aria-expanded="true"] .tc-ic-chat { opacity: 0; transform: rotate(60deg) scale(.7); }
.tc-fab[aria-expanded="true"] .tc-ic-close { opacity: 1; transform: none; }
.tc-fab-tip {
  position: fixed; z-index: 59; right: max(86px, calc(env(safe-area-inset-right) + 86px)); bottom: max(28px, calc(env(safe-area-inset-bottom) + 28px));
  padding: 8px 14px; border-radius: 14px 14px 4px 14px; background: var(--tc-card); border: 1px solid rgba(242,153,74,.45);
  font-size: .84rem; font-weight: 600; color: #FFD9B8; box-shadow: 0 0 18px rgba(242,153,74,.14), 0 8px 22px rgba(0,0,0,.4);
  opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity .25s, transform .25s; white-space: nowrap;
}
.tc-fab-tip.show { opacity: 1; transform: none; }
@media (max-width: 640px) { .tc-fab-tip { display: none; } }

/* ── Panel ────────────────────────────────────────────────────── */
.tc-panel {
  position: fixed; z-index: 61; right: max(16px, env(safe-area-inset-right)); bottom: calc(max(16px, env(safe-area-inset-bottom)) + 70px);
  display: flex; flex-direction: column; width: min(420px, calc(100vw - 32px)); height: min(660px, calc(100dvh - 110px));
  background: var(--tc-surface); border: 1px solid rgba(255,255,255,.14); border-radius: 20px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(139,124,246,.16), 0 0 60px rgba(139,124,246,.12), 0 30px 80px rgba(0,0,0,.6);
  opacity: 0; transform: translateY(12px) scale(.98); transform-origin: bottom right; visibility: hidden;
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}
.tc-panel.open { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }

.tc-head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 16px; border-bottom: 1px solid var(--tc-line); background: var(--tc-card); }
.tc-head img { width: 34px; height: 34px; flex: none; border-radius: 10px; object-fit: contain; }
.tc-title { flex: 1; min-width: 0; }
.tc-title strong { display: block; font-family: var(--tc-display); font-weight: 700; font-size: 1.02rem; letter-spacing: -.02em; line-height: 1.2; color: #F5F2FA; }
.tc-title span { display: block; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--tc-mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--tc-muted); }
.tc-icon-btn { display: grid; place-items: center; width: 36px; height: 36px; flex: none; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--tc-muted); cursor: pointer; transition: background .15s, color .15s; }
.tc-icon-btn:hover { background: var(--tc-hover); color: var(--tc-text); }
.tc-icon-btn svg { width: 19px; height: 19px; }

/* ── Messages ─────────────────────────────────────────────────── */
.tc-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 8px; background: var(--tc-well); scroll-behavior: smooth; }
.tc-log::-webkit-scrollbar { width: 8px; } .tc-log::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 8px; border: 2px solid var(--tc-well); }

.tc-welcome { padding: 8px 2px 6px; }
.tc-welcome h3 { font-family: var(--tc-display); font-weight: 700; font-size: 1.5rem; line-height: 1.2; letter-spacing: -.02em; color: #F5F2FA; }
.tc-welcome p { margin-top: 8px; color: var(--tc-muted); font-size: .9rem; line-height: 1.55; }
.tc-chips { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 18px; }
.tc-chip { padding: 9px 15px; border: 1px solid var(--tc-line); border-radius: 999px; background: rgba(255,255,255,.06); color: var(--tc-text); font-size: .85rem; font-weight: 500; text-align: left; line-height: 1.35; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.tc-chip:hover { border-color: rgba(242,153,74,.7); background: var(--tc-soft); color: #FFD9B8; }

.tc-msg { display: flex; flex-direction: column; margin-bottom: 16px; animation: tc-in .2s ease both; }
.tc-user { align-items: flex-end; }
.tc-user .tc-bubble {
  max-width: 86%; padding: 10px 14px; border-radius: 18px 18px 6px 18px; font-size: .92rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
  background: linear-gradient(rgba(242,153,74,.2), rgba(242,153,74,.2)), var(--tc-card); border: 1px solid rgba(242,153,74,.5); color: #FFE9D6;
}
.tc-bot { align-items: stretch; }
.tc-bot .tc-body { max-width: 100%; }

/* Thinking steps — violet "AI" card, like the glowing cards of the landing */
.tc-think {
  margin-bottom: 10px; border-radius: 14px; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--tc-violet) 42%, transparent);
  background: color-mix(in srgb, var(--tc-violet) 8%, var(--tc-card));
}
.tc-think[data-state="live"] { box-shadow: 0 0 22px color-mix(in srgb, var(--tc-violet) 20%, transparent); }
.tc-think-h { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 12px; border: 0; background: transparent; cursor: pointer; text-align: left; }
.tc-think-h:hover { background: var(--tc-hover); }
.tc-orb { position: relative; width: 16px; height: 16px; flex: none; border-radius: 50%; background: color-mix(in srgb, var(--tc-violet) 28%, transparent); }
.tc-orb::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--tc-violet); }
.tc-think[data-state="live"] .tc-orb::before { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--tc-violet); opacity: 0; animation: tc-ping 1.4s ease-out infinite; }
.tc-think[data-state="done"] .tc-orb { background: rgba(63,199,160,.18); }
.tc-think[data-state="done"] .tc-orb::after { background: var(--tc-done); }
.tc-think-t { flex: 1; font-size: .82rem; font-weight: 600; color: color-mix(in srgb, var(--tc-violet) 62%, #fff); }
.tc-think[data-state="done"] .tc-think-t { color: var(--tc-muted); }
.tc-think-n { font-family: var(--tc-mono); font-size: .7rem; color: var(--tc-muted); font-variant-numeric: tabular-nums; }
.tc-chev { width: 16px; height: 16px; flex: none; color: var(--tc-muted); transition: transform .18s; }
.tc-think[data-open="1"] .tc-chev { transform: rotate(180deg); }
.tc-steps { display: none; margin: 0; padding: 4px 14px 12px; list-style: none; max-height: 190px; overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid color-mix(in srgb, var(--tc-violet) 26%, transparent); }
.tc-think[data-open="1"] .tc-steps { display: block; }
.tc-think[data-empty="1"] .tc-steps { display: none; }
.tc-steps::-webkit-scrollbar { width: 6px; } .tc-steps::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 6px; }
.tc-step { position: relative; display: flex; gap: 11px; padding: 9px 0 0; font-size: .8rem; line-height: 1.5; color: var(--tc-muted); }
.tc-step::before { content: ""; position: absolute; left: 7px; top: 24px; bottom: -8px; width: 1px; background: color-mix(in srgb, var(--tc-violet) 30%, transparent); }
.tc-step:last-child::before { display: none; }
.tc-mark { position: relative; z-index: 1; width: 15px; height: 15px; flex: none; margin-top: 2px; border-radius: 50%; display: grid; place-items: center; background: rgba(63,199,160,.18); color: var(--tc-done); }
.tc-mark svg { width: 9px; height: 9px; }
.tc-step[data-s="live"] .tc-mark { background: color-mix(in srgb, var(--tc-violet) 28%, transparent); }
.tc-step[data-s="live"] .tc-mark::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tc-violet); animation: tc-pulse 1s ease-in-out infinite; }
.tc-step[data-s="live"] .tc-mark svg { display: none; }
.tc-step div { min-width: 0; overflow-wrap: anywhere; }
.tc-step b { font-weight: 600; color: var(--tc-text); }

/* Answer (rendered markdown) */
.tc-ans { font-size: .92rem; line-height: 1.62; overflow-wrap: anywhere; color: var(--tc-text); }
.tc-ans > :first-child { margin-top: 0; } .tc-ans > :last-child { margin-bottom: 0; }
.tc-ans p { margin: 0 0 .75em; }
.tc-ans h4 { margin: 1em 0 .4em; font-family: var(--tc-display); font-weight: 700; font-size: 1.04rem; letter-spacing: -.01em; color: #F5F2FA; }
.tc-ans ul, .tc-ans ol { margin: 0 0 .75em; padding-left: 1.3em; } .tc-ans li { margin: .2em 0; } .tc-ans li::marker { color: var(--tc-accent); }
.tc-ans strong { color: #F5F2FA; font-weight: 600; }
.tc-ans blockquote { margin: 0 0 .75em; padding: 2px 0 2px 12px; border-left: 3px solid var(--tc-accent); color: var(--tc-muted); }
.tc-ans hr { border: 0; border-top: 1px solid var(--tc-line); margin: 1em 0; }
.tc-ans a { color: #FFC892; text-decoration: underline; text-underline-offset: 2px; }
.tc-ans a:hover { color: #fff; }
.tc-ans code { padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,.09); font: .84em var(--tc-mono); }
.tc-tbl { margin: 0 0 .85em; overflow-x: auto; border: 1px solid var(--tc-line); border-radius: 12px; background: var(--tc-card); }
.tc-tbl table { width: 100%; border-collapse: collapse; font-size: .82rem; line-height: 1.45; }
.tc-tbl th, .tc-tbl td { padding: 7px 11px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--tc-line); overflow-wrap: break-word; word-break: normal; }   /* break only when a single word cannot fit; the wrapper scrolls sideways instead of cutting words */
.tc-tbl th { background: rgba(255,255,255,.05); color: var(--tc-muted); font-family: var(--tc-mono); font-size: .68rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.tc-tbl tr:last-child td { border-bottom: 0; }
.tc-code { position: relative; margin: 0 0 .85em; border-radius: 12px; background: #14131E; border: 1px solid var(--tc-line); color: #ECE9F5; overflow: hidden; }
.tc-code pre { margin: 0; padding: 12px 14px; overflow-x: auto; font: .8rem/1.55 var(--tc-mono); }
.tc-code pre code { padding: 0; background: none; font: inherit; color: inherit; }
.tc-code-h { display: flex; align-items: center; justify-content: space-between; padding: 5px 6px 5px 14px; background: rgba(255,255,255,.05); border-bottom: 1px solid var(--tc-line); font-family: var(--tc-mono); font-size: .66rem; letter-spacing: .08em; color: var(--tc-muted); text-transform: uppercase; }
.tc-copy { padding: 3px 9px; border: 0; border-radius: 8px; background: transparent; color: var(--tc-muted); font-family: var(--tc-mono); font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
.tc-copy:hover { background: var(--tc-hover); color: var(--tc-text); }
.tc-caret::after { content: ""; display: inline-block; width: 7px; height: 1.05em; margin-left: 2px; vertical-align: text-bottom; border-radius: 2px; background: var(--tc-accent); animation: tc-blink 1s steps(2, start) infinite; }

/* Typing indicator (before the first reasoning token arrives) */
.tc-dots { display: inline-flex; gap: 4px; padding: 6px 2px; }
.tc-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--tc-muted); opacity: .5; animation: tc-bounce 1.1s ease-in-out infinite; }
.tc-dots i:nth-child(2) { animation-delay: .15s; } .tc-dots i:nth-child(3) { animation-delay: .3s; }

.tc-err { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: 14px; background: rgba(240,86,106,.1); border: 1px solid rgba(240,86,106,.38); color: #FF9AA8; font-size: .85rem; line-height: 1.45; }
.tc-retry { padding: 5px 12px; border: 1px solid rgba(240,86,106,.5); border-radius: 10px; background: transparent; color: #FFB4BE; font-size: .8rem; font-weight: 600; cursor: pointer; }
.tc-retry:hover { background: rgba(240,86,106,.16); }

/* ── Composer ─────────────────────────────────────────────────── */
.tc-form { padding: 10px 14px 12px; border-top: 1px solid var(--tc-line); background: var(--tc-card); }
.tc-box { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 14px; border: 1px solid var(--tc-line); border-radius: 18px; background: var(--tc-well); transition: border-color .15s, box-shadow .15s; }
.tc-box:focus-within { border-color: var(--tc-violet); box-shadow: 0 0 0 3px rgba(139,124,246,.2); }
.tc-input { flex: 1; min-width: 0; max-height: 132px; padding: 8px 0; border: 0; outline: 0; resize: none; background: transparent; font-size: .93rem; line-height: 1.45; color: var(--tc-text); }
.tc-input::placeholder { color: #7F7C90; }
.tc-send {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none; padding: 0; border-radius: 13px; cursor: pointer;
  background: linear-gradient(rgba(242,153,74,.2), rgba(242,153,74,.2)), var(--tc-surface); border: 1px solid rgba(242,153,74,.6); color: #FFD9B8;
  transition: background .15s, color .15s, opacity .15s, box-shadow .15s;
}
.tc-send:hover:not(:disabled) { background: var(--tc-accent); color: #1A0F06; box-shadow: 0 0 18px rgba(242,153,74,.4); }
.tc-send:disabled { opacity: .35; cursor: default; }
.tc-send svg { width: 18px; height: 18px; }
.tc-send[data-mode="stop"] { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.3); color: #fff; }
.tc-send[data-mode="stop"]:hover { background: rgba(255,255,255,.2); color: #fff; box-shadow: none; }
.tc-note { margin: 8px 4px 0; font-size: .68rem; line-height: 1.45; color: var(--tc-muted); text-align: center; }

/* ── Small screens: bottom sheet ──────────────────────────────── */
@media (max-width: 560px) {
  .tc-panel { right: 0; left: 0; bottom: 0; width: 100%; height: min(100dvh - 8px, 760px); border-radius: 20px 20px 0 0; border-bottom: 0; transform-origin: bottom center; }
  .tc-form { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .tc-input { font-size: 16px; }   /* iOS Safari zooms in on inputs under 16px */
  .tc-title span { letter-spacing: .06em; }
  .tc-fab[aria-expanded="true"] { display: none; }   /* the sheet has its own close button */
}
html.tc-lock { overflow: hidden; }
@media (min-width: 561px) { html.tc-lock { overflow: auto; } }

@keyframes tc-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes tc-ping { 0% { opacity: .55; transform: scale(.8); } 100% { opacity: 0; transform: scale(1.6); } }
@keyframes tc-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.7); } }
@keyframes tc-blink { to { visibility: hidden; } }
@keyframes tc-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .tc-root *, .tc-root *::before, .tc-root *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
