/* ===== Support Chatbox ===== */
.support-chat {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.support-chat__trigger {
    position: relative;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.875rem;
    background: linear-gradient(135deg, rgba(17, 142, 255, 1) 0%, rgba(17, 142, 255, 0.65) 100%);
    box-shadow: 0 6px 28px rgba(17, 142, 255, 0.55), 0 0 70px rgba(17, 142, 255, 0.35), 0 0 120px rgba(17, 142, 255, 0.2);
    color: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: supportChatPulse 2s ease-in-out infinite, supportChatFloat 3s ease-in-out infinite;
}

.support-chat__trigger::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(17, 142, 255, 0.6);
    animation: supportChatRing 2s ease-out infinite;
    pointer-events: none;
}

@keyframes supportChatPulse {
    0%, 100% { box-shadow: 0 6px 28px rgba(17, 142, 255, 0.55), 0 0 70px rgba(17, 142, 255, 0.35), 0 0 120px rgba(17, 142, 255, 0.2); }
    50% { box-shadow: 0 8px 36px rgba(17, 142, 255, 0.65), 0 0 90px rgba(17, 142, 255, 0.45), 0 0 140px rgba(17, 142, 255, 0.25); }
}

@keyframes supportChatRing {
    0% { transform: scale(0.95); opacity: 0.8; }
    100% { transform: scale(1.4); opacity: 0; }
}

@keyframes supportChatFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.support-chat__trigger:hover {
    transform: scale(1.1) translateY(0);
    box-shadow: 0 10px 40px rgba(17, 142, 255, 0.65), 0 0 100px rgba(17, 142, 255, 0.45);
    animation: none;
}

.support-chat__trigger:hover::before {
    animation: none;
    opacity: 0;
}

.support-chat__panel {
    position: absolute;
    bottom: 88px;
    right: 0;
    width: 420px;
    height: 540px;
    max-height: calc(100vh - 120px);
    background: rgba(18, 18, 22, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 18px;
    border: 1px solid rgba(17, 142, 255, 0.3);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), 0 0 80px rgba(17, 142, 255, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.9) translateY(10px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.support-chat__panel.support-chat__panel--open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.support-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(180deg, rgba(17, 142, 255, 0.12) 0%, transparent 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.support-chat__auto-close {
    flex-shrink: 0;
    padding: 10px 20px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(17, 142, 255, 0.15);
    border-bottom: 1px solid rgba(17, 142, 255, 0.2);
    text-align: center;
}

.support-chat__title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.support-chat__status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
}

.support-chat__status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.support-chat__close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.support-chat__close:hover {
    background: rgba(17, 142, 255, 0.2);
    color: #fff;
}

.support-chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.support-chat__message {
    max-width: 90%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 0.9375rem;
    line-height: 1.5;
    animation: supportChatFadeIn 0.3s ease;
}

@keyframes supportChatFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.support-chat__message--bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.95);
}

.support-chat__message--user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(17, 142, 255, 0.25) 0%, rgba(17, 142, 255, 0.2) 100%);
    border: 1px solid rgba(17, 142, 255, 0.35);
    color: #fff;
}

.support-chat__message--bot .support-chat__message-text {
    white-space: pre-line;
}

.support-chat__message--rate-limit {
    background: rgba(17, 142, 255, 0.12);
    border-color: rgba(17, 142, 255, 0.25);
}

.support-chat__message--rate-limit .support-chat__message-text {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.85);
}

.support-chat__options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.support-chat__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(17, 142, 255, 0.3);
    background: radial-gradient(circle at 0% 0%, rgba(17, 142, 255, 0.18), rgba(17, 142, 255, 0.05));
    color: rgba(255, 255, 255, 0.96);
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
    gap: 10px;
    position: relative;
    overflow: hidden;
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

.support-chat__option:hover {
    background: radial-gradient(circle at 0% 0%, rgba(17, 142, 255, 0.28), rgba(17, 142, 255, 0.08));
    border-color: rgba(17, 142, 255, 0.65);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    transform: translateY(-1px);
}

.support-chat__option:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.support-chat__typing {
    align-self: flex-start;
    padding: 10px 14px;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    animation: supportChatFadeIn 0.3s ease;
}

.support-chat__discord-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid rgba(88, 101, 242, 0.5);
    background: rgba(88, 101, 242, 0.2);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.support-chat__discord-btn:hover {
    background: rgba(88, 101, 242, 0.35);
    border-color: rgba(88, 101, 242, 0.7);
}

.support-chat__discord-btn i {
    font-size: 1.125rem;
}

/* ===== Support Chat: Mobile ===== */
@media (max-width: 768px) {
    .support-chat {
        bottom: max(16px, env(safe-area-inset-bottom));
        right: max(16px, env(safe-area-inset-right));
        left: auto;
    }

    .support-chat__trigger {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }

    .support-chat__trigger:active {
        transform: scale(0.98);
    }

    .support-chat__panel {
        left: max(12px, env(safe-area-inset-left));
        right: max(12px, env(safe-area-inset-right));
        bottom: calc(56px + 16px + env(safe-area-inset-bottom, 0px));
        width: calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
        max-width: none;
        height: 70vh;
        max-height: calc(100dvh - 100px);
        border-radius: 16px;
    }

    .support-chat__header {
        padding: 14px 16px;
    }

    .support-chat__title {
        font-size: 1rem;
    }

    .support-chat__close {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .support-chat__messages {
        padding: 16px;
    }

    .support-chat__message {
        padding: 10px 14px;
        font-size: 0.875rem;
        max-width: 92%;
    }

    .support-chat__option {
        padding: 12px 14px;
        min-height: 44px;
        font-size: 0.875rem;
    }

    .support-chat__auto-close {
        padding: 12px 16px;
        font-size: 0.8125rem;
    }

    .support-chat__discord-btn {
        padding: 12px 20px;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .support-chat {
        bottom: max(12px, env(safe-area-inset-bottom));
        right: max(12px, env(safe-area-inset-right));
    }

    .support-chat__panel {
        left: max(8px, env(safe-area-inset-left));
        right: max(8px, env(safe-area-inset-right));
        width: calc(100vw - 16px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
        height: 65vh;
        max-height: calc(100dvh - 90px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .support-chat__trigger,
    .support-chat__trigger::before {
        animation: none;
    }
}
