/* ===== UnitLand Chat Widget ===== */
.uc-chat-fab {
    position: fixed;
    right: 16px;
    bottom: 146px;
    z-index: 9996;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #24247a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 0;
    box-shadow: 0 6px 20px rgba(36,36,122,.35);
    transition: transform .15s ease;
}
.uc-chat-fab:hover { transform: scale(1.05); }
.uc-chat-fab svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2; }
.uc-chat-fab__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff6b1f;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid #fff;
}
.uc-chat-fab__badge.is-visible { display: flex; }

/* Окно чата */
.uc-chat-win {
    position: fixed;
    right: 16px;
    bottom: 216px;
    width: 360px;
    height: 520px;
    max-height: calc(100vh - 240px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(15,20,25,.2);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.uc-chat-win.is-open { display: flex; }

.uc-chat-win__head {
    background: linear-gradient(135deg, #0f1419 0%, #2a3340 100%);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.uc-chat-win__head-info { flex: 1; min-width: 0; }
.uc-chat-win__title {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}
.uc-chat-win__status {
    font-size: 12px;
    opacity: .8;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.uc-chat-win__status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
    display: inline-block;
}
.uc-chat-win__status.is-online::before { background: #05ae51; box-shadow: 0 0 0 3px rgba(5,174,81,.3); }
.uc-chat-win__status.is-offline::before { background: #999; }
.uc-chat-win__close {
    background: none;
    border: 0;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: .7;
}
.uc-chat-win__close:hover { opacity: 1; }

.uc-chat-win__body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    background: #f7f8fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.uc-chat-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.uc-chat-msg--visitor {
    align-self: flex-end;
    background: #05ae51;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.uc-chat-msg--operator {
    align-self: flex-start;
    background: #fff;
    color: #0f1419;
    border: 1px solid #e6e8ec;
    border-bottom-left-radius: 4px;
}
.uc-chat-msg__time {
    font-size: 10px;
    opacity: .6;
    margin-top: 4px;
    display: block;
    text-align: right;
}

.uc-chat-win__form {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #e6e8ec;
    background: #fff;
    flex-shrink: 0;
}
.uc-chat-win__input {
    flex: 1;
    border: 1.5px solid #e6e8ec;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    resize: none;
    max-height: 100px;
    min-height: 40px;
    line-height: 1.4;
}
.uc-chat-win__input:focus { border-color: #05ae51; }
.uc-chat-win__send {
    width: 40px;
    height: 40px;
    background: #05ae51;
    color: #fff;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s ease;
}
.uc-chat-win__send:hover { background: #048f43; }
.uc-chat-win__send:disabled { background: #ccc; cursor: not-allowed; }
.uc-chat-win__send svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2; }

.uc-chat-win__offline {
    padding: 12px 14px;
    background: #fff8f0;
    border-top: 1px solid #ffd9b3;
    font-size: 13px;
    color: #c2410c;
    text-align: center;
    flex-shrink: 0;
    display: none;
}
.uc-chat-win__offline.is-visible { display: block; }

@media (max-width: 640px) {
    .uc-chat-fab { bottom: 156px; right: 12px; width: 50px; height: 50px; }
    .uc-chat-fab svg { width: 22px; height: 22px; }
    .uc-chat-win {
        right: 0;
        bottom: 0;
        left: 0;
        top: 0;
        width: auto;
        height: auto;
        max-height: none;
        border-radius: 0;
    }
    .uc-chat-win__head { padding: 16px; }
}

/* ===== Кнопка прикрепления файла ===== */
.uc-chat-win__attach {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5a6470;
    flex-shrink: 0;
    transition: background .15s ease, color .15s ease;
}
.uc-chat-win__attach:hover { background: #f0f1f3; color: #24247a; }
.uc-chat-win__attach svg { width: 20px; height: 20px; }

/* Превью картинки */
.uc-chat-msg__img { display: block; max-width: 100%; margin: -4px 0 4px; border-radius: 8px; overflow: hidden; }
.uc-chat-msg__img img {
    display: block;
    max-width: 100%;
    max-height: 260px;
    width: auto;
    height: auto;
    border-radius: 8px;
    cursor: pointer;
}

/* Файл-ссылка */
.uc-chat-msg__file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    color: inherit;
    text-decoration: none;
    border-radius: 8px;
    transition: background .15s ease;
}
.uc-chat-msg__file:hover { background: rgba(0,0,0,.06); }
.uc-chat-msg__file svg { width: 26px; height: 26px; flex-shrink: 0; opacity: .8; }
.uc-chat-msg__file-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.uc-chat-msg__file-name { font-size: 13px; font-weight: 600; line-height: 1.3; word-break: break-word; }
.uc-chat-msg__file-size { font-size: 11px; opacity: .7; }
.uc-chat-msg--operator .uc-chat-msg__file { color: #fff; }
.uc-chat-msg--operator .uc-chat-msg__file:hover { background: rgba(255,255,255,.15); }

/* Прогресс загрузки */
.uc-chat-win__upload { padding: 10px 14px; background: #f7f8fa; border-top: 1px solid #e6e8ec; flex-shrink: 0; }
.uc-chat-win__upload-name {
    display: block;
    font-size: 12px;
    color: #0f1419;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.uc-chat-win__upload-bar {
    width: 100%;
    height: 4px;
    background: #e6e8ec;
    border-radius: 2px;
    overflow: hidden;
}
.uc-chat-win__upload-fill {
    width: 0;
    height: 100%;
    background: #24247a;
    border-radius: 2px;
    transition: width .15s ease;
}

/* Индикатор "печатает" */
.uc-chat-win__typing {
    font-size: 12px;
    color: #05ae51;
    margin-top: 4px;
    font-style: italic;
}

/* Галочки прочтения */
.uc-chat-msg__read {
    margin-left: 4px;
    opacity: .7;
    font-size: 12px;
}
.uc-chat-msg__read.is-read {
    color: #b3f0c9;
    opacity: 1;
    font-weight: 700;
}
.uc-chat-msg--operator .uc-chat-msg__read.is-read {
    color: #05ae51;
}
