/* ═══════════════════════════════════════════════════════════════════════
   Chat / Markdown styles
═══════════════════════════════════════════════════════════════════════ */

.chat-message {
    margin-bottom: 1rem;
}

/* 🐞 2026-08-05: düşünme bloğu ile cevap balonu BAZEN YAN YANA duruyordu.
   KÖK NEDEN: hem .chat-bubble hem .thinking-block `display: inline-block`'tu ve
   MessageBubble.razor'da bu ikisi DOĞRUDAN KARDEŞ (details + div). İki inline-block
   kardeş, ikisi de satıra sığdığı sürece AYNI SATIRA dizilir — bu yüzden sorun
   "bazen" görünüyordu: yalnız thinking özeti VE cevap kısa olduğunda.
   ÇÖZÜM: ikisi de block seviyesine alındı ama `width: fit-content` ile balon yine
   içeriğini sarıyor (görünüm değişmedi, yalnız artık asla yan yana gelmiyorlar).
   ⚠️ inline-block'a geri dönersen hata da geri gelir. Balonu içeriğe sardırmak için
   fit-content kullan, inline-block DEĞİL. */
.chat-bubble {
    display: block;
    width: fit-content;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    max-width: 85%;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: anywhere;   /* uzun kod/URL konteyneri zorlamasın */
}

.chat-bubble.user {
    background: #0d6efd;
    color: white;
    border-bottom-right-radius: 4px;
    /* block + fit-content olduğu için .text-end artık hizalamıyor → sağa dayamayı
       margin yapar (kullanıcı balonu sağda kalsın). */
    margin-inline-start: auto;
}

.chat-bubble.assistant {
    background: #f1f3f5;
    color: #212529;
    border-bottom-left-radius: 4px;
}

.chat-bubble.assistant .markdown-body {
    color: inherit;
}

.markdown-body p { margin-bottom: 0.5rem; }
.markdown-body p:last-child { margin-bottom: 0; }

.markdown-body ul, .markdown-body ol {
    padding-inline-start: 1.5rem;
    margin-bottom: 0.5rem;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.markdown-body code:not(pre code) {
    background: rgba(0, 0, 0, 0.08);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Consolas', 'Monaco', monospace;
}

.markdown-body pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5rem 0;
    position: relative;
}

.markdown-body pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.875em;
}

.markdown-body table {
    border-collapse: collapse;
    margin: 0.5rem 0;
    width: 100%;
}
.markdown-body th, .markdown-body td {
    border: 1px solid #dee2e6;
    padding: 0.4rem 0.7rem;
    text-align: start;
}
.markdown-body th {
    background: rgba(0, 0, 0, 0.04);
    font-weight: 600;
}

.markdown-body blockquote {
    border-inline-start: 4px solid #adb5bd;
    padding-inline-start: 1rem;
    color: #6c757d;
}

.markdown-body a {
    color: #0d6efd;
    text-decoration: underline;
}

/* ── Stilize tablo (mobil TabloRenderer karsiligi) ─────────────────────── */
.chat-table-wrapper {
    overflow-x: auto;
    margin: 0.5rem 0;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
}

.chat-table {
    border-collapse: collapse;
    width: auto;
    min-width: 100%;
    margin: 0;
    font-size: 0.875rem;
}

.chat-table thead th {
    background: #2C3E50;
    color: #fff;
    font-weight: 600;
    padding: 0.5rem 0.7rem;
    text-align: start;
    white-space: nowrap;
}

.chat-table tbody td {
    padding: 0.4rem 0.7rem;
    text-align: start;
    white-space: nowrap;
    color: #212529;
}

.chat-table tbody tr:nth-child(even) td {
    background: #fff;
}

.chat-table tbody tr:nth-child(odd) td {
    background: #F8F9FA;
}

/* Sayisal kolonlar saga hizali */
.chat-table th.num, .chat-table td.num {
    text-align: end;
}

