/* ==========================================================================
   AKI — Canlı destek widget'ı (ziyaretçi tarafı)
   ========================================================================== */

.akchat {
    --akc-ink: #0A100E;
    --akc-ink-2: #16211E;
    --akc-brand: #3BA88E;
    --akc-bright: #4CC7A3;
    --akc-bright-hover: #6AD6B7;
    --akc-deep: #177A61;
    --akc-soft: #E6F4EF;
    --akc-text: #0D1412;
    --akc-muted: #56625E;
    --akc-line: #E1E6E4;
    --akc-zemin: #F3F5F4;
    --akc-ease: cubic-bezier(0.16, 1, 0.3, 1);

    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9990;
    font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--akc-text);
}

/* hidden niteliği her zaman kazanmalı: aşağıdaki display kuralları onu ezmesin */
.akchat [hidden] { display: none !important; }
.akchat *, .akchat *::before, .akchat *::after { box-sizing: border-box; }
.akchat p { margin: 0; }
.akchat svg { display: block; }

/* ---------- Balon ---------- */

.akchat__balon {
    position: relative;
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--akc-bright);
    color: var(--akc-ink);
    box-shadow: 0 18px 40px -12px rgba(7, 11, 10, 0.55), 0 0 0 6px rgba(76, 199, 163, 0.16);
    cursor: pointer;
    transition: transform 0.3s var(--akc-ease), background-color 0.25s var(--akc-ease), box-shadow 0.3s var(--akc-ease);
}
.akchat__balon:hover { transform: translateY(-3px); background: var(--akc-bright-hover); }
.akchat__balon:focus-visible { outline: 2px solid var(--akc-ink); outline-offset: 4px; }
.akchat__balon svg { width: 28px; height: 28px; transition: transform 0.3s var(--akc-ease), opacity 0.2s var(--akc-ease); }
.akchat__ikon-kapat { position: absolute; opacity: 0; transform: rotate(-90deg) scale(0.6); }
.akchat.is-acik .akchat__ikon-ac { opacity: 0; transform: rotate(90deg) scale(0.6); }
.akchat.is-acik .akchat__ikon-kapat { opacity: 1; transform: none; }

.akchat__rozet {
    position: absolute;
    top: -2px; right: -2px;
    min-width: 22px; height: 22px;
    display: grid; place-items: center;
    padding: 0 6px;
    border-radius: 999px;
    border: 2px solid #fff;
    background: #D92D20;
    color: #fff;
    font-size: 11px; font-weight: 800;
}

/* ---------- Pencere ---------- */

.akchat__pencere {
    position: absolute;
    right: 0;
    bottom: 78px;
    width: min(390px, calc(100vw - 32px));
    max-height: min(640px, calc(100vh - 130px));
    max-height: min(640px, calc(100dvh - 130px));
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 40px 90px -30px rgba(7, 11, 10, 0.6), 0 0 0 1px rgba(7, 11, 10, 0.06);
    transform-origin: bottom right;
    animation: akchatAc 0.35s var(--akc-ease) both;
}

@keyframes akchatAc {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to   { opacity: 1; transform: none; }
}

.akchat__ust {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 18px 18px 20px;
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(76, 199, 163, 0.22), transparent 60%),
        var(--akc-ink);
    color: #fff;
}

