/* IMES AI sohbet — WhatsApp benzeri baloncuklar */

/* Sağ rail: site sarısı */
.sidebar__item--ai {
    border: none;
    cursor: pointer;
    text-decoration: none;
    padding: 0.55rem 0.3rem !important;
    font: inherit;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    background: var(--clr-secondary) !important;
    color: var(--clr-on-gold) !important;
    min-height: 52px;
    height: auto;
    flex-direction: column;
    justify-content: center;
}

.sidebar__item--ai:hover {
    background: #d9830f !important;
    color: var(--clr-on-gold) !important;
    width: 36px;
}

.sidebar__item-ai-label {
    display: block;
    font-family: var(--font-heading);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    line-height: 1.15;
    color: var(--clr-on-gold);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    text-transform: none;
}

.sidebar__item-badge {
    position: absolute;
    top: 1px;
    right: 0;
    min-width: 15px;
    height: 15px;
    padding: 0 4px;
    font-size: 9px;
    font-weight: 800;
    line-height: 15px;
    text-align: center;
    background: #fff;
    color: var(--clr-secondary);
    border-radius: 99px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

.imes-ai-chat {
    position: fixed;
    inset: 0;
    z-index: 10060;
    pointer-events: none;
}

.imes-ai-chat:not([hidden]) {
    pointer-events: auto;
}

.imes-ai-chat__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 10, 22, 0.45);
    opacity: 0;
    transition: opacity 0.28s ease;
}

.imes-ai-chat:not([hidden]) .imes-ai-chat__backdrop {
    opacity: 1;
}

.imes-ai-chat__sheet {
    position: absolute;
    display: flex;
    flex-direction: column;
    right: 24px;
    bottom: 96px;
    width: min(100vw - 32px, 380px);
    height: min(520px, calc(100vh - 120px));
    max-height: calc(100vh - 100px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    transform: translateY(16px) scale(0.94);
    opacity: 0;
    transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.28s ease;
}

.imes-ai-chat:not([hidden]) .imes-ai-chat__sheet {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* ── Tam sayfa ai-sohbet: WhatsApp Web / mobil uygulama hissi, tek kaydırma ── */
body.page-ai-sohbet .page-ai-sohbet-wrap {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-h, 80px));
    padding-bottom: 0;
}

body.page-ai-sohbet .page-hero.page-hero--ai-compact {
    padding: calc(var(--header-h, 80px) + 0.65rem) 0 0.9rem;
    flex-shrink: 0;
}

body.page-ai-sohbet .page-hero--ai-compact .page-title {
    margin-bottom: 0.35rem;
    font-size: clamp(1.35rem, 3vw, 1.75rem);
}

