.support-widget-root {
    position: fixed;
    right: 1.25rem;
    bottom: 4.25rem;
    z-index: 12000;
    font-family: 'Poppins', system-ui, sans-serif;
}

.support-widget-fab {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--jl-accent, #c94a50), var(--jl-accent-hover, #b03e44));
    box-shadow: 0 10px 28px rgba(201, 74, 80, 0.35);
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.support-widget-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(201, 74, 80, 0.42);
}

.support-widget-root.is-open .support-widget-fab {
    transform: scale(0.92);
}

.support-widget-fab-icon {
    width: 28px;
    height: 28px;
    background:
        radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.95) 0 3px, transparent 3px),
        radial-gradient(circle at 62% 35%, rgba(255, 255, 255, 0.95) 0 3px, transparent 3px),
        radial-gradient(circle at 48% 58%, rgba(255, 255, 255, 0.95) 0 3px, transparent 3px);
    border-radius: 50%;
    opacity: 0.95;
}

.support-widget-fab-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.support-widget-root.has-unread .support-widget-fab {
    animation: supportFabPulse 1.6s ease-in-out infinite;
}

@keyframes supportFabPulse {
    0%, 100% {
        box-shadow: 0 10px 28px rgba(201, 74, 80, 0.35);
    }
    50% {
        box-shadow: 0 10px 28px rgba(201, 74, 80, 0.35), 0 0 0 8px rgba(201, 74, 80, 0.18);
    }
}

.support-widget-reply-toast {
    position: fixed;
    right: 6.5rem;
    bottom: 4.6rem;
    z-index: 11999;
    max-width: 260px;
    padding: 0.85rem 2rem 0.85rem 0.9rem;
    border-radius: 12px;
    background: #171923;
    border: 1px solid rgba(201, 74, 80, 0.35);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    color: #e8e8ee;
    font-size: 0.82rem;
    line-height: 1.35;
    cursor: pointer;
    animation: supportWidgetSlideIn 0.22s ease;
}

.support-widget-reply-toast strong {
    display: block;
    margin-bottom: 0.25rem;
    color: #fff;
}

.support-widget-reply-toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    margin-right: 0.35rem;
    border-radius: 50%;
    background: rgba(201, 74, 80, 0.25);
    color: #f4a5a9;
    font-size: 0.75rem;
    vertical-align: middle;
}

.support-widget-reply-toast-preview {
    display: block;
    margin-top: 0.35rem;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
    font-size: 0.78rem;
    line-height: 1.35;
    word-break: break-word;
}

.support-widget-reply-toast-hint {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.72rem;
    color: #9ca3af;
}

.support-widget-reply-toast-close {
    position: absolute;
    top: 0.35rem;
    right: 0.45rem;
    border: 0;
    background: transparent;
    color: #9ca3af;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.support-widget-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.85rem);
    width: min(360px, calc(100vw - 2rem));
    height: 520px;
    max-height: calc(100vh - 6rem);
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    overflow: hidden;
    background: #111318;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    animation: supportWidgetSlideIn 0.22s ease;
}

@keyframes supportWidgetSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.support-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 0.95rem;
    background: #0d0f14;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.support-widget-header-main {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.support-widget-header-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--jl-accent, #c94a50), var(--jl-accent-hover, #b03e44));
    flex: 0 0 auto;
    position: relative;
}

.support-widget-header-icon::after {
    content: '';
    position: absolute;
    inset: 9px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.95) 0 2px, transparent 2px),
        radial-gradient(circle at 62% 35%, rgba(255, 255, 255, 0.95) 0 2px, transparent 2px),
        radial-gradient(circle at 48% 58%, rgba(255, 255, 255, 0.95) 0 2px, transparent 2px);
}

.support-widget-header-title {
    color: #f3f4f6;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.support-widget-close {
    border: 0;
    background: transparent;
    color: #9ca3af;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.15rem 0.35rem;
}

.support-widget-close:hover {
    color: #fff;
}

.support-widget-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    background-color: #0f1117;
    background-image:
        radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        radial-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 18px 18px, 28px 28px;
    background-position: 0 0, 8px 10px;
}

.support-widget-empty {
    color: #9ca3af;
    font-size: 0.85rem;
    text-align: center;
    margin: auto;
}

