/* AI bileşenleri ortak stilleri — kitap detay tabları + viewer paneli.
   Site kırmızısı: #D54E4E (viewer aktif ikon rengiyle aynı aile). */

:root {
    --ai-red: #D54E4E;
    --ai-red-soft: rgba(213, 78, 78, 0.08);
    --ai-border: rgba(0, 0, 0, 0.08);
    --ai-muted: rgba(0, 0, 0, 0.55);
}

/* --- Tab ikonu --- */
.ai-tab-ico {
    width: 15px;
    height: 15px;
    margin-right: 5px;
    vertical-align: -2px;
    fill: var(--ai-red);
    flex: none;
}

/* Kitap detay: sekmeler genişliği doldurur; sığmazsa yatay kayar */
.book-detail-tab-content.genel .general-tab-bar {
    justify-content: space-between;
    gap: 0.4rem;
    overflow-x: auto;
    overflow-y: hidden;
}
.book-detail-tab-content.genel .general-tab-bar-item {
    flex: 1 0 auto;
    padding: 0 1rem;
    justify-content: center;
    white-space: nowrap;
}
.book-detail-tab-content.genel .general-tab-bar .mobile-gutter-box {
    display: none;
}
@media (max-width: 1200px) {
    .book-detail-tab-content.genel .general-tab-bar-item {
        padding: 0 0.8rem;
        font-size: 1.7rem;
    }
}
@media (max-width: 992px) {
    .book-detail-tab-content.genel .general-tab-bar-item {
        padding: 0 1.2rem;
        font-size: 1.8rem;
    }
}

/* --- Kart (özet / analiz) --- */
.ai-card {
    border: 1px solid var(--ai-border);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}

.ai-card__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--ai-red-soft), rgba(213, 78, 78, 0.02));
    border-bottom: 1px solid var(--ai-border);
    font-weight: 600;
    font-size: 14px;
}

.ai-card__head .ai-tab-ico { width: 17px; height: 17px; margin-right: 0; }

.ai-card__body {
    padding: 16px;
    font-size: 14px;
    line-height: 1.6;
}

.ai-card__body h4 { margin: 14px 0 6px; font-size: 14px; }
.ai-card__body h4:first-child { margin-top: 0; }
.ai-card__body ul { padding-left: 18px; margin: 6px 0; }
.ai-card__body li { margin-bottom: 4px; }

.ai-quota {
    margin-left: auto;
    font-size: 11px;
    font-weight: 400;
    color: var(--ai-muted);
    white-space: nowrap;
}

/* --- Chat --- */
.ai-chat {
    border: 1px solid var(--ai-border);
    border-radius: 14px;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-chat__msgs {
    flex: 1;
    min-height: 260px;
    max-height: 440px;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #fafafa;
}

.ai-msg {
    max-width: 85%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
}

.ai-msg--user {
    align-self: flex-end;
    background: var(--ai-red);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ai-msg--bot {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--ai-border);
    border-bottom-left-radius: 4px;
}

.ai-msg--bot strong { color: var(--ai-red); }

.ai-trace {
    align-self: flex-start;
    font-size: 11.5px;
    color: var(--ai-muted);
    padding: 2px 6px;
}

.ai-welcome {
    text-align: center;
    color: var(--ai-muted);
    font-size: 13px;
    margin: auto;
    padding: 20px;
}

.ai-welcome .ai-tab-ico { width: 26px; height: 26px; display: block; margin: 0 auto 8px; }

.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }

.ai-chip {
    font-size: 12px;
    padding: 5px 11px;
    border: 1px solid var(--ai-border);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    transition: all .15s;
}
.ai-chip:hover { border-color: var(--ai-red); color: var(--ai-red); }

.ai-chat__form {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
    border-top: 1px solid var(--ai-border);
    background: #fff;
}

.ai-chat__input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--ai-border);
    border-radius: 999px;
    padding: 9px 15px;
    font-size: 13px;
    outline: none;
    transition: border-color .15s;
}
.ai-chat__input:focus { border-color: var(--ai-red); }

.ai-chat__send {
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--ai-red);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity .15s;
}
.ai-chat__send:hover { opacity: .85; }
.ai-chat__send:disabled { opacity: .4; cursor: default; }
.ai-chat__send svg { width: 16px; height: 16px; fill: #fff; }

.ai-chat__foot {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 14px 9px;
    font-size: 11px;
    color: var(--ai-muted);
    background: #fff;
}

/* Sayfa rozetleri */
.ai-pages { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.ai-page-badge, .ai-viewer-page {
    font-size: 11px;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--ai-red-soft);
    color: var(--ai-red);
    text-decoration: none;
    cursor: pointer;
}

/* İlgili yayın kartları (analiz) */
.ai-related { display: flex; flex-direction: column; gap: 8px; }
.ai-related__item {
    display: block;
    padding: 10px 12px;
    border: 1px solid var(--ai-border);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s;
}
.ai-related__item:hover { border-color: var(--ai-red); }
.ai-related__rel {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--ai-red-soft);
    color: var(--ai-red);
    margin-left: 6px;
}

/* Yükleniyor */
.ai-loading { padding: 24px; text-align: center; }
.ai-loading__dots { display: inline-flex; gap: 5px; }
.ai-loading__dots span {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--ai-red); opacity: .35;
    animation: aiPulse 1.2s infinite ease-in-out;
}
.ai-loading__dots span:nth-child(2) { animation-delay: .18s; }
.ai-loading__dots span:nth-child(3) { animation-delay: .36s; }
@keyframes aiPulse { 0%,80%,100% { opacity:.25; transform:scale(.85);} 40% { opacity:1; transform:scale(1);} }
.ai-loading__text { margin-top: 10px; font-size: 12px; color: var(--ai-muted); }

/* AI öneri şeridi (search alt bölümü) */
.ai-reco-row { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; }
.ai-reco-card {
    flex: 0 0 150px;
    text-decoration: none;
    color: inherit;
}
.ai-reco-card img {
    width: 150px; height: 210px; object-fit: cover;
    border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.12);
    display: block;
}
.ai-reco-card__name {
    font-size: 12.5px; font-weight: 600; line-height: 1.3; margin-top: 7px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ai-reco-card__author { font-size: 11px; color: var(--ai-muted); margin-top: 2px; }
.ai-reco-card__reason { font-size: 11px; color: var(--ai-red); margin-top: 4px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
