/* ============================================================
   ParenthLabs — AI Hub
   Split-screen playground. New file — does not touch main.css.
   ============================================================ */

/* ── Hub page reset ────────────────────────────────────────── */
.hub-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding-top: 68px;   /* navbar offset */
  overflow: hidden;
  background: var(--bg);
}

/* ── Split-screen wrapper ───────────────────────────────────── */
.hub-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  flex: 1;
  overflow: hidden;
  border-top: 1px solid var(--border);
}

/* ─────────────────────────────────────────────────────────────
   LEFT PANEL — Agent selector
───────────────────────────────────────────────────────────── */
.hub-left {
  display: flex;
  flex-direction: column;
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
}

.hub-left-head {
  padding: 24px 20px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.hub-left-title {
  font-family: var(--font-d);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.hub-left-sub {
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Agent cards list */
.agent-list {
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.agent-card {
  display: flex;
  gap: 13px;
  padding: 14px 14px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease);
  position: relative;
  text-align: left;
  width: 100%;
  background: none;
  font-family: var(--font-b);
}

.agent-card:hover {
  background: var(--bg);
  border-color: var(--border);
}

.agent-card.active {
  background: var(--bg);
  border-color: var(--accent);
}

.agent-card.active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 14px;
  bottom: 14px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.agent-num {
  font-family: var(--font-d);
  font-size: .7rem;
  font-weight: 800;
  color: var(--text-muted);
  min-width: 22px;
  padding-top: 2px;
  letter-spacing: .04em;
}

.agent-card.active .agent-num {
  color: var(--accent);
}

.agent-meta { flex: 1; min-width: 0; }

.agent-name {
  display: block;
  font-family: var(--font-d);
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-h);
  margin-bottom: 3px;
  letter-spacing: -.01em;
}

.agent-tagline {
  display: block;
  font-size: .775rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Tools footnote */
.hub-left-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.hub-model-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.hub-model-badge::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #22C55E;
  animation: livePulse 2s infinite;
}

.hub-rate-note {
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: 4px;
  opacity: .7;
}

/* ─────────────────────────────────────────────────────────────
   RIGHT PANEL — Chat interface
───────────────────────────────────────────────────────────── */
.hub-right {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* Chat header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
  min-height: 58px;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-agent-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  background: var(--accent-lite);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-d);
  font-size: .72rem;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}

.chat-agent-name {
  font-family: var(--font-d);
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-h);
  display: block;
  letter-spacing: -.01em;
}

.chat-agent-status {
  font-size: .72rem;
  color: var(--text-muted);
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-model-pill {
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 100px;
  letter-spacing: .02em;
}

.chat-reset-btn {
  font-size: .775rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--ease);
  font-family: var(--font-b);
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-reset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Chat messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
}

/* Empty / welcome state */
.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
  gap: 10px;
}

.chat-welcome-icon {
  width: 56px; height: 56px;
  border-radius: var(--r-md);
  background: var(--accent-lite);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.chat-welcome h3 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.chat-welcome p {
  font-size: .875rem;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.65;
}

/* Tools list in welcome */
.chat-tools-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 8px;
}

.chat-tool-tag {
  font-size: .72rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 100px;
}

/* Message bubbles */
.msg {
  display: flex;
  gap: 10px;
  max-width: 78%;
  animation: msgIn .25s ease;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-d);
  font-size: .65rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 2px;
}

.msg.agent .msg-avatar {
  background: var(--accent-lite);
  color: var(--accent);
  border: 1px solid var(--border);
}

.msg.user .msg-avatar {
  background: var(--accent);
  color: #fff;
}

.msg-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.msg-bubble {
  padding: 11px 15px;
  border-radius: 14px;
  font-size: .9rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.agent .msg-bubble {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-h);
  border-radius: 4px 14px 14px 14px;
}

.msg.user .msg-bubble {
  background: var(--accent);
  color: #fff;
  border-radius: 14px 4px 14px 14px;
}

.msg-time {
  font-size: .68rem;
  color: var(--text-muted);
  padding: 0 4px;
}

.msg.user .msg-time { text-align: right; }

