/* ============================================================
   AI support chat widget (all pages)
   ============================================================ */
.support-chat {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1080;
    font-family: "Manrope", "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
}
.support-chat-toggle {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 1px solid rgba(56, 189, 248, .4);
    background: linear-gradient(135deg, #0b2447, #2563eb);
    color: #fff;
    font-size: 23px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 18px 40px rgba(2, 8, 20, .35), 0 0 0 1px rgba(56, 189, 248, .12);
    transition: transform .18s ease, box-shadow .18s ease;
}
.support-chat-toggle:hover { transform: translateY(-2px); box-shadow: 0 24px 48px rgba(2, 8, 20, .42); }
.support-chat-toggle:active { transform: translateY(0); }
.support-chat-toggle::after {
    content: "";
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    border: 1px solid rgba(56, 189, 248, .35);
    animation: scPulse 2.6s infinite;
    pointer-events: none;
}
.support-chat-toggle-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    padding: 2px 5px;
    border-radius: 99px;
    border: 2px solid #071426;
    background: #22c55e;
    color: #fff;
    font-size: 8.5px;
    font-weight: 800;
    letter-spacing: .3px;
}
.support-chat.is-open .support-chat-toggle {
    background: #fff;
    color: #0b1b33;
    border-color: #dbe4f0;
}
.support-chat.is-open .support-chat-toggle::after,
.support-chat.is-open .support-chat-toggle-badge { display: none; }

.support-chat-panel {
    position: absolute;
    right: 0;
    bottom: 74px;
    width: 382px;
    max-width: calc(100vw - 28px);
    height: min(610px, calc(100vh - 118px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid #dbe4f0;
    background: #fff;
    box-shadow: 0 36px 90px rgba(2, 8, 20, .42);
    animation: scIn .2s ease both;
}
.support-chat-panel[hidden] { display: none !important; }

.support-chat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 17px;
    color: #fff;
    background:
        radial-gradient(260px 120px at 90% 0%, rgba(56, 189, 248, .22), transparent 70%),
        linear-gradient(135deg, #071426, #0b2a4f);
    border-bottom: 1px solid rgba(148, 163, 184, .16);
}
.support-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    color: #fff;
    font-size: 18px;
    flex: 0 0 auto;
    box-shadow: 0 8px 20px rgba(37, 99, 235, .35);
}
.support-chat-title { min-width: 0; }
.support-chat-title strong {
    display: block;
    font-size: 13.5px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.support-chat-title small {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    font-size: 10.5px;
}
.support-chat-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, .18);
    flex: 0 0 auto;
}
.support-chat-dot.offline { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .16); }
.support-chat-close {
    margin-left: auto;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 9px;
    background: rgba(255, 255, 255, .05);
    color: #cbd5e1;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .16s ease, color .16s ease;
}
.support-chat-close:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.support-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    background:
        radial-gradient(360px 220px at 0% 0%, rgba(56, 189, 248, .07), transparent 70%),
        #f4f7fc;
}
.support-chat-msg {
    max-width: 86%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
.support-chat-msg.assistant {
    align-self: flex-start;
    background: #fff;
    color: #0b1b33;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 5px;
    box-shadow: 0 4px 12px rgba(15, 35, 70, .05);
}
.support-chat-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    border-bottom-right-radius: 5px;
    box-shadow: 0 8px 18px rgba(37, 99, 235, .22);
}
.support-chat-msg.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}
.support-chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 36px;
}
.support-chat-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    animation: scBounce 1.1s infinite;
}
.support-chat-typing span:nth-child(2) { animation-delay: .15s; }
.support-chat-typing span:nth-child(3) { animation-delay: .3s; }

.support-chat-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 11px 12px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}
.support-chat-input {
    flex: 1;
    min-height: 42px;
    max-height: 112px;
    resize: none;
    padding: 11px 12px;
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    background: #f8fafc;
    color: #0b1b33;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.4;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.support-chat-input:focus {
    border-color: #60a5fa;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.support-chat-input:disabled { background: #f1f5f9; color: #94a3b8; }
.support-chat-send {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    color: #fff;
    font-size: 15px;
    box-shadow: 0 10px 22px rgba(37, 99, 235, .28);
    transition: transform .16s ease, opacity .16s ease;
}
.support-chat-send:hover:not(:disabled) { transform: translateY(-1px); }
.support-chat-send:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }
.support-chat-note {
    padding: 0 14px 10px;
    background: #fff;
    color: #94a3b8;
    font-size: 9.5px;
    text-align: center;
    letter-spacing: .1px;
}

@keyframes scPulse {
    0%, 100% { transform: scale(1); opacity: .8; }
    50% { transform: scale(1.08); opacity: .25; }
}
@keyframes scBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: .45; }
    30% { transform: translateY(-4px); opacity: 1; }
}
@keyframes scIn {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 575.98px) {
    .support-chat { right: 14px; bottom: 14px; }
    .support-chat-toggle { width: 54px; height: 54px; font-size: 21px; }
    .support-chat-panel {
        position: fixed;
        inset: 10px;
        width: auto;
        max-width: none;
        height: auto;
        bottom: 10px;
        border-radius: 18px;
    }
    .support-chat.is-open .support-chat-toggle { display: none; }
    .support-chat-msg { max-width: 90%; }
}

@media (prefers-reduced-motion: reduce) {
    .support-chat-toggle::after,
    .support-chat-typing span { animation: none; }
    .support-chat-panel { animation: none; }
}
