:root {
    --support-chat-primary: #3c001a;
    --support-chat-primary-soft: #7d2141;
    --support-chat-accent: #d6a637;
    --support-chat-bg: #ffffff;
    --support-chat-surface: #fff7f9;
    --support-chat-text: #26141d;
    --support-chat-muted: #6f5d66;
    --support-chat-border: #eadce2;
    --support-chat-error: #b42318;
    --support-chat-shadow: 0 24px 55px rgba(60, 0, 26, 0.22), 0 8px 20px rgba(31, 19, 24, 0.12);
}

.support-chat {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1090;
    font-family: inherit;
}

.support-chat__toggle {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border: 2px solid var(--support-chat-accent);
    border-radius: 50%;
    background: var(--support-chat-primary);
    color: #f8d875;
    box-shadow: 0 12px 30px rgba(60, 0, 26, 0.35);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.support-chat__toggle:hover,
.support-chat__toggle:focus-visible {
    background: var(--support-chat-primary-soft);
    box-shadow: 0 16px 34px rgba(60, 0, 26, 0.42);
    transform: translateY(-2px);
    outline: none;
}

.support-chat__toggle svg {
    width: 27px;
    height: 27px;
}

.support-chat__toggle-close-icon {
    display: none;
}

.support-chat--open .support-chat__toggle-open-icon {
    display: none;
}

.support-chat--open .support-chat__toggle-close-icon {
    display: block;
}

.support-chat__window {
    position: absolute;
    right: 0;
    bottom: 74px;
    width: min(380px, calc(100vw - 32px));
    height: min(590px, calc(100vh - 120px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--support-chat-border);
    border-radius: 18px;
    background: var(--support-chat-bg);
    box-shadow: var(--support-chat-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(0.98);
    transform-origin: bottom right;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease;
}

.support-chat--open .support-chat__window {
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
}

.support-chat__header {
    min-height: 76px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 17px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--support-chat-primary), var(--support-chat-primary-soft));
}

.support-chat__avatar {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 2px solid rgba(248, 216, 117, 0.75);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #f8d875;
    font-size: 13px;
    font-weight: 700;
}

.support-chat__title {
    margin: 0;
    color: inherit;
    font-size: 16px;
    line-height: 1.2;
}

.support-chat__status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0 0;
    color: rgba(255, 255, 255, 0.84);
    font-size: 12px;
}

.support-chat__status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #49d17d;
}

.support-chat__close {
    width: 34px;
    height: 34px;
    margin-left: auto;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #ffffff;
    font-size: 27px;
    line-height: 1;
    cursor: pointer;
}

.support-chat__close:hover,
.support-chat__close:focus-visible {
    background: rgba(255, 255, 255, 0.14);
    outline: none;
}

.support-chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 15px;
    background: var(--support-chat-surface);
    scroll-behavior: smooth;
}

.support-chat__welcome {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 20px auto;
    padding: 15px;
    border: 1px solid var(--support-chat-border);
    border-radius: 10px;
    background: #ffffff;
    text-align: center;
    font-size: 13px;
}

.support-chat__welcome span {
    color: var(--support-chat-muted);
}

.support-chat__message {
    display: flex;
    margin-bottom: 12px;
}

.support-chat__message--user {
    justify-content: flex-end;
}

.support-chat__message--assistant {
    justify-content: flex-start;
}

.support-chat__bubble {
    max-width: 82%;
    padding: 11px 13px;
    border-radius: 13px;
    color: var(--support-chat-text);
    background: #ffffff;
    box-shadow: 0 2px 9px rgba(31, 19, 24, 0.06);
    font-size: 14px;
    line-height: 1.48;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.support-chat__message--user .support-chat__bubble {
    border-bottom-right-radius: 5px;
    color: #ffffff;
    background: var(--support-chat-primary);
}

.support-chat__message--assistant .support-chat__bubble {
    border-bottom-left-radius: 5px;
    border: 1px solid var(--support-chat-border);
}

.support-chat__typing {
    display: flex;
    gap: 4px;
    padding: 9px 20px;
    background: var(--support-chat-surface);
}

.support-chat__typing[hidden],
.support-chat__error[hidden] {
    display: none;
}

.support-chat__typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--support-chat-muted);
    animation: support-chat-typing 1.2s infinite ease-in-out;
}

.support-chat__typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.support-chat__typing span:nth-child(3) {
    animation-delay: 0.3s;
}

.support-chat__form {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    padding: 12px;
    border-top: 1px solid var(--support-chat-border);
    background: #ffffff;
}

.support-chat__input {
    min-height: 44px;
    max-height: 110px;
    flex: 1;
    resize: none;
    padding: 11px 13px;
    border: 1px solid var(--support-chat-border);
    border-radius: 10px;
    color: var(--support-chat-text);
    font: inherit;
    font-size: 14px;
    line-height: 1.35;
}

.support-chat__input:focus {
    border-color: var(--support-chat-accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(214, 166, 55, 0.18);
}

.support-chat__send {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    color: #f8d875;
    background: var(--support-chat-primary);
    cursor: pointer;
}

.support-chat__send:hover,
.support-chat__send:focus-visible {
    background: var(--support-chat-primary-soft);
    outline: none;
}

.support-chat__send svg {
    width: 22px;
    height: 22px;
}

.support-chat__send:disabled,
.support-chat__input:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.support-chat__error {
    padding: 8px 13px 11px;
    color: var(--support-chat-error);
    background: #ffffff;
    font-size: 12px;
    text-align: center;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@keyframes support-chat-typing {
    0%,
    60%,
    100% {
        opacity: 0.4;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

@media (max-width: 575px) {
    .support-chat {
        right: 14px;
        bottom: 14px;
    }

    .support-chat__window {
        position: fixed;
        top: 10px;
        right: 10px;
        bottom: 82px;
        left: 10px;
        width: auto;
        height: auto;
        border-radius: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .support-chat__window,
    .support-chat__toggle,
    .support-chat__messages {
        transition: none;
        scroll-behavior: auto;
    }

    .support-chat__typing span {
        animation: none;
    }
}