/* Durum renkleri */
.chat-table td.status-acik   { color: #E67E22; font-weight: 600; }
.chat-table td.status-odendi { color: #27AE60; font-weight: 600; }
.chat-table td.status-iptal  { color: #C0392B; font-weight: 600; }

.chat-table code {
    background: rgba(0, 0, 0, 0.08);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85em;
}

[data-bs-theme="dark"] .chat-table-wrapper { border-color: #3A3A3A; }
[data-bs-theme="dark"] .chat-table tbody td { color: #E0E0E0; }
[data-bs-theme="dark"] .chat-table tbody tr:nth-child(even) td { background: #2D2D2D; }
[data-bs-theme="dark"] .chat-table tbody tr:nth-child(odd) td { background: #262626; }

/* ── SECENEK butonlari ─────────────────────────────────────────────────── */
.option-buttons {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.option-btn {
    background: #fff;
    color: #0d6efd;
    border: 1px solid #0d6efd;
    border-radius: 10px;
    padding: 0.5rem 0.9rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-align: start;
    max-width: 100%;
    transition: background 0.12s, color 0.12s;
}

.option-btn:hover {
    background: #0d6efd;
    color: #fff;
}

[data-bs-theme="dark"] .option-btn {
    background: #3A3A3A;
    color: #6ea8fe;
    border-color: #6ea8fe;
}
[data-bs-theme="dark"] .option-btn:hover {
    background: #6ea8fe;
    color: #1a1a1a;
}

/* ── Excel rapor karti ─────────────────────────────────────────────────── */
.excel-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #E8F5E9;
    border: 1px solid #4CAF50;
    border-radius: 14px;
    padding: 0.7rem 0.9rem;
    max-width: 85%;
}

.excel-card .excel-icon { font-size: 1.75rem; line-height: 1; }
.excel-card .excel-info { flex-grow: 1; min-width: 0; }
.excel-card .excel-name {
    font-weight: 600;
    color: #1B5E20;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.excel-card .excel-msg { font-size: 0.85rem; color: #33691E; }
.excel-card .excel-download { white-space: nowrap; }

[data-bs-theme="dark"] .excel-card {
    background: #1B3A1F;
    border-color: #2E7D32;
}
[data-bs-theme="dark"] .excel-card .excel-name { color: #A5D6A7; }
[data-bs-theme="dark"] .excel-card .excel-msg { color: #C8E6C9; }

.message-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s;
    margin-top: 0.25rem;
}
.chat-message:hover .message-actions {
    opacity: 1;
}

.message-action-btn {
    background: none;
    border: none;
    color: #6c757d;
    padding: 0.2rem 0.4rem;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.8rem;
}
.message-action-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #212529;
}

.streaming-cursor::after {
    content: "▊";
    display: inline-block;
    animation: blink 1s infinite;
    margin-inline-start: 2px;
    color: #0d6efd;
}
@keyframes blink { 50% { opacity: 0; } }

/* Kullanıcı balonundaki ek dosya çipi — tıklanabilir (indirir). İmleç ve hover
   geri bildirimi olmadan tıklanabilir olduğu anlaşılmıyordu (2026-08-05). */
.ek-cip {
    cursor: pointer;
    transition: background-color .12s ease;
}
.ek-cip:hover {
    background: rgba(255, 255, 255, .35) !important;
    text-decoration: underline;
}

.tool-status {
    font-style: italic;
    color: #6c757d;
    font-size: 0.875rem;
    padding: 0.25rem 0;
}

/* display: block + fit-content — bkz. .chat-bubble üstündeki 2026-08-05 notu
   (inline-block iken cevap balonuyla yan yana diziliyordu). */
.thinking-block {
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    max-width: 85%;
    display: block;
    width: fit-content;
}

.thinking-block summary {
    cursor: pointer;
    color: #6366f1;
    user-select: none;
    font-weight: 500;
}

.thinking-block summary:hover {
    color: #4f46e5;
}

.thinking-content {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(99, 102, 241, 0.15);
    font-style: italic;
    color: #6c757d;
    white-space: pre-wrap;
    line-height: 1.5;
    /* Uzun/bölünemez satırlar (İngilizce akıl yürütme, JSON, tool adları) konteyneri
       yatayda zorlamasın — sol panelin sıkışma sorununun ikinci kaynağı buydu
       (pre-wrap tek başına ÇOK UZUN kelimeyi bölmez). */
    overflow-wrap: anywhere;
}

[data-bs-theme="dark"] .thinking-block {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.25);
}

[data-bs-theme="dark"] .thinking-block summary {
    color: #a5b4fc;
}

[data-bs-theme="dark"] .thinking-content {
    color: #9ca3af;
    border-top-color: rgba(99, 102, 241, 0.25);
}