/* Typing indicator */
.typing-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 13px 16px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px 14px 14px 14px;
}

.typing-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typBounce 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: .18s; }
.typing-dots span:nth-child(3) { animation-delay: .36s; }

@keyframes typBounce {
  0%,60%,100% { transform: translateY(0); opacity: .4; }
  30%          { transform: translateY(-5px); opacity: 1; }
}

/* Sample prompts row */
.chat-samples {
  padding: 14px 24px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  flex-shrink: 0;
  background: var(--bg);
}

.sample-prompt {
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-body);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--ease);
  font-family: var(--font-b);
  text-align: left;
  max-width: 260px;
  line-height: 1.4;
}

.sample-prompt:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-lite);
}

/* Chat input */
.chat-input-area {
  padding: 14px 24px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.chat-input-wrap {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 14px;
  transition: border-color var(--ease);
}

.chat-input-wrap:focus-within {
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 3px rgba(15,23,175,.08);
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: .9rem;
  color: var(--text-h);
  resize: none;
  outline: none;
  font-family: var(--font-b);
  line-height: 1.55;
  max-height: 120px;
  overflow-y: auto;
  padding: 0;
}

.chat-input::placeholder { color: var(--text-muted); }

.chat-send {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: background var(--ease), transform var(--ease);
}

.chat-send:hover { background: var(--accent-dark); transform: scale(1.04); }
.chat-send:disabled { background: var(--border); cursor: not-allowed; transform: none; }

.chat-send svg { width: 16px; height: 16px; }

/* Error message */
.chat-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--r-sm);
  font-size: .825rem;
  color: #991B1B;
  margin: 0 24px 12px;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────
   VOICE AGENT SECTION
───────────────────────────────────────────────────────────── */
.voice-section {
  border-top: 1px solid var(--border);
  padding: 80px 0;
  background: var(--bg-alt);
  overflow: hidden;
}

/* This section is NOT inside .hub-page — it's below it */
.voice-section-wrap { background: var(--bg-alt); }

.voice-intro {
  text-align: center;
  margin-bottom: 56px;
}

.voice-intro .eyebrow  { margin-bottom: 12px; }
.voice-intro h2        { margin-bottom: 10px; }
.voice-intro p {
  max-width: 520px;
  margin: 0 auto;
  font-size: .9875rem;
  line-height: 1.8;
}

.voice-compat-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: .775rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 100px;
}

/* Layout */
.voice-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
  max-width: 900px;
  margin: 0 auto;
}

/* Avatar column */
.voice-avatar-col { display: flex; flex-direction: column; align-items: center; gap: 24px; }

.voice-avatar-wrap {
  position: relative;
  width: 200px; height: 200px;
  display: flex; align-items: center; justify-content: center;
}

/* Canvas sits behind everything as the visualizer ring */
#voiceCanvas {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
}

/* Core avatar circle */
.voice-avatar-core {
  position: relative;
  z-index: 2;
  width: 136px; height: 136px;
  border-radius: 50%;
  background: var(--bg-dark);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 8px var(--bg-alt), 0 0 0 9px var(--border);
  transition: box-shadow .4s ease;
}

.avatar-monogram {
  font-family: var(--font-d);
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.04em;
  user-select: none;
}

/* Outer ring pulse layers */
.voice-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  z-index: 0;
}

/* ── State: idle ── */
.voice-avatar-wrap.idle .voice-avatar-core {
  animation: avatarBreathe 3.5s ease-in-out infinite;
}

@keyframes avatarBreathe {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.025); }
}

/* ── State: listening ── */
.voice-avatar-wrap.listening .voice-avatar-core {
  box-shadow: 0 0 0 8px var(--bg-alt), 0 0 0 9px var(--accent);
  animation: none;
}

.voice-avatar-wrap.listening .voice-ring:nth-child(1) {
  animation: ringPulse 1.6s ease-out infinite;
}

.voice-avatar-wrap.listening .voice-ring:nth-child(2) {
  animation: ringPulse 1.6s ease-out .4s infinite;
}

.voice-avatar-wrap.listening .voice-ring:nth-child(3) {
  animation: ringPulse 1.6s ease-out .8s infinite;
}

