/* ============ Чат / техподдержка (оверлей) ============ */
#sweat-chat-root {
    --sc-bg: #232323;
    --sc-bg2: #2d2d2d;
    --sc-border: #3a3a3a;
    --sc-text: #e8e8e8;
    --sc-muted: #9a9a9a;
    --sc-accent: #96bf32;
    --sc-accent-dark: #7a9e28;
    --sc-mine: #96bf32;
    --sc-them: #3d3d3d;
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 99999;
    font-family: var(--font-main, 'PT Sans', sans-serif);
}

#sweat-chat-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--sc-accent, #96bf32);
    color: #1a1a1a;
    border: none;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    transition: all 0.25s ease;
}
#sweat-chat-btn:hover { background: var(--sc-accent-dark, #7a9e28); transform: translateY(-1px); }

#sweat-chat-btn .sweat-chat-btn-label { line-height: 1; }

.sweat-chat-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: #c0392b;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

#sweat-chat-panel {
    display: none;
    flex-direction: column;
    position: absolute;
    right: 0;
    bottom: 54px;
    width: 360px;
    max-width: calc(100vw - 24px);
    height: 480px;
    max-height: calc(100vh - 90px);
    max-height: calc(100dvh - 90px);
    background: var(--sc-bg, #232323);
    border: 1px solid var(--sc-border, #3a3a3a);
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}
#sweat-chat-panel.sweat-chat-open { display: flex; }

.sweat-chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--sc-bg2, #2d2d2d);
    border-bottom: 1px solid var(--sc-border, #3a3a3a);
    flex-shrink: 0;
}
.sweat-chat-title { font-weight: 700; font-size: 15px; color: var(--sc-text, #e8e8e8); }
.sweat-chat-close {
    background: none;
    border: none;
    color: var(--sc-muted, #9a9a9a);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.sweat-chat-close:hover { color: #fff; }

.sweat-chat-body { display: flex; flex: 1; min-height: 0; }
.sweat-chat-view { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }

.sweat-chat-support-btn {
    margin: 10px 10px 4px;
    padding: 9px;
    background: var(--sc-accent, #96bf32);
    color: #1a1a1a;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
}
.sweat-chat-support-btn:hover { background: var(--sc-accent-dark, #7a9e28); }

.sweat-chat-search {
    margin: 8px 10px;
    padding: 8px 10px;
    background: var(--sc-bg2, #2d2d2d);
    color: var(--sc-text, #e8e8e8);
    border: 1px solid var(--sc-border, #3a3a3a);
    border-radius: 6px;
    font-size: 16px;
    outline: none;
    flex-shrink: 0;
}
.sweat-chat-search:focus { border-color: var(--sc-accent, #96bf32); }

.sweat-chat-results {
    margin: 0 10px 6px;
    background: var(--sc-bg2, #2d2d2d);
    border: 1px solid var(--sc-border, #3a3a3a);
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}
.sweat-chat-user {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    background: none;
    border: none;
    color: var(--sc-text, #e8e8e8);
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid var(--sc-border, #3a3a3a);
}
.sweat-chat-user:last-child { border-bottom: none; }
.sweat-chat-user:hover { background: var(--sc-accent-dark, #7a9e28); color: #1a1a1a; }

.sweat-chat-convs {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px 10px;
    min-height: 0;
}

.sweat-chat-conv {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    background: var(--sc-bg2, #2d2d2d);
    border: 1px solid var(--sc-border, #3a3a3a);
    border-radius: 8px;
    padding: 9px 10px;
    margin-bottom: 7px;
    cursor: pointer;
    color: var(--sc-text, #e8e8e8);
}
.sweat-chat-conv:hover { border-color: var(--sc-accent, #96bf32); }

.sweat-chat-conv-ava {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--sc-accent, #96bf32);
    color: #1a1a1a;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sweat-chat-conv-main { flex: 1; min-width: 0; }
.sweat-chat-conv-name {
    display: block;
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sweat-chat-conv-prev {
    display: block;
    color: var(--sc-muted, #9a9a9a);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sweat-chat-conv-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.sweat-chat-conv-time { color: var(--sc-muted, #9a9a9a); font-size: 11px; }
.sweat-chat-unread {
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--sc-accent, #96bf32);
    color: #1a1a1a;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sweat-chat-tag {
    font-size: 10px;
    font-weight: 400;
    background: var(--sc-accent-dark, #7a9e28);
    color: #1a1a1a;
    border-radius: 4px;
    padding: 1px 5px;
    vertical-align: 1px;
}

.sweat-chat-dlg-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--sc-bg2, #2d2d2d);
    border-bottom: 1px solid var(--sc-border, #3a3a3a);
    flex-shrink: 0;
}
.sweat-chat-back {
    background: none;
    border: none;
    color: var(--sc-accent, #96bf32);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.sweat-chat-peer { font-weight: 700; font-size: 14px; color: var(--sc-text, #e8e8e8); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sweat-chat-notice {
    margin: 8px 10px 0;
    padding: 7px 10px;
    background: rgba(245, 166, 35, 0.15);
    border: 1px solid rgba(245, 166, 35, 0.45);
    color: #f5a623;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    flex-shrink: 0;
}

.sweat-chat-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.sweat-chat-empty {
    color: var(--sc-muted, #9a9a9a);
    font-size: 13px;
    text-align: center;
    padding: 24px 12px;
}

.sweat-chat-msg { max-width: 78%; display: flex; flex-direction: column; gap: 2px; }
.sweat-chat-msg-mine { align-self: flex-end; align-items: flex-end; }
.sweat-chat-msg-them { align-self: flex-start; align-items: flex-start; }

.sweat-chat-msg-body {
    padding: 8px 11px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.4;
    word-break: break-word;
    white-space: pre-wrap;
}
.sweat-chat-msg-mine .sweat-chat-msg-body { background: var(--sc-mine, #96bf32); color: #1a1a1a; border-bottom-right-radius: 3px; }
.sweat-chat-msg-them .sweat-chat-msg-body { background: var(--sc-them, #3d3d3d); color: var(--sc-text, #e8e8e8); border-bottom-left-radius: 3px; }
.sweat-chat-msg-time { font-size: 10px; color: var(--sc-muted, #9a9a9a); padding: 0 4px; }

.sweat-chat-input-row {
    display: flex;
    gap: 7px;
    padding: 9px 10px;
    background: var(--sc-bg2, #2d2d2d);
    border-top: 1px solid var(--sc-border, #3a3a3a);
    flex-shrink: 0;
}
#sweat-chat-input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    background: var(--sc-bg, #232323);
    color: var(--sc-text, #e8e8e8);
    border: 1px solid var(--sc-border, #3a3a3a);
    border-radius: 6px;
    font-size: 16px;
    outline: none;
}
#sweat-chat-input:focus { border-color: var(--sc-accent, #96bf32); }
#sweat-chat-send {
    width: 36px;
    background: var(--sc-accent, #96bf32);
    color: #1a1a1a;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    flex-shrink: 0;
}
#sweat-chat-send:hover { background: var(--sc-accent-dark, #7a9e28); }

/* Вложения (фото/видео) */
.sweat-chat-attach-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sc-bg, #232323);
    color: var(--sc-muted, #9a9a9a);
    border: 1px solid var(--sc-border, #3a3a3a);
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
}
.sweat-chat-attach-btn:hover:not(:disabled) { color: var(--sc-accent, #96bf32); border-color: var(--sc-accent, #96bf32); }
.sweat-chat-attach-btn:disabled { opacity: 0.5; cursor: wait; }
.sweat-chat-attach-busy { animation: sweat-att-pulse 1s ease-in-out infinite; }
@keyframes sweat-att-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.sweat-chat-att-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 10px 6px;
    padding: 6px 9px;
    background: rgba(150, 191, 50, 0.12);
    border: 1px dashed var(--sc-accent, #96bf32);
    border-radius: 6px;
    font-size: 12px;
    color: var(--sc-text, #e8e8e8);
    flex-shrink: 0;
}
.sweat-chat-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sweat-chip-prog {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    flex: 1;
}
.sweat-chip-prog .sweat-chat-chip-name { color: var(--sc-accent, #96bf32); font-weight: 700; }
.sweat-chat-spin {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(150, 191, 50, 0.25);
    border-top-color: var(--sc-accent, #96bf32);
    animation: sweat-chat-spin-anim 0.8s linear infinite;
    flex-shrink: 0;
    display: inline-block;
}
@keyframes sweat-chat-spin-anim {
    to { transform: rotate(360deg); }
}
#sweat-chat-chip-rm {
    background: none;
    border: none;
    color: var(--sc-muted, #9a9a9a);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}
#sweat-chat-chip-rm:hover { color: #fff; }

.sweat-chat-msg-media { max-width: 100%; }
.sweat-chat-msg-img {
    display: block;
    max-width: min(220px, 100%);
    max-height: 220px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    object-fit: cover;
}
.sweat-chat-msg-video {
    display: block;
    max-width: min(250px, 100%);
    border-radius: 10px;
}

/* Полноэкранный просмотр фото */
#sweat-chat-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.9);
    cursor: zoom-out;
    animation: sweat-lb-fade 0.18s ease;
}
#sweat-chat-lightbox.sweat-lb-open { display: flex; }
#sweat-chat-lightbox img {
    max-width: 94vw;
    max-height: 94vh;
    border-radius: 8px;
    box-shadow: 0 10px 60px rgba(0, 0, 0, 0.6);
    animation: sweat-lb-zoom 0.2s ease;
}
@keyframes sweat-lb-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes sweat-lb-zoom {
    from { transform: scale(0.92); opacity: 0.5; }
    to { transform: scale(1); opacity: 1; }
}
#sweat-lb-close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 44px;
    height: 44px;
    font-size: 34px;
    line-height: 1;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
}
#sweat-lb-close:hover { color: var(--sc-accent, #96bf32); }

/* Уведомление о новых сообщениях (внутрисайтовое) */
#sweat-chat-toast {
    position: absolute;
    right: 0;
    bottom: 84px;
    width: 280px;
    max-width: calc(100vw - 24px);
    background: var(--sc-bg2, #2d2d2d);
    border: 1px solid var(--sc-accent, #96bf32);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: all 0.25s ease;
    z-index: 99998;
}
#sweat-chat-toast.sweat-chat-toast-show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.sweat-chat-toast-title {
    font-weight: 700;
    font-size: 13px;
    color: var(--sc-accent, #96bf32);
    margin-bottom: 3px;
}
.sweat-chat-toast-prev {
    font-size: 12px;
    color: var(--sc-text, #e8e8e8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 480px) {
    #sweat-chat-root { right: 10px; bottom: 10px; }
    #sweat-chat-panel {
        right: 0;
        bottom: 48px;
        width: calc(100vw - 20px);
        height: calc(100vh - 70px);
        height: calc(100dvh - 70px);
        max-height: none;
    }
    #sweat-chat-btn .sweat-chat-btn-label { display: none; }
}