.support-widget-msg {
    max-width: 82%;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.support-widget-msg-user {
    align-self: flex-end;
}

.support-widget-msg-staff {
    align-self: flex-start;
}

.support-widget-msg-body {
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
}

.support-widget-msg-user .support-widget-msg-body {
    background: #2b313d;
    color: #f3f4f6;
    border-bottom-right-radius: 4px;
}

.support-widget-msg-staff .support-widget-msg-body {
    background: #1a1f2b;
    color: #e5e7eb;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.support-widget-msg-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.68rem;
    color: #6b7280;
    padding: 0 0.2rem;
}

.support-widget-msg-user .support-widget-msg-meta {
    justify-content: flex-end;
}

.support-widget-msg-check {
    color: var(--jl-accent, #c94a50);
    letter-spacing: -0.08em;
}

.support-widget-alt {
    margin: 0;
    padding: 6px 14px 0;
    font-size: 0.72rem;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.55);
    text-align: center;
}

.support-widget-alt a {
    color: #ff6b6b;
    font-weight: 600;
    text-decoration: none;
}

.support-widget-alt a:hover {
    text-decoration: underline;
}

.support-widget-compose {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.75rem;
    background: #0d0f14;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.support-widget-input {
    flex: 1 1 auto;
    border: 0;
    background: #171a22;
    color: #f3f4f6;
    border-radius: 999px;
    padding: 0.72rem 1rem;
    font-size: 0.88rem;
    outline: none;
}

.support-widget-input::placeholder {
    color: #6b7280;
}

.support-widget-send {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--jl-accent, #c94a50);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
}

.support-widget-send:hover {
    background: rgba(201, 74, 80, 0.12);
}

.support-widget-nudge {
    position: fixed;
    right: 1.25rem;
    bottom: 8.25rem;
    z-index: 11999;
    max-width: min(320px, calc(100vw - 2.5rem));
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: #151821;
    border: 1px solid rgba(201, 74, 80, 0.35);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    color: #f3f4f6;
    font-size: 0.88rem;
    line-height: 1.45;
    cursor: pointer;
    animation: supportNudgeIn 0.35s ease;
}

.support-widget-nudge strong {
    display: block;
    margin-bottom: 0.15rem;
    color: #fff;
}

.support-widget-nudge-close {
    position: absolute;
    top: 0.35rem;
    right: 0.45rem;
    border: 0;
    background: transparent;
    color: #9ca3af;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.support-widget-nudge-close:hover {
    color: #fff;
}

@keyframes supportNudgeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .support-widget-root {
        right: 0.85rem;
        bottom: 3.75rem;
    }

    .support-widget-panel {
        width: calc(100vw - 1.7rem);
        height: min(72vh, 520px);
    }

    .support-widget-nudge {
        right: 0.85rem;
        bottom: 7.5rem;
    }
}

/* Admin support inbox */
.support-admin-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 1rem;
    min-height: 420px;
}

.support-admin-threads {
    border: 1px solid #2f2f42;
    border-radius: 8px;
    overflow: auto;
    max-height: 520px;
}

.support-admin-thread {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    border-bottom: 1px solid #2f2f42;
    background: transparent;
    color: inherit;
    padding: 0.75rem 0.85rem;
    cursor: pointer;
}

.support-admin-thread:hover,
.support-admin-thread.is-active {
    background: rgba(255, 255, 255, 0.04);
}

.support-admin-thread strong {
    display: block;
    font-size: 0.88rem;
}

.support-admin-thread small {
    color: #9ca3af;
    font-size: 0.75rem;
}

.support-admin-unread {
    display: inline-block;
    min-width: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    margin-left: 0.35rem;
}

.support-admin-chat {
    border: 1px solid #2f2f42;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    min-height: 420px;
}

.support-admin-chat-head {
    padding: 0.75rem 0.95rem;
    border-bottom: 1px solid #2f2f42;
    font-size: 0.88rem;
}

.support-admin-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    max-height: 360px;
    background: #0f1117;
}

.support-admin-compose {
    display: flex;
    gap: 0.55rem;
    padding: 0.75rem;
    border-top: 1px solid #2f2f42;
}

.support-admin-compose input {
    flex: 1 1 auto;
}

@media (max-width: 900px) {
    .support-admin-layout {
        grid-template-columns: 1fr;
    }
}
