/* ── Ask Focas persistent bar ─────────────────────────────────────────────── */

.af-bar {
  position: fixed;
  bottom: 0;
  left: 220px;
  right: 0;
  z-index: 1000;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
}

/* ── Thread (conversation history) ─────────────────────────────────────────── */

.af-thread {
  display: none;
  max-height: 280px;
  overflow-y: auto;
  padding: 12px 24px 0;
  position: relative;
  /* Gradient fade at top */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 40px);
  mask-image: linear-gradient(to bottom, transparent 0%, black 40px);
}

.af-thread.has-messages {
  display: block;
}

.af-clear-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-muted);
  padding: 0 4px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.af-clear-btn:hover {
  opacity: 1;
}

.af-msg-user {
  display: block;
  margin: 6px 0 6px auto;
  background: var(--accent-soft);
  color: var(--text-primary);
  border-radius: 12px 12px 2px 12px;
  padding: 8px 12px;
  max-width: 70%;
  font-size: 0.875rem;
  line-height: 1.4;
  width: fit-content;
}

.af-msg-ai {
  display: block;
  position: relative;
  margin: 6px auto 6px 0;
  background: var(--bg-app);
  color: var(--text-primary);
  border-radius: 12px 12px 12px 2px;
  padding: 8px 48px 8px 12px;
  max-width: 80%;
  font-size: 0.875rem;
  line-height: 1.5;
  width: fit-content;
}
.af-msg-text { display: block; }
.af-copy {
  position: absolute;
  top: 6px;
  right: 8px;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.4;
}
.af-copy:hover { color: var(--text-primary); border-color: var(--accent); }

.af-thinking {
  display: block;
  margin: 6px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* ── Input row ──────────────────────────────────────────────────────────────── */

.af-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  min-height: 56px;
  box-sizing: border-box;
}

.af-label {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}

.af-context-chip {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.af-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
}

.af-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle, rgba(111, 96, 242, 0.12));
}

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

.af-send-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.af-send-btn:hover {
  opacity: 0.88;
}

.af-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 760px) {
  .af-bar {
    left: 0;
  }

  .af-input-row {
    padding: 8px 14px;
    gap: 8px;
  }

  .af-context-chip {
    display: none;
  }

  .main-area {
    padding-bottom: 120px;
  }
}