@keyframes ringPulse {
  0%   { transform: scale(1);   opacity: .55; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* ── State: thinking ── */
.voice-avatar-wrap.thinking .voice-avatar-core {
  animation: none;
}

.voice-avatar-wrap.thinking::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--accent);
  border-right-color: rgba(15,23,175,.3);
  animation: thinkSpin 1s linear infinite;
  z-index: 3;
}

@keyframes thinkSpin {
  to { transform: rotate(360deg); }
}

/* ── State: speaking ── */
.voice-avatar-wrap.speaking .voice-avatar-core {
  animation: speakBounce .45s ease-in-out infinite alternate;
}

@keyframes speakBounce {
  from { transform: scale(1); }
  to   { transform: scale(1.06); }
}

.voice-avatar-wrap.speaking .voice-ring:nth-child(1) {
  animation: speakRing .45s ease-out infinite alternate;
  border-color: var(--accent);
}

@keyframes speakRing {
  from { transform: scale(1.1); opacity: .4; }
  to   { transform: scale(1.25); opacity: .1; }
}

/* Status label */
.voice-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .825rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.voice-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background .3s;
}

.voice-avatar-wrap.listening  ~ .voice-status .voice-status-dot { background: #0f17af; animation: livePulse 1s infinite; }
.voice-avatar-wrap.thinking   ~ .voice-status .voice-status-dot { background: #F59E0B; }
.voice-avatar-wrap.speaking   ~ .voice-status .voice-status-dot { background: #22C55E; animation: livePulse .45s infinite; }

/* Mic button */
.voice-btn-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.voice-mic-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 1.25rem;
  transition: background var(--ease), transform var(--ease), box-shadow var(--ease);
  box-shadow: 0 4px 14px rgba(15,23,175,.3);
}

.voice-mic-btn:hover {
  background: var(--accent-dark);
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(15,23,175,.4);
}

.voice-mic-btn.active {
  background: #DC2626;
  box-shadow: 0 4px 14px rgba(220,38,38,.35);
  animation: micPulse 1s ease-in-out infinite;
}

@keyframes micPulse {
  0%,100% { box-shadow: 0 4px 14px rgba(220,38,38,.35); }
  50%      { box-shadow: 0 4px 22px rgba(220,38,38,.6); }
}

.voice-btn-label {
  font-size: .775rem;
  color: var(--text-muted);
}

/* Voice transcript column */
.voice-transcript-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.voice-transcript-head {
  font-family: var(--font-d);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.voice-transcript-box {
  background: transparent;
  border: none;
  padding: 0;
  min-height: 120px;
  font-size: .9rem;
  line-height: 1.7;
  color: var(--text-body);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.voice-transcript-empty {
  color: var(--text-muted);
  font-size: .875rem;
  margin: auto;
  text-align: center;
}

.vt-user {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.vt-agent {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 10px;
  margin-bottom: 2px;
}

.vt-text { color: var(--text-h); }

.voice-compat-warn {
  display: none;
  padding: 12px 16px;
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-radius: var(--r-sm);
  font-size: .825rem;
  color: #92400E;
}

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .hub-layout { grid-template-columns: 1fr; }

  .hub-left {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 240px;
  }

  .agent-list { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding: 10px 12px; }
  .agent-card { min-width: 200px; }
  .hub-left-footer { display: none; }
}

@media (max-width: 640px) {
  .hub-page { height: auto; }
  .hub-layout { height: auto; }
  .hub-right { height: 500px; }
  .chat-messages { padding: 16px; }
  .chat-input-area { padding: 10px 14px 14px; }
  .chat-header { padding: 12px 16px; }
  .chat-samples { padding: 10px 14px; }
  .msg { max-width: 90%; }

  .voice-layout { grid-template-columns: 1fr; gap: 40px; }
  .voice-section { padding: 60px 0; }
}

/* Transcript fade-in animation */
.vt-user, .vt-agent, .vt-text {
  animation: vtFadeIn .5s ease;
}
@keyframes vtFadeIn {
  from { opacity: 0; transform: translateY(6px); filter: blur(4px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
