/* =========================================================
   Canlı destek
   ========================================================= */

.support-fabs {
    position: fixed; left: 22px; bottom: 38px; z-index: 165;
    display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
}
.support-fabs .whatsapp-float { position: static; left: auto; bottom: auto; z-index: auto; }
.chat-fab {
    position: relative;
    display: inline-flex; align-items: center; gap: 9px;
    height: 48px; padding: 0 17px 0 10px;
    border: 0; border-radius: 999px;
    background: var(--navy); color: var(--cream);
    font-family: inherit; font-size: 11.5px; font-weight: 800;
    box-shadow: 0 16px 34px -14px rgba(18, 34, 74, .85);
    cursor: pointer;
    transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.chat-fab:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -16px rgba(18, 34, 74, .9); }
.chat-fab-icon {
    width: 30px; height: 30px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--orange); color: var(--navy);
    flex-shrink: 0;
}
.chat-fab-icon .icon { width: 17px; height: 17px; }
.chat-fab-dot {
    position: absolute; top: 1px; right: 2px;
    width: 12px; height: 12px; border-radius: 50%;
    background: #e5484d; border: 2px solid var(--cream);
}
.chat-panel {
    position: fixed; left: 22px; bottom: 148px; z-index: 220;
    width: min(390px, calc(100vw - 32px));
    height: min(620px, calc(100dvh - 190px));
    min-height: 430px;
    display: flex; flex-direction: column;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 34px 80px -30px rgba(16, 24, 40, .55);
    overflow: hidden;
    opacity: 0; transform: translateY(14px) scale(.985);
    transition: opacity .22s var(--ease), transform .22s var(--ease);
}
.chat-panel.is-open { opacity: 1; transform: none; }
.chat-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 16px;
    background:
        radial-gradient(180px 90px at 100% 0%, rgba(242, 140, 40, .24), transparent 70%),
        var(--navy);
    color: var(--cream);
    flex-shrink: 0;
}
.chat-head-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-head-avatar {
    width: 38px; height: 38px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--orange); color: var(--navy);
    flex-shrink: 0;
}
.chat-head-avatar .icon { width: 19px; height: 19px; }
.chat-head-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chat-head-copy strong { font-size: 13.5px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head-status { display: flex; align-items: flex-start; gap: 5px; color: rgba(251, 247, 241, .62); font-size: 9.5px; font-weight: 600; line-height: 1.4; white-space: normal; overflow: hidden; }
.chat-head-status i { width: 6px; height: 6px; border-radius: 50%; background: #5bd6a0; box-shadow: 0 0 0 3px rgba(91, 214, 160, .16); flex-shrink: 0; margin-top: 4px; }
.chat-head-status.is-offline i { background: #f2b84b; box-shadow: 0 0 0 3px rgba(242, 184, 75, .16); }
.chat-head-close {
    width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid rgba(251, 247, 241, .16);
    background: rgba(251, 247, 241, .06); color: var(--cream);
    cursor: pointer;
    transition: background .18s ease;
}
.chat-head-close:hover { background: rgba(251, 247, 241, .16); }
.chat-head-close .icon { width: 15px; height: 15px; }
.chat-body {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    padding: 16px;
    background:
        radial-gradient(320px 180px at 0% 0%, rgba(242, 140, 40, .05), transparent 65%),
        var(--cream);
}
.chat-start { display: flex; flex-direction: column; gap: 12px; }
.chat-welcome { display: flex; align-items: flex-start; gap: 9px; }
.chat-welcome-avatar {
    width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--navy); color: var(--orange);
}
.chat-welcome-avatar .icon { width: 14px; height: 14px; }
.chat-welcome-bubble {
    padding: 10px 12px;
    background: var(--white); border: 1px solid var(--line);
    border-radius: 4px 14px 14px 14px;
    box-shadow: 0 6px 16px -12px rgba(16, 24, 40, .3);
}
.chat-welcome-bubble p { font-size: 11.5px; line-height: 1.65; color: var(--ink); }
.chat-welcome-bubble span { display: block; margin-top: 5px; color: var(--muted-light); font-size: 9px; font-weight: 700; }
.chat-away { font-size: 9.5px; line-height: 1.5; color: var(--muted); padding-left: 37px; }
.chat-notice {
    display: flex; align-items: flex-start; gap: 7px;
    padding: 9px 10px; border-radius: 9px;
    background: rgba(242, 140, 40, .11); border: 1px solid rgba(242, 140, 40, .24);
    color: #8a4d0c; font-size: 10px; line-height: 1.5;
}
.chat-notice .icon { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }
.chat-start-form { display: flex; flex-direction: column; gap: 9px; }
.chat-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.chat-field > span { font-size: 9.5px; font-weight: 800; color: var(--ink); letter-spacing: .01em; }
.chat-field > span em { color: var(--orange-dark); font-style: normal; }
.chat-field input, .chat-field textarea {
    width: 100%; min-width: 0;
    padding: 9px 11px;
    border: 1px solid var(--line-strong); border-radius: 8px;
    background: var(--white); color: var(--ink);
    font-family: inherit; font-size: 11.5px; line-height: 1.4;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.chat-field input { height: 37px; }
.chat-field textarea { min-height: 54px; resize: vertical; line-height: 1.5; }
.chat-field input:focus, .chat-field textarea:focus {
    outline: none; border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(242, 140, 40, .13);
}
.chat-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chat-form-note { font-size: 9px; color: var(--muted-light); line-height: 1.5; }
.chat-start-btn { width: 100%; height: 42px; justify-content: center; font-size: 11.5px; }
.chat-start-btn .icon { width: 15px; height: 15px; }
.chat-error {
    padding: 8px 10px; border-radius: 8px;
    background: #fff1ef; border: 1px solid #f2c9c2;
    color: #a52f23; font-size: 10px; font-weight: 700; line-height: 1.5;
}
.chat-thread { display: flex; flex-direction: column; gap: 11px; }
.chat-msg { display: flex; flex-direction: column; gap: 3px; max-width: 100%; }
.chat-msg.is-visitor { align-items: flex-end; }
.chat-msg.is-admin { align-items: flex-start; }
.chat-msg.is-system { align-items: center; }
.chat-msg.is-new .chat-bubble, .chat-msg.is-new .chat-system { animation: chatMsgIn .2s ease; }
@keyframes chatMsgIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}
.chat-bubble {
    max-width: 84%;
    padding: 9px 12px;
    font-size: 11.5px; line-height: 1.62;
    word-break: break-word; overflow-wrap: anywhere;
}
.chat-msg.is-visitor .chat-bubble {
    background: var(--navy); color: var(--cream);
    border-radius: 14px 14px 4px 14px;
    box-shadow: 0 8px 18px -14px rgba(18, 34, 74, .8);
}
.chat-msg.is-admin .chat-bubble {
    background: var(--white); color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 14px 14px 14px 4px;
    box-shadow: 0 6px 16px -14px rgba(16, 24, 40, .28);
}
.chat-system {
    max-width: 94%;
    padding: 7px 10px;
    border-radius: 8px;
    background: rgba(18, 34, 74, .055);
    color: var(--muted);
    font-size: 9.5px; line-height: 1.55; text-align: center;
}
.chat-time { font-size: 8.5px; color: var(--muted-light); padding-inline: 3px; }
.chat-thread-empty { padding: 18px 10px; text-align: center; color: var(--muted-light); font-size: 10.5px; }
.chat-composer {
    flex-shrink: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: var(--white);
    border-top: 1px solid var(--line);
}
.chat-send-form { display: flex; align-items: flex-end; gap: 7px; }
.chat-send-form textarea {
    flex: 1; min-width: 0; min-height: 40px; max-height: 104px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong); border-radius: 11px;
    background: var(--cream); color: var(--ink);
    font-family: inherit; font-size: 11.5px; line-height: 1.45;
    resize: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.chat-send-form textarea:focus {
    outline: none; border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(242, 140, 40, .12);
    background: var(--white);
}
.chat-send-btn {
    width: 40px; height: 40px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 11px;
    background: var(--orange); color: var(--navy);
    cursor: pointer;
    transition: background .18s ease, transform .18s ease;
}
.chat-send-btn:hover { background: var(--orange-dark); color: var(--white); transform: translateY(-1px); }
.chat-send-btn:disabled { opacity: .55; cursor: wait; transform: none; }
.chat-send-btn .icon { width: 17px; height: 17px; }
.chat-composer-meta {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-top: 6px;
    font-size: 8.5px; color: var(--muted-light);
}
.chat-composer-meta span { display: inline-flex; align-items: center; gap: 4px; }
.chat-composer-meta .icon { width: 10px; height: 10px; }
.chat-composer-meta button {
    border: 0; background: none; padding: 0;
    color: var(--muted); font-family: inherit; font-size: 8.5px; font-weight: 700;
    text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.chat-composer-meta button:hover { color: #b23b2e; }
.chat-fab.is-active { background: var(--orange); color: var(--navy); }

@media (max-width: 768px) {
    .support-fabs { left: 12px; bottom: 78px; gap: 8px; }
    .support-fabs .whatsapp-float { height: 40px; padding: 0 13px; }
    .support-fabs .whatsapp-float span { display: none; }
    .chat-fab-label { display: none; }
    .chat-fab { width: 44px; height: 44px; padding: 0; justify-content: center; }
    .chat-panel { left: 12px; bottom: 132px; width: min(380px, calc(100vw - 24px)); height: min(560px, calc(100dvh - 160px)); }
}

@media (max-width: 640px) {
    body.is-chat-open { overflow: hidden; }
    .chat-panel {
        left: 0; right: 0; top: 0; bottom: 0;
        width: 100%; height: 100dvh; min-height: 0;
        border-radius: 0; border: 0;
    }
    .chat-head { padding: 15px 16px; }
    .chat-body { padding: 16px 14px; }
}

@media (max-width: 520px) {
    .support-fabs { bottom: 72px; }
    .support-fabs .whatsapp-float { width: 40px; padding: 0; justify-content: center; }
    .chat-fab { width: 44px; height: 44px; }
    .chat-field-row { grid-template-columns: 1fr; }
}

@media (max-width: 1023px) {
    .is-product .support-fabs { bottom: 118px; }
}

@media (prefers-reduced-motion: reduce) {
    .chat-panel, .chat-fab, .chat-send-btn { transition: none; }
}