body.page-ai-sohbet .page-hero--ai-compact .page-hero-lead {
    margin-bottom: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

body.page-ai-sohbet .ai-sohbet-section--wa {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0 0 max(1rem, env(safe-area-inset-bottom, 0px));
    background: #d1d7db;
}

body.page-ai-sohbet .ai-sohbet-section__inner--wa {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
    padding: 0.65rem 0.75rem 1rem;
}

.imes-ai-chat.imes-ai-chat--page {
    position: static;
    inset: auto;
    z-index: auto;
    pointer-events: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.imes-ai-chat--page .imes-ai-chat__sheet--page {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: auto;
    min-height: min(72dvh, 620px);
    max-height: min(calc(100dvh - 11rem), 780px);
    transform: none !important;
    opacity: 1 !important;
    transition: none;
    overflow: hidden;
    border-radius: 12px;
    box-shadow:
        0 1px 1px rgba(11, 20, 26, 0.16),
        0 8px 28px rgba(11, 20, 26, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: #fff;
}

.imes-ai-chat--page .imes-ai-chat__header {
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
    z-index: 2;
}

.imes-ai-chat--page .imes-ai-chat__messages {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
}

.imes-ai-chat--page .imes-ai-chat__typing {
    flex-shrink: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.imes-ai-chat--page .imes-ai-chat__form {
    flex-shrink: 0;
    padding-bottom: max(0.55rem, env(safe-area-inset-bottom, 0px));
}

@media (max-width: 600px) {
    body.page-ai-sohbet .page-hero.page-hero--ai-compact {
        padding: calc(var(--header-h, 70px) + 0.5rem) 0 0.65rem;
    }

    body.page-ai-sohbet .ai-sohbet-section__inner--wa {
        padding: 0.35rem 0 0;
        max-width: none;
    }

    .imes-ai-chat--page .imes-ai-chat__sheet--page {
        border-radius: 0;
        border-left: none;
        border-right: none;
        max-height: min(calc(100dvh - 9.5rem), 900px);
        min-height: min(68dvh, 560px);
        box-shadow: none;
    }
}

/* ── WA tarzı üst bar (koyu yeşil) ───────────────────────────────────────── */
.imes-ai-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-shrink: 0;
    padding: 0.65rem 0.75rem;
    background: #075e54;
    color: #fff;
    min-height: 56px;
}

.imes-ai-chat__header-info {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    flex: 1;
}

.imes-ai-chat__header-text {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.08rem;
}

.imes-ai-chat__title {
    display: block;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.2;
    max-width: 100%;
}

/* Konu satırı kullanılmıyor (JS de göstermiyor) — eski önbellekte bile görünmesin */
#imesAiChatTopic.imes-ai-chat__topic,
.imes-ai-chat__topic {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

.imes-ai-chat__status-wrap {
    display: flex;
    align-items: center;
    gap: 0.38rem;
    margin-top: 0.06rem;
    min-height: 1.05rem;
}

.imes-ai-chat__status-wrap--typing .imes-ai-chat__presence-dot {
    opacity: 0;
    width: 0;
    min-width: 0;
    margin: 0;
    overflow: hidden;
}

.imes-ai-chat__presence-dot {
    flex-shrink: 0;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #25d366;
    box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.35);
    animation: imesAiPresencePulse 2s ease-in-out infinite;
}

@keyframes imesAiPresencePulse {
    0%,
    100% {
        box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.35);
        opacity: 1;
    }
    50% {
        box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.15);
        opacity: 0.95;
    }
}

.imes-ai-chat__status {
    display: block;
    font-size: 0.72rem;
    opacity: 0.92;
    line-height: 1.25;
    margin: 0;
    white-space: nowrap;
}

.imes-ai-chat__last-seen {
    display: block;
    font-size: 0.65rem;
    opacity: 0.75;
    margin: 0;
    margin-top: 0.1rem;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mobil: üst bar tek düzen — başlık; alt satırda çevrimiçi + son görülme yan yana, düzgün sığsın */
@media (max-width: 900px) {
    .imes-ai-chat__header {
        min-height: 0;
        padding: max(0.5rem, env(safe-area-inset-top, 0px)) 0.65rem 0.5rem;
        align-items: flex-start;
    }

    .imes-ai-chat__header-text {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        align-content: flex-start;
        column-gap: 0.45rem;
        row-gap: 0.12rem;
    }

    .imes-ai-chat__title {
        flex: 1 1 100%;
        min-width: 0;
        font-size: 0.95rem;
        line-height: 1.2;
    }

    .imes-ai-chat__status-wrap {
        margin-top: 0;
        flex: 0 0 auto;
        min-height: 0;
    }

    .imes-ai-chat__last-seen {
        margin-top: 0;
        flex: 1 1 auto;
        min-width: 0;
        font-size: 0.62rem;
        opacity: 0.82;
    }

    .imes-ai-chat__last-seen:not([hidden])::before {
        content: "·";
        margin-inline-end: 0.35rem;
        opacity: 0.65;
    }
}

.imes-ai-chat__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.imes-ai-chat__avatar--photo {
    padding: 0;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.35);
}

.imes-ai-chat__avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.imes-ai-chat__header-actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.imes-ai-chat__iconbtn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: background 0.2s ease;
}
.imes-ai-chat__iconbtn:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* ── Sohbet zemini: açık tema döşeme (assets/img/aisohbetbeyaz (1).jpg) ───── */
.imes-ai-chat__messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem 0.55rem;
    background-color: #f6f6f4;
    background-image: url("../img/aisohbetbeyaz%20%281%29.jpg");
    background-repeat: repeat;
    background-size: 420px auto;
    /* scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(7, 94, 84, 0.45) transparent;
}

.imes-ai-chat__msg {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    margin-bottom: 0.6rem;
    max-width: 92%;
}

.imes-ai-chat__msg--out {
    align-self: flex-end;
    align-items: flex-end;
    margin-left: auto;
}

.imes-ai-chat__bubble {
    display: inline-block;
    padding: 0.45rem 0.65rem 0.5rem;
    border-radius: 8px;
    font-size: 0.92rem;
    line-height: 1.45;
    word-break: break-word;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

.imes-ai-chat__msg--in .imes-ai-chat__bubble {
    background: #fff;
    color: #111;
    border-radius: 0 8px 8px 8px;
}

/* Giden balon: WhatsApp gibi — metin + (saat + çift tik) aynı satırda / sağ altta yan yana */
.imes-ai-chat__msg--out .imes-ai-chat__bubble {
    background: #dcf8c6;
    color: #111;
    border-radius: 8px 0 8px 8px;
    display: inline-flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: flex-end;
    align-content: flex-end;
    max-width: min(100%, 85vw);
    min-width: 0;
    padding: 0.42rem 0.55rem 0.42rem 0.65rem;
    gap: 0.2rem 0.4rem;
    box-sizing: border-box;
}

