.chat-widget {
    position: fixed;
    right: 92px;
    bottom: 0;
    z-index: 9999;
    font-family: 'Roboto', sans-serif;
}

.chat-widget__toggle {
    background: #03FFA4;
    color: #303038;
    border: 1px solid #03FFA4;
    border-radius: 5px;
    width: 240px;
    height: 56px;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(3, 255, 164, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-widget__unread-text {
    display: none;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    color: #1f2937;
}

.chat-widget__toggle--unread {
    flex-direction: column;
    gap: 2px;
    animation: chat-widget-unread-pulse 1.2s ease-in-out infinite;
}

.chat-widget__toggle--unread .chat-widget__unread-text {
    display: inline-flex;
}

@keyframes chat-widget-unread-pulse {
    0%,
    100% {
        box-shadow: 0 4px 12px rgba(3, 255, 164, 0.25);
        opacity: 1;
    }
    50% {
        box-shadow: 0 4px 18px rgba(3, 255, 164, 0.55), 0 0 0 4px rgba(3, 255, 164, 0.2);
        opacity: 0.92;
    }
}


.chat-widget__invite {
    position: absolute;
    right: 0;
    bottom: 58px;
    width: 338px;
    z-index: 10001;
    background: #27272D;
    border: 1px solid #3a3a48;
    border-radius: 12px;
    padding: 12px;
    display: none;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.chat-widget__invite-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #a1a1aa;
    font-size: 18px;
    line-height: 24px;
    cursor: pointer;
}

.chat-widget__invite-close:hover {
    color: #fff;
}

.chat-widget__invite.is-visible {
    display: flex;
}

.chat-widget__invite-text {
    color: #e5e7eb;
    font-size: 13px;
    line-height: 18px;
}

.chat-widget__invite-btn {
    background: #03FFA4;
    color: #303038;
    border: none;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

.chat-widget__panel {
    width: 416px;
    height: 598px;
    background: #303038;
    border: 1px solid #3a3a48;
    border-radius: 12px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    margin-top: 12px;
    z-index: 10000;
}

.chat-widget__resize {
    display: none;
}

.chat-widget--open .chat-widget__panel {
    display: flex;
}

.chat-widget--open .chat-widget__toggle {
    display: none;
}

.chat-widget__header {
    padding: 12px 14px;
    background: #27272D;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
    font-weight: 600;
}

.chat-widget__header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-widget__sound-toggle {
    width: 32px;
    height: 32px;
    border: 1px solid #3a3a48;
    border-radius: 8px;
    background: transparent;
    color: #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.chat-widget__sound-toggle:hover {
    color: #fff;
    border-color: #4a4f5f;
}

.chat-widget__sound-icon {
    width: 18px;
    height: 18px;
}

.chat-widget__sound-off {
    opacity: 0;
}

.chat-widget__sound-toggle.is-muted .chat-widget__sound-off {
    opacity: 1;
}

.chat-widget__sound-toggle.is-muted .chat-widget__sound-wave {
    opacity: 0.2;
}

.chat-widget__status {
    font-size: 11px;
    color: #9aa0a6;
}

.chat-widget__close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

.chat-widget__body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    color: #fff;
}

.chat-widget__body--dragover {
    outline: 2px dashed rgba(3, 255, 164, 0.7);
    outline-offset: -4px;
    background: rgba(3, 255, 164, 0.06);
}

.chat-widget__messages {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-widget__message {
    max-width: 80%;
    background: #27272D;
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 18px;
    word-break: break-word;
}

.chat-widget__message--self {
    align-self: flex-end;
    background: #03FFA4;
    color: #303038;
}

.chat-widget__message a,
.chat-widget__message a:visited {
    color: #7dd3fc;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    overflow-wrap: anywhere;
}

.chat-widget__message a:hover {
    color: #bae6fd;
}

.chat-widget__message--self a,
.chat-widget__message--self a:visited {
    color: #0f172a;
}

.chat-widget__message--self a:hover {
    color: #1e293b;
}

.chat-widget__message-meta {
    display: block;
    font-size: 11px;
    color: #9aa0a6;
    margin-bottom: 4px;
}

.chat-widget__reply-block {
    border-left: 2px solid rgba(156, 163, 175, 0.7);
    padding-left: 8px;
    margin-bottom: 6px;
    font-size: 11px;
    line-height: 1.35;
    color: #d1d5db;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}

.chat-widget__message--self .chat-widget__reply-block {
    border-left-color: rgba(31, 41, 55, 0.55);
    color: #1f2937;
}

.chat-widget__reply-block-author {
    font-weight: 600;
    margin-bottom: 2px;
}

.chat-widget__reply-block-text {
    word-break: break-word;
}

.chat-widget__reply-block:hover {
    background: rgba(255, 255, 255, 0.07);
}

.chat-widget__reply-block:focus {
    outline: none;
}

.chat-widget__reply-block:focus-visible {
    box-shadow: 0 0 0 2px rgba(3, 255, 164, 0.5);
}

.chat-widget__message--reply-target {
    animation: chat-widget-reply-target-pulse 1.4s ease;
}

@keyframes chat-widget-reply-target-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(3, 255, 164, 0.65);
        transform: translateY(0);
    }
    35% {
        box-shadow: 0 0 0 8px rgba(3, 255, 164, 0.14);
        transform: translateY(-1px);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(3, 255, 164, 0);
        transform: translateY(0);
    }
}

.chat-widget__footer {
    padding: 10px;
    background: #27272D;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-widget__reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 9px;
    border-radius: 8px;
    border: 1px solid #3a3a48;
    border-left: 3px solid #03ffa4;
    background: #1f1f26;
}

.chat-widget__reply-preview-content {
    min-width: 0;
}

.chat-widget__reply-preview-label {
    font-size: 11px;
    color: #9aa0a6;
    margin-bottom: 2px;
}

.chat-widget__reply-preview-text {
    font-size: 12px;
    color: #e5e7eb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-widget__reply-preview-cancel {
    border: none;
    background: transparent;
    color: #9aa0a6;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

.chat-widget__reply-preview-cancel:hover {
    color: #fff;
}

.chat-widget__reply-menu {
    position: fixed;
    z-index: 11000;
    background: #27272D;
    border: 1px solid #3a3a48;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    padding: 4px;
}

.chat-widget__reply-menu-item {
    border: none;
    background: transparent;
    color: #e5e7eb;
    font-size: 12px;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
}

.chat-widget__reply-menu-item:hover {
    background: #303038;
}

.chat-widget__input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.chat-widget__icon-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: #d1d5db;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-widget__emoji-toggle {
    right: 56px;
}

.chat-widget__attach {
    right: 0;
}

.chat-widget__icon-btn:hover {
    color: #fff;
    background: transparent;
}

.chat-widget__emoji-panel {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
    background: #27272D;
    border-top: 1px solid #3a3a48;
}

.chat-widget__emoji-panel.is-open {
    display: flex;
}

.chat-widget__emoji {
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
}

.chat-widget__input {
    flex: 1 1 auto;
    min-width: 120px;
    border: 1px solid #3a3a48;
    background: #303038;
    color: #fff;
    border-radius: 8px;
    padding: 16px 120px 16px 16px;
    font-size: 16px;
    min-height: 56px;
}

.chat-widget__send {
    background: #03FFA4;
    color: #303038;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}

.chat-widget__icon {
    width: 22px;
    height: 22px;
    display: block;
    margin: 0;
}

.chat-widget__file-input {
    display: none;
}

.chat-widget__attachment {
    margin-top: 6px;
}

.chat-widget__attachment-image,
.chat-widget__attachment-video {
    max-width: 100%;
    border-radius: 8px;
    display: block;
}

.chat-widget__attachment-video {
    background: #000;
}

.chat-widget__name {
    padding: 12px;
    background: #27272D;
    border-top: 1px solid #3a3a48;
    display: none;
    gap: 8px;
}

.chat-widget--need-name .chat-widget__name {
    display: flex;
}

.chat-widget__name input {
    flex: 1;
    border: 1px solid #3a3a48;
    background: #303038;
    color: #fff;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
}

.chat-widget__name button {
    background: #03FFA4;
    color: #303038;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.chat-widget__system {
    text-align: center;
    font-size: 12px;
    color: #9aa0a6;
}

.chat-widget--page {
    position: relative;
    right: auto;
    bottom: auto;
    width: 100%;
}

.chat-widget--page .chat-widget__panel {
    width: 100%;
    height: calc(100vh - 220px);
    margin-top: 0;
}

.chat-page--full .chat-widget--page .chat-widget__panel {
    max-width: none;
}

@media (max-width: 576px) {
    .chat-widget {
        right: 10px;
        bottom: 10px;
    }

    .chat-widget__panel {
        width: calc(100vw - 20px);
        height: calc(100vh - 140px);
    }

    .chat-widget--page .chat-widget__panel {
        height: calc(100vh - 160px);
    }
}
