/* Canlı destek penceresi. Renkler temanın ana renginden (--main-color) türetilir. */
.sd-destek {
    --sd-ana: var(--main-color, #524bb9);
    --sd-yazi: #1f2430;
    --sd-soluk: #6b7280;
    --sd-cizgi: #e4e7ee;
    --sd-zemin: #f4f5f9;
    font-family: inherit;
}
.sd-destek [hidden] { display: none !important; }

/* ---------- balon ---------- */
.sd-destek-balon {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 98;
    width: 58px;
    height: 58px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--sd-ana);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(31, 36, 48, .24);
    transition: transform .15s ease, box-shadow .15s ease;
}
.sd-destek-balon:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(31, 36, 48, .3); }
.sd-destek-balon:focus-visible,
.sd-destek-kapat:focus-visible,
.sd-destek-form button:focus-visible,
.sd-destek-iletisim button:focus-visible { outline: 3px solid rgba(255, 255, 255, .9); outline-offset: 2px; box-shadow: 0 0 0 5px var(--sd-ana); }
.sd-destek.sd-acik .sd-destek-balon { display: none; }
.sd-destek-rozet {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #e5484d;
    color: #fff;
    font: 700 12px/20px Arial, sans-serif;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}
.bm-destek-item .icon { position: relative; }
.bm-destek-item .sd-destek-rozet { top: -3px; right: -9px; }

/* ---------- pencere ---------- */
.sd-destek-pencere {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1000;
    width: 384px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(31, 36, 48, .3);
    overflow: hidden;
    color: var(--sd-yazi);
}
.sd-destek-baslik {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 14px 14px 16px;
    background: var(--sd-ana);
    color: #fff;
}
.sd-destek-kimlik { display: flex; align-items: center; gap: 11px; min-width: 0; }
.sd-destek-avatar {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
}
.sd-destek-ad { display: block; font-size: 15px; font-weight: 700; line-height: 1.3; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-destek-altbaslik { display: block; font-size: 12px; line-height: 1.35; color: rgba(255, 255, 255, .86); }
.sd-destek-kapat {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sd-destek-kapat:hover { background: rgba(255, 255, 255, .16); }

/* ---------- mesajlar ---------- */
.sd-destek-mesajlar {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px;
    background: var(--sd-zemin);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sd-m {
    max-width: 85%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.sd-m a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.sd-m--musteri { align-self: flex-end; background: var(--sd-ana); color: #fff; border-bottom-right-radius: 4px; }
.sd-m--bekleyen { opacity: .7; }
.sd-m--asistan,
.sd-m--temsilci { align-self: flex-start; background: #fff; border: 1px solid var(--sd-cizgi); border-bottom-left-radius: 4px; }
.sd-m--temsilci { border-left: 3px solid var(--sd-ana); }
.sd-m-etiket { display: block; margin-bottom: 2px; font-size: 11px; font-weight: 700; letter-spacing: .02em; color: var(--sd-ana); white-space: normal; }
.sd-m-zaman { display: block; margin-top: 3px; font-size: 11px; line-height: 1.2; opacity: .62; white-space: normal; }
.sd-m--musteri .sd-m-zaman { text-align: right; }
.sd-m--sistem {
    align-self: center;
    max-width: 94%;
    padding: 7px 12px;
    border-radius: 10px;
    background: #e9ebf2;
    color: #4b5563;
    font-size: 12.5px;
    line-height: 1.45;
    text-align: center;
}
.sd-destek-yaziyor {
    align-self: flex-start;
    display: inline-flex;
    gap: 5px;
    padding: 13px 14px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    background: #fff;
    border: 1px solid var(--sd-cizgi);
}
.sd-destek-yaziyor span { width: 7px; height: 7px; border-radius: 50%; background: #a3a9b6; animation: sd-destek-nokta 1.2s infinite ease-in-out; }
.sd-destek-yaziyor span:nth-child(2) { animation-delay: .15s; }
.sd-destek-yaziyor span:nth-child(3) { animation-delay: .3s; }
@keyframes sd-destek-nokta { 0%, 80%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* ---------- formlar ---------- */
.sd-destek-iletisim { margin: 0; padding: 12px 14px; background: #fff8e6; border-top: 1px solid #f1dfae; }
.sd-destek-iletisim label { display: block; margin: 0 0 7px; font-size: 12.5px; font-weight: 600; line-height: 1.4; color: #6b4e00; }
.sd-destek-iletisim-satir { display: flex; gap: 8px; }
.sd-destek-iletisim input {
    flex: 1 1 auto;
    min-width: 0;
    height: 42px;
    padding: 0 12px;
    border: 1px solid #d9c98f;
    border-radius: 10px;
    background: #fff;
    font-size: 15px;
    color: var(--sd-yazi);
}
.sd-destek-iletisim button {
    flex: 0 0 auto;
    height: 42px;
    padding: 0 16px;
    border: 0;
    border-radius: 10px;
    background: var(--sd-ana);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.sd-destek-form { margin: 0; padding: 10px 12px; background: #fff; border-top: 1px solid var(--sd-cizgi); }
.sd-destek-form-satir { display: flex; align-items: flex-end; gap: 8px; }
.sd-destek-form textarea {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    max-height: 120px;
    padding: 11px 13px;
    border: 1px solid var(--sd-cizgi);
    border-radius: 12px;
    background: var(--sd-zemin);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.4;
    color: var(--sd-yazi);
    resize: none;
}
.sd-destek-form textarea:focus,
.sd-destek-iletisim input:focus { outline: 0; border-color: var(--sd-ana); box-shadow: 0 0 0 3px rgba(82, 75, 185, .16); background: #fff; }
.sd-destek-form button {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: var(--sd-ana);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sd-destek-form button[disabled] { opacity: .55; cursor: default; }
.sd-destek-hata { margin: 0 0 8px; padding: 8px 10px; border-radius: 8px; background: #fdecec; color: #a4262c; font-size: 12.5px; line-height: 1.4; }
.sd-destek-iletisim .sd-destek-hata { margin: 8px 0 0; }
.sd-destek-alt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 14px 10px;
    background: #fff;
    font-size: 12px;
    color: var(--sd-soluk);
}
.sd-destek-alt-sol { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px 10px; }
.sd-destek-bitir {
    padding: 10px 0;
    border: 0;
    background: none;
    color: var(--sd-yazi);
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.sd-destek-bitir:hover { color: var(--sd-ana); }
.sd-destek-bitir:focus-visible { outline: 2px solid var(--sd-ana); outline-offset: 2px; border-radius: 4px; }
.sd-destek-bitir[disabled] { opacity: .55; cursor: default; }
.sd-destek-whatsapp { display: inline-flex; align-items: center; gap: 5px; color: #128c4a; font-weight: 600; text-decoration: none; white-space: nowrap; }
.sd-destek-whatsapp:hover { text-decoration: underline; color: #0e7a40; }
.sd-destek-whatsapp i { font-size: 16px; }

/* ---------- mobil: tam ekran ---------- */
@media (max-width: 1024px) {
    .sd-destek[data-bar="1"] .sd-destek-balon { display: none; }
    .sd-destek-balon { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
    .sd-destek-pencere {
        right: 0;
        bottom: 0;
        left: 0;
        top: 0;
        width: 100%;
        max-width: none;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }
    .sd-destek-alt { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
    .sd-destek-form textarea,
    .sd-destek-iletisim input { font-size: 16px; }
    html.sd-destek-acik,
    html.sd-destek-acik body { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
    .sd-destek-balon { transition: none; }
    .sd-destek-yaziyor span { animation: none; opacity: .7; }
}