.imes-ai-chat__msg--out .imes-ai-chat__bubble-text {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
    word-break: normal;
    overflow-wrap: break-word;
    max-width: 100%;
}

.imes-ai-chat__msg--err .imes-ai-chat__bubble {
    background: #ffebee;
    color: #b71c1c;
    border-radius: 8px;
}

.imes-ai-chat__time {
    font-size: 0.65rem;
    color: rgba(0, 0, 0, 0.45);
    margin-top: 0.15rem;
    padding: 0 0.2rem;
}

/* Giden: saat + mavi tik yan yana; genişlik balonu zorla doldurmasın (WP hizası) */
.imes-ai-chat__msg-foot {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 0.1rem;
    margin: 0;
    flex: 0 0 auto;
    flex-shrink: 0;
    line-height: 1;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.imes-ai-chat__msg--out .imes-ai-chat__msg-foot {
    width: auto;
    max-width: none;
    align-self: flex-end;
    margin-top: 0;
}

.imes-ai-chat__msg--out .imes-ai-chat__msg-foot .imes-ai-chat__time {
    margin-top: 0;
    padding: 0;
    font-size: 0.65rem;
    color: rgba(0, 0, 0, 0.45);
    flex-shrink: 0;
}

.imes-ai-chat__ticks {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 0.72rem;
    flex-shrink: 0;
}

.imes-ai-chat__ticks i {
    display: inline-block;
    vertical-align: -0.08em;
    line-height: 1;
}

.imes-ai-chat__ticks--sent i {
    color: rgba(0, 0, 0, 0.42);
}

.imes-ai-chat__ticks--read i {
    color: #53bdeb;
}

.imes-ai-chat__typing {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem 0.5rem;
    background-color: #f6f6f4;
    background-image: url("../img/aisohbetbeyaz%20%281%29.jpg");
    background-repeat: repeat;
    background-size: 420px auto;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.imes-ai-chat__typing[hidden] {
    display: none !important;
}

.imes-ai-chat__typing-dots {
    display: inline-flex;
    gap: 4px;
    background: #fff;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

.imes-ai-chat__typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #546e7a;
    animation: imesAiDot 1.1s ease-in-out infinite;
}
.imes-ai-chat__typing-dots span:nth-child(2) {
    animation-delay: 0.15s;
}
.imes-ai-chat__typing-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes imesAiDot {
    0%,
    80%,
    100% {
        opacity: 0.35;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

.imes-ai-chat__typing-label {
    font-size: 0.78rem;
    color: #4a4a4a;
}

.imes-ai-chat__form {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.55rem 0.65rem 0.65rem;
    background: #f0f0f0;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.imes-ai-chat__form input {
    flex: 1;
    min-width: 0;
    border: none;
    border-radius: 24px;
    padding: 0.65rem 1rem;
    font-size: 0.92rem;
    font-family: var(--font-body);
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.imes-ai-chat__form input:focus {
    outline: 2px solid rgba(7, 94, 84, 0.35);
    outline-offset: 0;
}

.imes-ai-chat__send {
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: #075e54;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.15s ease;
}
.imes-ai-chat__send:hover {
    background: #064a43;
}
.imes-ai-chat__send:active {
    transform: scale(0.96);
}

.imes-ai-chat__sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.imes-ai-chat-open {
    overflow: hidden;
}

@media (max-width: 1024px) {
    .imes-ai-chat__sheet {
        right: 0;
        bottom: 0;
        width: 100%;
        height: min(92vh, 640px);
        max-height: 92vh;
        border-radius: 14px 14px 0 0;
    }
}

@media (max-width: 480px) {
    .imes-ai-chat__sheet {
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
}

html[data-theme="dark"] .imes-ai-chat__sheet {
    background: #1a1a1c;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .imes-ai-chat__messages {
    background-color: #0f161c;
    background-image: url("../img/aisohbetdark.jpg");
    background-repeat: repeat;
    background-size: 420px auto;
}

html[data-theme="dark"] .imes-ai-chat__msg--in .imes-ai-chat__bubble {
    background: #2a2a2e;
    color: #e8eaef;
}

html[data-theme="dark"] .imes-ai-chat__msg--out .imes-ai-chat__bubble {
    background: #1a3d34;
    color: #e8eaef;
}

html[data-theme="dark"] .imes-ai-chat__form {
    background: #101012;
}

html[data-theme="dark"] .imes-ai-chat__form input {
    background: #252528;
    color: #e8eaef;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .imes-ai-chat__typing {
    background-color: #0f161c;
    background-image: url("../img/aisohbetdark.jpg");
    background-repeat: repeat;
    background-size: 420px auto;
    border-top-color: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .imes-ai-chat__typing-dots {
    background: #2a2a2e;
}

html[data-theme="dark"] .imes-ai-chat__typing-label {
    color: #b8bec9;
}

html[data-theme="dark"] .imes-ai-chat__msg--err .imes-ai-chat__bubble {
    background: #3d1f1f;
    color: #fecaca;
}

/* Koyu tema: koyu sohbet zemini — saat/tik açık renk (kalıtımdan gelen #e8eaef’i ezer) */
html[data-theme="dark"] .imes-ai-chat__messages .imes-ai-chat__time,
html[data-theme="dark"] .imes-ai-chat__msg--out .imes-ai-chat__msg-foot .imes-ai-chat__time {
    color: rgba(255, 255, 255, 0.5) !important;
}

html[data-theme="dark"] .imes-ai-chat__ticks--sent i {
    color: rgba(255, 255, 255, 0.42) !important;
}

html[data-theme="dark"] .imes-ai-chat__ticks--read i {
    color: #53bdeb !important;
}

html[data-theme="dark"] body.page-ai-sohbet .ai-sohbet-section--wa {
    background: #0b141a;
}

html[data-theme="dark"] .imes-ai-chat--page .imes-ai-chat__sheet--page {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

/* ═══ ai-sohbet: WhatsApp Web 3 sütun (rail + menü + sohbet), site chrome gizli ═══ */
html:has(body.page-ai-sohbet-wa) {
    overflow-x: hidden;
    height: 100%;
    /* JS --imes-vvh: gerçek görünür yükseklik (mobil klavye) */
    height: var(--imes-vvh, 100%);
}

body.page-ai-sohbet-wa {
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: var(--imes-vvh, 100dvh);
    height: 100dvh;
    height: var(--imes-vvh, 100dvh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    background: #f0f2f5;
}

@supports (overflow: clip) {
    body.page-ai-sohbet-wa {
        overflow-x: clip;
    }
}

body.page-ai-sohbet-wa .scroll-progress,
body.page-ai-sohbet-wa .header,
body.page-ai-sohbet-wa .left-sidebar,
body.page-ai-sohbet-wa .right-sidebar,
body.page-ai-sohbet-wa .floating-wa,
body.page-ai-sohbet-wa .scroll-top-btn,
body.page-ai-sohbet-wa .footer {
    display: none !important;
}

body.page-ai-sohbet-wa .wa-page-main {
    flex: 1;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    /* Safe Area Yönetimi: Rail kendi padding'ini alacak, burası genel kapsayıcı */
    position: relative;
}

/* Grid: masaüstü 3 sütun; mobilde 2 sütun — sidebar+chat aynı hücre (sidebar fixed) taşmayı önler */
.wa-web-layout {
    flex: 1;
    min-height: 0;
    min-width: 0;
    display: grid;
    grid-template-columns: 64px minmax(240px, 320px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    background: #f0f2f5;
    color: #111b21;
}

/* Sol rail — WhatsApp Web açık tema: yuvarlak ikonlar */
.wa-web-rail {
    grid-column: 1;
    grid-row: 1;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: calc(0.65rem + env(safe-area-inset-top, 0px)) 0 calc(0.65rem + env(safe-area-inset-bottom, 0px));
    padding-left: env(safe-area-inset-left, 0px);
    background: #fff;
    border-right: 1px solid #e9edef;
    z-index: 2;
    box-shadow: 1px 0 0 rgba(0, 0, 0, 0.04);
}

.wa-web-rail__btn {
    width: 48px;
    height: 48px;
    min-width: 44px;
    min-height: 44px;
    border: none;
    border-radius: 50%;
    background: #e9edef;
    color: #54656f;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.wa-web-rail__btn:hover,
.wa-web-rail__btn:focus-visible {
    background: #d1d7db;
    color: #111b21;
    outline: none;
}

.wa-web-rail__btn:active {
    transform: scale(0.96);
}

.wa-web-rail__btn--link {
    text-decoration: none;
}

.wa-web-rail__btn--bottom {
    margin-top: auto;
}

.wa-web-rail__btn--search {
    background: #e9edef;
    color: #54656f;
}

.wa-web-rail__btn--mail {
    background: #e7f8f3;
    color: #008069;
}

.wa-web-rail__btn--mail:hover,
.wa-web-rail__btn--mail:focus-visible {
    background: #d4f0e8;
    color: #006656;
}

.wa-web-rail__btn--whatsapp {
    background: #25d366;
    color: #fff;
    box-shadow: 0 2px 6px rgba(37, 211, 102, 0.45);
}

.wa-web-rail__btn--whatsapp:hover,
.wa-web-rail__btn--whatsapp:focus-visible {
    background: #20bd5a;
    color: #fff;
}

.wa-web-rail__btn--whatsapp .fa-brands.fa-whatsapp {
    color: #fff;
}

.wa-web-rail__btn--theme {
    background: #e9edef;
    color: #54656f;
}

.wa-web-rail__btn--home {
    background: #e9edef;
    color: #54656f;
}

.wa-web-rail__theme-sun {
    display: none;
}

html[data-theme="dark"] .wa-web-rail__theme-moon {
    display: none;
}

html[data-theme="dark"] .wa-web-rail__theme-sun {
    display: inline-block;
}

.wa-web-sidebar {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    background: #fff;
    border-right: 1px solid #e9edef;
}

.wa-web-sidebar__head {
    padding: 0.65rem 0.75rem 0.5rem;
    border-bottom: 1px solid #e9edef;
    flex-shrink: 0;
    background: #f8f9fa;
}

.wa-web-sidebar__title {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #111b21;
}

.wa-web-sidebar__search-wrap {
    position: relative;
}

.wa-web-sidebar__search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    color: #8696a0;
    pointer-events: none;
}

.wa-web-sidebar__search {
    width: 100%;
    box-sizing: border-box;
    border: none;
    border-radius: 8px;
    padding: 0.55rem 0.65rem 0.55rem 2.1rem;
    font-size: 0.88rem;
    background: #f0f2f5;
    color: #111b21;
    box-shadow: inset 0 0 0 1px #e9edef;
}

.wa-web-sidebar__search::placeholder {
    color: #8696a0;
}

.wa-web-sidebar__search:focus {
    outline: 2px solid rgba(0, 128, 105, 0.35);
    outline-offset: 0;
    background: #fff;
}

.wa-web-sidebar__nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.wa-web-sidebar__list {
    list-style: none;
    margin: 0;
    padding: 0.35rem 0 0.75rem;
}

.wa-web-sidebar__item {
    padding: 0.35rem 0.75rem;
}

.wa-web-sidebar__item--active .wa-web-sidebar__link {
    color: #008069;
}

.wa-web-sidebar__item--active {
    background: #e7fce3;
}

.wa-web-sidebar__link {
    color: #111b21;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    display: block;
    line-height: 1.35;
}

.wa-web-sidebar__item:hover:not(.wa-web-sidebar__item--active) {
    background: #f5f6f6;
}

.wa-web-sidebar__item--active:hover {
    background: #dcf8c6;
}

.wa-web-sidebar__link:hover,
.wa-web-sidebar__link:focus-visible {
    text-decoration: none;
    color: #008069;
    outline: none;
}

.wa-web-sidebar__preview {
    display: block;
    font-size: 0.75rem;
    color: #667781;
    margin-top: 0.15rem;
    font-weight: 400;
}

.wa-web-sidebar__group {
    padding: 0.35rem 0 0.25rem;
}

.wa-web-sidebar__group-label {
    display: block;
    padding: 0.25rem 0.75rem 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #667781;
}

.wa-web-sidebar__sub {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wa-web-sidebar__sub .wa-web-sidebar__item {
    padding-left: 1rem;
}

.wa-web-sidebar__sub .wa-web-sidebar__link {
    font-weight: 500;
    font-size: 0.88rem;
}

.wa-web-sidebar__lang {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    border-top: 1px solid #e9edef;
    font-size: 0.85rem;
    background: #fff;
}

.wa-web-sidebar__lang-item {
    color: #008069;
    text-decoration: none;
    font-weight: 600;
}

.wa-web-sidebar__lang-item:hover {
    text-decoration: none;
    color: #25d366;
}

.wa-web-sidebar__lang-item--current {
    color: #8696a0;
    cursor: default;
}

.wa-web-chat {
    grid-column: 3;
    grid-row: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
    overflow: hidden;
}

body.page-ai-sohbet-wa .wa-web-chat .imes-ai-chat.imes-ai-chat--page {
    flex: 1;
    min-height: 0;
    height: 100%;
}

body.page-ai-sohbet-wa .wa-web-chat .imes-ai-chat__sheet--page {
    border-radius: 0;
    border: none;
    max-height: none !important;
    min-height: 0 !important;
    height: 100% !important;
    flex: 1;
    box-shadow: none;
    display: flex;
    flex-direction: column;
}

body.page-ai-sohbet-wa .imes-ai-chat__header {
    padding-top: max(0.65rem, env(safe-area-inset-top, 0px));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
}

body.page-ai-sohbet-wa .imes-ai-chat__wa-mobile-menu {
    flex-shrink: 0;
    margin-right: 0.35rem;
}

body.page-ai-sohbet-wa .imes-ai-chat__wa-mobile-menu[hidden] {
    display: none !important;
}

body.page-ai-sohbet-wa .imes-ai-chat__wa-mobile-menu:not([hidden]) {
    touch-action: manipulation;
    min-width: 44px;
    min-height: 44px;
}

body.page-ai-sohbet-wa .imes-ai-chat__iconbtn {
    touch-action: manipulation;
}

body.page-ai-sohbet-wa .imes-ai-chat__send {
    touch-action: manipulation;
}

/* ai-sohbet WA: sohbet sütunu — sheet + mesaj zemini tek parça (beyaz kutu şeridi yok) */
body.page-ai-sohbet-wa .wa-web-chat {
    background: #f6f6f4;
}

body.page-ai-sohbet-wa .imes-ai-chat--page .imes-ai-chat__sheet--page {
    background: #f6f6f4;
}

body.page-ai-sohbet-wa .imes-ai-chat__messages {
    touch-action: pan-y;
    overscroll-behavior-y: contain;
    background-color: #f6f6f4;
    background-image: url("../img/aisohbetbeyaz%20%281%29.jpg");
    background-repeat: repeat;
    background-size: 420px auto;
}

body.page-ai-sohbet-wa .imes-ai-chat__typing {
    background-color: #f6f6f4;
    background-image: url("../img/aisohbetbeyaz%20%281%29.jpg");
    background-repeat: repeat;
    background-size: 420px auto;
}

/* Koyu tema: ai-sohbet WA kabuğu — site koyu temasıyla uyumlu (önceden açık WA zorlanıyordu) */
html[data-theme="dark"] body.page-ai-sohbet-wa,
html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-layout {
    background: #0b141a;
    color: #e9edef;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-rail {
    background: #202c33;
    border-right-color: #2a3942;
    box-shadow: 1px 0 0 rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-rail__btn {
    background: #374248;
    color: #aebac1;
    box-shadow: none;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-rail__btn:hover,
html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-rail__btn:focus-visible {
    background: #3d4a54;
    color: #e9edef;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-rail__btn--mail {
    background: #1f4438;
    color: #00a884;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-rail__btn--mail:hover,
html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-rail__btn--mail:focus-visible {
    background: #1a3830;
    color: #06cf9c;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-sidebar {
    background: #111b21;
    border-right-color: #2a3942;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-sidebar__head {
    background: #202c33;
    border-bottom-color: #2a3942;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-sidebar__title {
    color: #e9edef;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-sidebar__search {
    background: #2a3942;
    color: #e9edef;
    box-shadow: inset 0 0 0 1px #3b4a54;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-sidebar__search:focus {
    background: #2a3942;
    outline: 2px solid rgba(0, 168, 132, 0.35);
    outline-offset: 0;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-sidebar__search-icon {
    color: #8696a0;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-sidebar__search::placeholder {
    color: #8696a0;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-sidebar__link {
    color: #e9edef;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-sidebar__link:hover,
html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-sidebar__link:focus-visible {
    color: #06cf9c;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-sidebar__preview {
    color: #8696a0;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-sidebar__item:hover:not(.wa-web-sidebar__item--active) {
    background: #202c33;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-sidebar__item--active {
    background: #2a3942;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-sidebar__item--active .wa-web-sidebar__link {
    color: #06cf9c;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-sidebar__item--active:hover {
    background: #2f3d47;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-sidebar__group-label {
    color: #8696a0;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-sidebar__lang {
    background: #111b21;
    border-top-color: #2a3942;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-sidebar__lang-item--current {
    color: #8696a0;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .wa-web-chat {
    background: #060a10;
}

/* Sohbet sütunu: sheet ile mesaj zemini aynı ton (döşeme jpg ile uyum) */
html[data-theme="dark"] body.page-ai-sohbet-wa .imes-ai-chat--page .imes-ai-chat__sheet--page {
    background: #0f161c;
    border-color: transparent;
    box-shadow: none;
}

/* Koyu tema: sohbet duvar kağıdı — tam alan cover + hafif overlay (okunabilirlik) */
html[data-theme="dark"] body.page-ai-sohbet-wa .imes-ai-chat__messages {
    touch-action: pan-y;
    overscroll-behavior-y: contain;
    background-color: #060a10;
    background-image: linear-gradient(rgba(6, 10, 16, 0.25), rgba(6, 10, 16, 0.25)),
        url("../img/ai-sohbet-dark-wallpaper.png");
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .imes-ai-chat__typing {
    background-color: #060a10;
    background-image: linear-gradient(rgba(6, 10, 16, 0.25), rgba(6, 10, 16, 0.25)),
        url("../img/ai-sohbet-dark-wallpaper.png");
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}

html[data-theme="dark"] body.page-ai-sohbet-wa .imes-ai-chat__form {
    background: linear-gradient(to top, rgba(6, 10, 16, 0.94), rgba(6, 10, 16, 0.82));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.wa-web-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(0, 0, 0, 0.5);
}

.wa-web-overlay[hidden] {
    display: none !important;
}

@media (max-width: 900px) {
    /*
     * Klavye açıkken üst başlık + sohbet görünür kalsın (WhatsApp benzeri).
     * visualViewport yüksekliği + offset ile gövdeyi görünür dikdörtgene kilitler.
     */
    body.page-ai-sohbet-wa {
        position: fixed;
        left: 0;
        right: 0;
        top: var(--imes-vv-top, 0px);
        width: 100%;
        height: var(--imes-vvh, 100dvh);
        min-height: var(--imes-vvh, 100dvh);
        max-height: var(--imes-vvh, 100dvh);
    }

    /* Flex yüksekliği: iç sohbet alanı kaydırılabilsin (Safari / Android WebView) */
    body.page-ai-sohbet-wa .wa-web-layout {
        height: 100%;
        min-height: 0;
    }

    body.page-ai-sohbet-wa .wa-web-chat {
        height: 100%;
        min-height: 0;
    }

    /* Mobil: tek sütun sohbet; sol rail sadece hamburger menü açıkken (çekmeceyle birlikte) */
    .wa-web-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .wa-web-rail {
        display: none;
    }

    .wa-web-layout--menu-open .wa-web-rail {
        display: flex;
        position: fixed;
        left: env(safe-area-inset-left, 0px);
        top: 0;
        bottom: 0;
        width: 56px;
        min-width: 56px;
        max-width: 56px;
        z-index: 10003;
        align-self: stretch;
        flex-direction: column;
        align-items: center;
        padding-left: 0;
        box-shadow: 1px 0 0 rgba(0, 0, 0, 0.04);
    }

    .wa-web-chat {
        grid-column: 1;
        grid-row: 1;
        width: 100%;
        max-width: 100%;
    }

    /* Menü kapalı: rail yok → sidebar tamamen soldan dışarı; açık: rail + sidebar yan yana */
    .wa-web-sidebar {
        grid-column: 1;
        grid-row: 1;
        position: fixed;
        left: env(safe-area-inset-left, 0px);
        top: 0;
        bottom: 0;
        width: min(88vw, 320px);
        max-width: calc(
            100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)
        );
        z-index: 10002;
        transform: translate3d(calc(-100% - 16px), 0, 0);
        transition:
            transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
            left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
        pointer-events: none;
        overscroll-behavior: contain;
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .wa-web-layout--menu-open .wa-web-sidebar {
        left: calc(56px + env(safe-area-inset-left, 0px));
        max-width: calc(
            100vw - 56px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)
        );
        transform: translate3d(0, 0, 0);
        box-shadow: 4px 0 32px rgba(0, 0, 0, 0.15);
        pointer-events: auto;
    }

    body.page-ai-sohbet-wa .wa-web-chat .imes-ai-chat__sheet--page {
        border-radius: 0;
    }

    /* iOS: input odakta yakınlaştırmayı önlemek için min 16px */
    .wa-web-sidebar__search,
    body.page-ai-sohbet-wa .imes-ai-chat__form input {
        font-size: 16px;
    }

    .wa-web-sidebar__link {
        padding: 0.2rem 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .wa-web-sidebar__sub .wa-web-sidebar__link {
        min-height: 40px;
    }

    .wa-web-overlay {
        touch-action: none;
    }
}

@media (max-width: 480px) {
    .wa-web-layout--menu-open .wa-web-rail {
        width: 52px;
        min-width: 52px;
        max-width: 52px;
    }

    .wa-web-layout--menu-open .wa-web-sidebar {
        left: calc(52px + env(safe-area-inset-left, 0px));
        max-width: calc(
            100vw - 52px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)
        );
    }

    .wa-web-sidebar {
        width: min(90vw, 300px);
    }

    .wa-web-rail__btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        font-size: 1rem;
    }

    .imes-ai-chat__header {
        padding: max(0.45rem, env(safe-area-inset-top, 0px)) 0.55rem 0.45rem;
    }

    .imes-ai-chat__avatar {
        width: 32px;
        height: 32px;
    }

    .imes-ai-chat__header-info strong {
        font-size: 0.88rem;
    }

    .imes-ai-chat__status {
        font-size: 0.68rem;
    }

    .imes-ai-chat__last-seen {
        font-size: 0.58rem;
    }

    .imes-ai-chat__form {
        padding: 0.45rem 0.55rem max(0.55rem, env(safe-area-inset-bottom, 0px));
        gap: 0.35rem;
    }

    .imes-ai-chat__form input {
        padding: 0.55rem 0.85rem;
    }

    .imes-ai-chat__send {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 900px) and (orientation: landscape) {
    body.page-ai-sohbet-wa .wa-web-chat .imes-ai-chat__sheet--page {
        min-height: 0;
    }
}
