/* Support chat — right-side floating widget (upper-right) */
.support-chat-root {
    position: fixed;
    right: 16px;
    top: calc(22vh - 32px);
    z-index: 9998;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
}

.support-chat-root > * {
    pointer-events: auto;
}

.support-chat-fab {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 64px;
    height: 64px;
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    font-family: inherit;
    background: linear-gradient(145deg, #06b6d4, #2563eb);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18), 0 10px 32px rgba(37, 99, 235, 0.5);
    transition: transform 0.2s, box-shadow 0.2s;
    animation: support-chat-pulse 2.8s ease-in-out infinite;
}

@keyframes support-chat-pulse {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18), 0 10px 32px rgba(37, 99, 235, 0.5);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(6, 182, 212, 0.22), 0 12px 36px rgba(37, 99, 235, 0.6);
    }
}

.support-chat-fab:hover {
    transform: translateY(-2px) scale(1.04);
    animation: none;
    box-shadow: 0 0 0 6px rgba(6, 182, 212, 0.25), 0 14px 36px rgba(37, 99, 235, 0.6);
}

.support-chat-fab.is-active {
    background: linear-gradient(145deg, #0891b2, #1d4ed8);
}

.support-chat-fab.is-hidden {
    display: none;
}

.support-chat-fab.has-unread {
    animation: support-chat-unread-blink 1s ease-in-out infinite;
}

.support-chat-fab.has-unread i {
    animation: support-chat-icon-shake 0.6s ease-in-out infinite;
}

@keyframes support-chat-unread-blink {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.35), 0 10px 32px rgba(239, 68, 68, 0.55);
        background: linear-gradient(145deg, #f97316, #dc2626);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0.2), 0 14px 40px rgba(239, 68, 68, 0.65);
        background: linear-gradient(145deg, #fb923c, #ef4444);
    }
}

@keyframes support-chat-icon-shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-8deg); }
    75% { transform: rotate(8deg); }
}

.support-chat-fab i {
    font-size: 22px;
    line-height: 1;
}

.support-chat-fab-label {
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
}

.support-chat-panel {
    display: none;
    position: fixed;
    right: 16px;
    top: max(72px, calc(22vh + 52px));
    bottom: 16px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: auto;
    max-height: none;
    background: #0a1020;
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-radius: 16px;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.support-chat-panel.is-open {
    display: flex;
    min-height: 360px;
}

.support-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
    flex-shrink: 0;
}

.support-chat-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.support-chat-close:hover {
    color: #f1f5f9;
}

.support-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

.support-chat-loading,
.support-chat-error {
    align-self: center;
    margin: auto 0;
    font-size: 13px;
    color: #94a3b8;
    text-align: center;
    padding: 16px 12px;
}

.support-chat-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.support-chat-loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #38bdf8;
    animation: support-chat-loading-pulse 0.9s ease-in-out infinite;
}

@keyframes support-chat-loading-pulse {
    0%, 100% {
        opacity: 0.35;
        transform: scale(0.85);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

.support-chat-error {
    color: #f87171;
}

.support-msg {
    max-width: 88%;
    font-size: 13px;
    line-height: 1.5;
}

.support-msg time {
    display: block;
    font-size: 10px;
    color: #64748b;
    margin-top: 4px;
}

.support-msg--customer {
    align-self: flex-end;
}

.support-msg--customer .support-msg-body {
    background: rgba(0, 119, 255, 0.25);
    color: #e2e8f0;
    padding: 8px 12px;
    border-radius: 12px 12px 2px 12px;
}

.support-msg--bot,
.support-msg--admin {
    align-self: flex-start;
}

.support-msg--bot .support-msg-body,
.support-msg--admin .support-msg-body {
    background: rgba(15, 25, 45, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    padding: 8px 12px;
    border-radius: 12px 12px 12px 2px;
}

.support-chat-input-wrap {
    position: relative;
}

.support-chat-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 6px);
    max-height: min(160px, 28vh);
    overflow-y: auto;
    background: #0d1528;
    border: 1px solid rgba(0, 212, 255, 0.35);
    border-radius: 10px;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
    z-index: 2;
    padding: 6px 0;
}

.support-chat-suggestions[hidden] {
    display: none !important;
}

.support-suggest-label {
    font-size: 11px;
    color: #64748b;
    padding: 4px 12px 6px;
}

.support-suggest-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #e2e8f0;
    font-size: 13px;
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.15s;
}

.support-suggest-item:hover,
.support-suggest-item.is-highlighted {
    background: rgba(0, 212, 255, 0.12);
    color: #bae6fd;
}

.support-suggest-item + .support-suggest-item {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.support-chat-footer {
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.support-chat-actions {
    margin-bottom: 8px;
}

.support-chat-input-row {
    display: flex;
    gap: 8px;
}

.support-chat-input-row input {
    flex: 1;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(5, 15, 30, 0.6);
    color: #f1f5f9;
    font-size: 13px;
}

.support-chat-hint {
    font-size: 10px;
    color: #64748b;
    margin-top: 8px;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .support-chat-panel {
        left: 12px;
        right: 12px;
        width: auto;
        top: max(64px, calc(18vh + 44px));
        bottom: 12px;
    }
}

@media (max-width: 480px) {
    .support-chat-root {
        right: 10px;
        top: calc(18vh - 28px);
    }

    .support-chat-fab-label {
        display: none;
    }

    .support-chat-fab {
        width: 56px;
        height: 56px;
    }
}
