/* ============================================================
   AŞAMA 2b — CHAT (Legatus AI ivory/ink revizyonu)
   ------------------------------------------------------------
   Mevcut .chat-area / .welcome-message / .message / .input-area
   class'larının görünümünü ivory/ink dilinde override eder.
   01-tokens.css ve 02-sidebar.css'ten SONRA include et.
   ============================================================ */

/* Canvas */
.chat-area {
    background: var(--bg-primary);
}

.chat-messages {
    padding: 32px 24px 24px;
    gap: 20px;
}
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); }

/* ---- Welcome (Harvey-style hero) ------------------------- */
.welcome-message {
    max-width: 640px;
    gap: 14px;
}
.welcome-message h1 {
    font-family: var(--font-serif);
    font-size: 30px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin: 0;
}
.welcome-message > p {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-secondary);
    margin: 0 0 12px;
    max-width: 480px;
}

.example-questions {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    max-width: 560px;
}
.example-btn {
    padding: 12px 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.4;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}
.example-btn:hover {
    border-color: var(--accent);
    background: var(--bg-secondary);
}

/* ---- Messages -------------------------------------------- */
.message {
    gap: 12px;
    max-width: 760px;
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 600;
}
.message.user .message-avatar {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.message.assistant .message-avatar {
    background: var(--accent);
    color: var(--bg-secondary);
}

.message-content {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}
.message.user .message-content {
    background: var(--user-bubble);
    border: 1px solid var(--border);
    border-bottom-right-radius: 4px;
}
.message.assistant .message-content {
    background: var(--ai-bubble);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message-content h3 {
    font-family: var(--font-serif);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    margin: 14px 0 8px;
    padding-bottom: 4px;
}
.message-content h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.message-content code {
    background: var(--bg-tertiary);
    color: var(--accent);
    border-radius: 4px;
    padding: 1px 5px;
}
.message-content li::marker { color: var(--accent); }

/* Citation chips inside messages (if static/app.js renders [n] refs) */
.message-content .citation,
.message-content a.citation {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin: 0 1px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--accent);
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--border);
    vertical-align: 2px;
}
.message-content .citation:hover {
    background: var(--accent);
    color: var(--bg-secondary);
    border-color: var(--accent);
}

/* Tables — re-skin (style.css'teki dark tablo override'ı) */
.table-wrapper {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.response-table {
    font-size: 13px;
}
.response-table th {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    font-weight: 600;
    padding: 8px 14px;
}
.response-table td {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 7px 14px;
    white-space: normal;
}
.response-table tbody tr:nth-child(even) td {
    background: var(--bg-tertiary);
}
.response-table tbody tr:hover td {
    background: var(--hover-bg);
}

/* Action buttons under assistant message */
.action-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-size: 12px;
    font-family: var(--font-sans);
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.action-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}
.continue-btn {
    background: var(--text-primary);
    color: var(--bg-secondary);
    border-color: var(--text-primary);
    font-weight: 500;
}
.continue-btn:hover {
    background: #2a2722;
    border-color: #2a2722;
    color: var(--bg-secondary);
}

/* System message pill */
.system-message {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 12px;
    border-radius: var(--radius-md);
    padding: 7px 14px;
}

/* ---- Thinking state (4-stage; see app.js patch) ---------- */
.thinking-state {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    background: var(--ai-bubble);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-width: 480px;
    font-family: var(--font-sans);
}
.thinking-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: color 0.2s;
}
.thinking-step .dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: transparent;
    flex-shrink: 0;
    position: relative;
    transition: border-color 0.2s, background 0.2s;
}
.thinking-step.active {
    color: var(--text-primary);
}
.thinking-step.active .dot {
    border-color: var(--accent);
}
.thinking-step.active .dot::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1.2s infinite;
}
.thinking-step.done .dot {
    background: var(--accent);
    border-color: var(--accent);
}
.thinking-step.done .dot::after {
    content: '✓';
    position: absolute;
    inset: 0;
    color: var(--bg-secondary);
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.thinking-step.done {
    color: var(--text-primary);
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* Old typing indicator dimmed (artık thinking-state kullanıyoruz) */
.typing-indicator span { background: var(--text-secondary); }

/* ---- Input area ------------------------------------------ */
.input-area {
    padding: 14px 24px 32px;
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
}

.input-toolbar {
    max-width: 760px;
    margin: 0 auto 8px;
}
.length-selector label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.length-selector select {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    padding: 5px 8px;
}

#chatForm .input-wrapper {
    max-width: 760px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 8px 8px 8px 14px;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
#chatForm .input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(200,169,106,0.15);
}
[data-theme="light"] #chatForm .input-wrapper:focus-within {
    box-shadow: 0 0 0 3px rgba(138,106,47,0.10);
}

#userInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    padding: 8px 4px;
    resize: none;
    outline: none;
    max-height: 200px;
}
#userInput::placeholder {
    color: var(--text-secondary);
}

#sendBtn,
#stopBtn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--text-primary);
    color: var(--bg-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, opacity 0.15s;
    flex-shrink: 0;
}
#sendBtn svg, #stopBtn svg { width: 16px; height: 16px; }
#sendBtn:hover { background: #2a2722; }
#sendBtn:disabled { opacity: 0.4; cursor: not-allowed; }
#stopBtn { background: var(--danger); color: #fff; }

.disclaimer {
    max-width: 760px;
    margin: 8px auto 0;
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.7;
}
