/* ============================================
   TOOLSLAB — CHAT SCREEN
   Top bar, message flow, empty state, input bar
   ============================================ */

/* ---------- TOP BAR ---------- */
.topbar {
  display: flex; flex-direction: column;
  height: auto;
  padding: 0 var(--sp-4);
  flex-shrink: 0;
  background: var(--bg-app);
}
/* topbar-status-row removed */
.topbar-nav-row {
  display: flex; justify-content: space-between; align-items: center; width: 100%; padding-bottom: var(--sp-2);
}
.topbar-title-row {
  display: flex; justify-content: center;
  padding: 0 var(--sp-4) var(--sp-2);
}
.topbar-title-row .topbar-title {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-secondary);
  max-width: 80vw;
  padding-bottom: var(--sp-1);
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: var(--sp-2); }

/* ---------- TOP BAR PILLS ---------- */
.mode-pill { 
  display:inline-flex; background:var(--bg-surface-2);
  border:1px solid var(--border-subtle); border-radius:var(--r-full);
  padding:2px; gap:2px; 
}
.mode-pill-btn { 
  padding: 6px 14px; border-radius:var(--r-full);
  font-size:var(--fs-sm); font-weight:600; color:var(--text-secondary);
  display:inline-flex; align-items:center; gap:6px;
  white-space:nowrap; transition:background var(--dur-fast) var(--ease),
  color var(--dur-fast) var(--ease); 
}
.mode-pill-btn.is-active { 
  background:var(--text-primary);
  color:var(--bg-app); 
}
.mode-pill-lock { 
  font-size:9px; font-weight:700; padding:3px 7px;
  border-radius:var(--r-full); background:var(--accent-pro);
  color:#fff; letter-spacing:0.02em;
  box-shadow: 0 0 6px rgba(168, 85, 247, 0.45);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-direction: row;
  white-space: nowrap;
  line-height: 1;
}
.mode-pill-lock svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  order: 2; /* move icon after text (right side) */
}
.mode-pill-lock-text {
  order: 1;
}
.mode-pill-tier {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 8px;
  border-radius: var(--r-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
}

/* Image / Video generation badges — bigger + distinct styling */
.mode-pill-lock.badge-pro {
  font-size: 10px;
  padding: 4px 9px;
  background: var(--accent-pro);
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.5);
}
.mode-pill-lock.badge-max {
  font-size: 11px;
  font-weight: 800;
  padding: 5px 11px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, #3a2a05, #171105 60%, #000 100%);
  color: #ffd76a;
  border: 1px solid rgba(255, 200, 60, 0.55);
  box-shadow:
    0 0 10px rgba(255, 200, 60, 0.55),
    0 0 22px rgba(255, 170, 20, 0.35),
    inset 0 0 6px rgba(255, 210, 100, 0.25);
  text-shadow: 0 0 6px rgba(255, 210, 120, 0.6);
  letter-spacing: 0.04em;
}
.ai-status-pill { 
  display:inline-flex; align-items:center;
  justify-content:center; width:28px; height:28px;
  border-radius:var(--r-full); background:var(--bg-surface-2);
  border:1px solid var(--border-subtle); flex-shrink:0; 
}
.signal-bars { width:14px; height:14px; }
.ai-status-pill.is-online .signal-bars rect { fill:var(--success); }
.ai-status-pill.is-offline .signal-bars rect { fill:var(--danger); }

@media (max-width: 380px) {
  .mode-pill-btn { padding: 4px 8px; font-size: var(--fs-xs); gap: 4px; }
  .mode-pill-lock { padding: 2px 5px; font-size: 8px; }
  .mode-pill-lock.badge-max { font-size: 9px; padding: 3px 7px; }
  .topbar-nav-row { gap: 4px; }
  .topbar-left, .topbar-right { gap: 4px; }
}
/* ---------- CHAT BODY (scroll region) ---------- */
.chat-body {
  flex: 1;
  min-height: 0;
}
.chat-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-5) var(--sp-8);
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* ---------- EMPTY STATE / GREETING ---------- */
.empty-state {
  flex: 1;
  min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: var(--sp-6);
  gap: var(--sp-6);
  animation: fadeUp var(--dur-slow) var(--ease);
}
.empty-mark {
  width: 48px; height: 48px;
  color: var(--accent);
}
.empty-greeting {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  color: var(--text-primary);
  font-weight: 500;
}
.empty-sub {
  font-size: var(--fs-base);
  color: var(--text-muted);
  margin-top: calc(-1 * var(--sp-3));
}

