/* ===== Live Support Chat — Webrace ===== */

.support-chat[hidden] {
    display: none !important;
}

.support-chat {
    position: fixed;
    bottom: 88px;
    right: 24px;
    z-index: 950;
    width: min(92vw, 380px);
    pointer-events: none;
}

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

.support-chat__panel {
    display: flex;
    flex-direction: column;
    height: min(70vh, 520px);
    background: linear-gradient(180deg, #1c1530 0%, #14101e 100%);
    border: 1px solid rgba(163, 38, 255, 0.35);
    border-radius: 16px;
    box-shadow:
        0 24px 60px -16px rgba(0, 0, 0, 0.75),
        0 0 40px -8px rgba(163, 38, 255, 0.3);
    overflow: hidden;
    transform: translateY(12px) scale(0.98);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.support-chat.is-open .support-chat__panel {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.support-chat__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(163, 38, 255, 0.08);
}

.support-chat__header-main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.support-chat__status-dot {
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    flex-shrink: 0;
}

.support-chat__title {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    color: #fff;
}

.support-chat__subtitle {
    margin: 2px 0 0;
    font-size: 11px;
    color: #a1a1aa;
}

.support-chat__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: #9ca3af;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.support-chat__close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.support-chat__guest,
.support-chat__offline {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    text-align: center;
    color: #a1a1aa;
    font-size: 13px;
    line-height: 1.6;
}

.support-chat__guest[hidden],
.support-chat__offline[hidden],
.support-chat__body[hidden] {
    display: none !important;
}

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

.support-chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(163, 38, 255, 0.35) transparent;
}

.support-chat__msg {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.support-chat__msg--welcome {
    align-self: center;
    max-width: 100%;
    text-align: center;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: #86efac;
    font-size: 12px;
}

.support-chat__msg--user {
    align-self: flex-end;
    background: linear-gradient(180deg, #b545ff 0%, #8a18e0 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.support-chat__msg--admin {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e4e4e7;
    border-bottom-left-radius: 4px;
}

.support-chat__msg-time {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    opacity: 0.65;
}

.support-chat__composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.support-chat__input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    resize: none;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(163, 38, 255, 0.25);
    background: #1a1428;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.support-chat__input:focus {
    border-color: var(--purple, #a326ff);
    box-shadow: 0 0 0 3px rgba(163, 38, 255, 0.15);
}

.support-chat__send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: linear-gradient(180deg, #b545ff 0%, #a326ff 100%);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: filter 0.15s, transform 0.12s;
}

.support-chat__send:hover:not(:disabled) {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.support-chat__send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.support-chat__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    border: none;
    cursor: pointer;
}

.support-chat__btn--primary {
    background: linear-gradient(180deg, #b545ff 0%, #a326ff 100%);
    color: #fff;
}

.support-chat__btn--ghost {
    background: rgba(255, 255, 255, 0.06);
    color: #d4d4d8;
}

.chat-fab.has-unread::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid #14101e;
}

@media (max-width: 640px) {
    .support-chat {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 80px;
    }

    .support-chat__panel {
        height: min(72vh, 560px);
    }
}