.akchat__logo {
    display: grid;
    place-items: center;
    width: 44px; height: 44px;
    flex: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.akchat__logo img { width: 32px; height: auto; }

.akchat__ustmetin { flex: 1; min-width: 0; }

.akchat__baslik { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.25; }

.akchat__durum {
    display: flex; align-items: center; gap: 7px;
    margin-top: 3px !important;
    font-size: 12.5px; font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

.akchat__nokta {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--akc-bright);
    animation: akchatNabiz 2s infinite;
}

@keyframes akchatNabiz {
    0%   { box-shadow: 0 0 0 0 rgba(76, 199, 163, 0.55); }
    70%  { box-shadow: 0 0 0 7px rgba(76, 199, 163, 0); }
    100% { box-shadow: 0 0 0 0 rgba(76, 199, 163, 0); }
}

.akchat__ustbtn {
    display: grid; place-items: center;
    width: 36px; height: 36px;
    flex: none;
    padding: 0; border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s var(--akc-ease);
}
.akchat__ustbtn:hover { background: rgba(255, 255, 255, 0.18); }
.akchat__ustbtn svg { width: 18px; height: 18px; }

/* ---------- Ön bilgi formu ---------- */

.akchat__form {
    display: flex; flex-direction: column; gap: 10px;
    padding: 22px 20px 20px;
    overflow-y: auto;
}

.akchat__karsilama { font-size: 20px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.25; }
.akchat__alt { margin: -2px 0 8px !important; font-size: 13.5px; line-height: 1.55; color: var(--akc-muted); }

.akchat__ikili { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.akchat__form input,
.akchat__form textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--akc-line);
    border-radius: 12px;
    background: var(--akc-zemin);
    font: inherit;
    font-size: 14.5px;
    color: var(--akc-text);
    transition: border-color 0.2s var(--akc-ease), box-shadow 0.2s var(--akc-ease), background-color 0.2s var(--akc-ease);
}
.akchat__form input::placeholder,
.akchat__form textarea::placeholder { color: #7B8783; }
.akchat__form input:focus,
.akchat__form textarea:focus {
    outline: none;
    border-color: var(--akc-brand);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(59, 168, 142, 0.16);
}
.akchat__form textarea { resize: none; min-height: 86px; }

.akchat__gonderbtn {
    min-height: 52px;
    margin-top: 4px;
    padding: 0 22px;
    border: 0; border-radius: 999px;
    background: var(--akc-ink);
    color: #fff;
    font: inherit; font-size: 15px; font-weight: 800;
    cursor: pointer;
    transition: background-color 0.2s var(--akc-ease), transform 0.2s var(--akc-ease);
}
.akchat__gonderbtn:hover:not(:disabled) { background: var(--akc-ink-2); }
.akchat__gonderbtn:active:not(:disabled) { transform: scale(0.98); }
.akchat__gonderbtn:disabled { opacity: 0.65; cursor: default; }
.akchat__gonderbtn:focus-visible { outline: 2px solid var(--akc-brand); outline-offset: 3px; }

.akchat__uyari {
    padding: 10px 12px;
    border-radius: 10px;
    background: #FFF1F0;
    font-size: 13px; font-weight: 600;
    color: #B42318;
}

/* ---------- Dil seçici ---------- */

.akchat__dil { position: relative; }

.akchat__dilbtn {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--akc-line);
    border-radius: 12px;
    background: #fff;
    font: inherit; font-size: 14.5px; font-weight: 700;
    color: var(--akc-text);
    cursor: pointer;
    transition: border-color 0.2s var(--akc-ease);
}
.akchat__dilbtn span { flex: 1; text-align: start; }
.akchat__dilbtn:hover { border-color: var(--akc-brand); }
.akchat__dilbtn img, .akchat__dilliste img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px rgba(7, 11, 10, 0.08); }
.akchat__ok { width: 18px; height: 18px; color: var(--akc-muted); transition: transform 0.2s var(--akc-ease); }
.akchat__dil.is-acik .akchat__ok { transform: rotate(180deg); }