/* suggested prompt cards */
.prompt-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
  width: 100%;
  max-width: 520px;
}
.prompt-card {
  text-align: left;
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.prompt-card:hover { transform: translateY(-2px); background: var(--bg-surface-2); box-shadow: var(--sh-sm); }
.prompt-card-title { font-size: var(--fs-sm); font-weight: 500; color: var(--text-primary); }
.prompt-card-sub { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
@media (max-width: 560px) { .prompt-cards { grid-template-columns: 1fr; } }

/* ---------- MESSAGES ---------- */
.msg {
  display: flex;
  animation: fadeUp var(--dur-base) var(--ease);
}

/* Markdown Styles */
.markdown-body {
  font-family: inherit;
  line-height: 1.6;
}
.markdown-body p { margin-top: 0; margin-bottom: 0.75em; }
.markdown-body p:last-child { margin-bottom: 0; }
.markdown-body code {
  background: var(--bg-surface-3);
  padding: 0.2em 0.4em;
  border-radius: var(--r-sm);
  font-family: monospace;
  font-size: 0.9em;
}
.markdown-body pre {
  background: var(--bg-surface-2);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  margin-bottom: 0.75em;
}
.markdown-body pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: inherit;
}
.markdown-body ul, .markdown-body ol {
  padding-left: 1.5em;
  margin-top: 0;
  margin-bottom: 0.75em;
}
.markdown-body strong { font-weight: 600; }

.msg.msg-user { justify-content: flex-end; }
.msg.msg-assistant { justify-content: flex-start; }

.msg-bubble {
  max-width: 82%;
  font-size: var(--fs-base);
  line-height: 1.6;
}
.msg-user .msg-bubble {
  background: var(--bg-surface-2);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  color: var(--text-primary);
}
.msg-assistant .msg-bubble {
  background: none;
  padding: 0;
  color: var(--text-primary);
}

.msg-actions {
  display: flex; gap: var(--sp-1);
  margin-top: var(--sp-2);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.msg:hover .msg-actions { opacity: 1; }
.msg-action-btn {
  width: 30px; height: 30px;
  border-radius: var(--r-full);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.msg-action-btn:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.msg-action-btn svg { width: 15px; height: 15px; }

/* ---------- INPUT BAR (floating, bottom) ---------- */
.input-zone {
  flex-shrink: 0;
  padding: var(--sp-3) var(--sp-5) var(--sp-5);
}
.input-wrap {
  max-width: 720px;
  margin: 0 auto;
}

.tool-chip-row {
  display: flex; align-items: center; margin-bottom: var(--sp-2);
  gap: var(--sp-2); flex-wrap: wrap;
  animation: fadeIn var(--dur-base) var(--ease);
}

.input-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-md);
  padding: var(--sp-3) var(--sp-3) var(--sp-2);
  transition: border-color var(--dur-fast) var(--ease);
}
.input-card:focus-within { border-color: var(--border-med); }

.input-textarea {
  width: 100%;
  background: transparent;
  border: none;
  resize: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--fs-base);
  line-height: 1.5;
  padding: 0; margin-bottom: var(--sp-2);
  min-height: 24px; max-height: 200px;
}
.input-textarea:focus { outline: none; }
.input-textarea::placeholder { color: var(--text-muted); }

.input-inner-chips {
  display: flex; align-items: center; gap: var(--sp-2);
  flex-wrap: wrap;
  padding-bottom: var(--sp-3);
  margin-top: -4px; /* Pull it slightly closer to textarea */
}

.input-actions {
  display: flex; align-items: center; justify-content: space-between;
}
.input-actions-left, .input-actions-right { display: flex; align-items: center; gap: var(--sp-2); }
.message-content img { max-width: 100%; border-radius: 12px; margin-top: 10px; }