.akchat__dilliste {
    position: absolute;
    top: calc(100% + 6px); left: 0; right: 0;
    z-index: 5;
    margin: 0; padding: 6px;
    list-style: none;
    border: 1px solid var(--akc-line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 24px 50px -20px rgba(7, 11, 10, 0.4);
    max-height: 260px; overflow-y: auto;
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity 0.2s var(--akc-ease), transform 0.2s var(--akc-ease), visibility 0.2s;
}
.akchat__dil.is-acik .akchat__dilliste { opacity: 1; visibility: visible; transform: none; }

.akchat__dilliste button {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 0; border-radius: 10px;
    background: none;
    font: inherit; font-size: 14.5px; font-weight: 600;
    color: var(--akc-muted);
    text-align: start;
    cursor: pointer;
    transition: background-color 0.15s var(--akc-ease), color 0.15s var(--akc-ease);
}
.akchat__dilliste button:hover { background: var(--akc-zemin); color: var(--akc-text); }
.akchat__dilliste button[aria-selected="true"] { color: var(--akc-deep); background: var(--akc-soft); }

/* ---------- Sohbet ---------- */

.akchat__govde { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.akchat__akis {
    flex: 1;
    min-height: 280px;
    max-height: 420px;
    padding: 20px 18px;
    overflow-y: auto;
    background: var(--akc-zemin);
    display: flex; flex-direction: column; gap: 10px;
}

.akchat__mesaj {
    max-width: 84%;
    padding: 11px 14px;
    border-radius: 16px;
    display: flex; flex-direction: column; gap: 4px;
}

.akchat__mesaj--ben {
    align-self: flex-end;
    background: var(--akc-ink);
    color: #fff;
    border-end-end-radius: 5px;
}

.akchat__mesaj--ekip {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--akc-line);
    color: var(--akc-text);
    border-end-start-radius: 5px;
}

.akchat__metin { font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }

.akchat__zaman { font-size: 11px; font-weight: 600; opacity: 0.6; }
.akchat__mesaj.is-bekliyor { opacity: 0.6; }
.akchat__mesaj--ekip .akchat__zaman { color: var(--akc-deep); opacity: 0.85; }

.akchat__bilgi {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    margin: 6px 0; padding: 12px 14px;
    border-radius: 12px;
    background: #fff;
    border: 1px dashed var(--akc-line);
    font-size: 13px; text-align: center; color: var(--akc-muted);
}
.akchat__bilgi--hata { border-color: #F2CACA; background: #FFF1F0; color: #B42318; }

.akchat__yenibtn {
    min-height: 40px;
    padding: 0 18px;
    border: 0; border-radius: 999px;
    background: var(--akc-bright);
    color: var(--akc-ink);
    font: inherit; font-size: 13.5px; font-weight: 800;
    cursor: pointer;
}
.akchat__yenibtn:hover { background: var(--akc-bright-hover); }

/* ---------- Görüşmeyi sonlandır ---------- */

.akchat__sonbar {
    display: flex;
    justify-content: flex-end;
    padding: 8px 12px;
    border-bottom: 1px solid var(--akc-line);
    background: #fff;
}

.akchat__sonbtn {
    display: inline-flex; align-items: center; gap: 7px;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--akc-line);
    border-radius: 999px;
    background: #fff;
    font: inherit; font-size: 12.5px; font-weight: 700;
    color: var(--akc-muted);
    cursor: pointer;
    transition: color 0.2s var(--akc-ease), border-color 0.2s var(--akc-ease), background-color 0.2s var(--akc-ease);
}
.akchat__sonbtn svg { width: 15px; height: 15px; }
.akchat__sonbtn:hover { color: #B42318; border-color: #F2CACA; background: #FFF6F5; }
.akchat__sonbtn:focus-visible { outline: 2px solid var(--akc-brand); outline-offset: 2px; }

.akchat__sononay {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
    width: 100%;
    font-size: 13px; font-weight: 700;
    color: var(--akc-text);
}
.akchat__sonbtnler { display: inline-flex; gap: 6px; margin-inline-start: auto; }
.akchat__sonhayir,
.akchat__sonevet {
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    font: inherit; font-size: 12.5px; font-weight: 800;
    cursor: pointer;
}
.akchat__sonhayir { border: 1px solid var(--akc-line); background: #fff; color: var(--akc-text); }
.akchat__sonhayir:hover { border-color: var(--akc-text); }
.akchat__sonevet { border: 0; background: #D92D20; color: #fff; }
.akchat__sonevet:hover:not(:disabled) { background: #B42318; }
.akchat__sonevet:disabled { opacity: 0.6; cursor: default; }

/* ---------- Yazma alanı ---------- */

.akchat__yazac {
    display: flex; align-items: flex-end; gap: 10px;
    padding: 12px 12px 12px 14px;
    border-top: 1px solid var(--akc-line);
    background: #fff;
}

.akchat__yazac textarea {
    flex: 1;
    min-height: 46px;
    max-height: 120px;
    padding: 12px 14px;
    border: 1px solid var(--akc-line);
    border-radius: 14px;
    background: var(--akc-zemin);
    font: inherit; font-size: 14.5px;
    color: var(--akc-text);
    resize: none;
    transition: border-color 0.2s var(--akc-ease), background-color 0.2s var(--akc-ease);
}
.akchat__yazac textarea:focus { outline: none; border-color: var(--akc-brand); background: #fff; }

.akchat__yazac button {
    display: grid; place-items: center;
    width: 46px; height: 46px; flex: none;
    padding: 0;
    border: 0; border-radius: 50%;
    background: var(--akc-bright);
    color: var(--akc-ink);
    cursor: pointer;
    transition: background-color 0.2s var(--akc-ease), transform 0.2s var(--akc-ease);
}
.akchat__yazac button:hover { background: var(--akc-bright-hover); }
.akchat__yazac button:active { transform: scale(0.95); }
.akchat__yazac button svg { width: 20px; height: 20px; }
[dir="rtl"] .akchat__yazac button svg { transform: scaleX(-1); }

/* ---------- Dar ekran: alttan açılan tam genişlik pencere ---------- */

@media (max-width: 520px) {
    .akchat { right: 16px; bottom: 16px; }
    .akchat__balon { width: 58px; height: 58px; }
    .akchat__pencere {
        position: fixed;
        left: 8px; right: 8px; bottom: 84px;
        width: auto;
        max-height: calc(100vh - 100px);
        max-height: calc(100dvh - 100px);
        border-radius: 20px;
    }
    .akchat__akis { max-height: none; min-height: 45vh; }
    .akchat__form input, .akchat__form textarea, .akchat__yazac textarea { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .akchat__pencere { animation: none; }
    .akchat__nokta { animation: none; }
    .akchat * { transition-duration: 0.01ms !important; }
}
