/* ========================================
   LOCKERBOX ЦЕХ — Онлайн-чат
   ======================================== */

.lbx-chat {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9000;
    font-family: var(--font-primary);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

/* Атрибут hidden должен побеждать display у блоков ниже */
.lbx-chat [hidden] { display: none !important; }

/* ---------- Кнопка запуска ---------- */
.lbx-chat__launcher {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: 14px;
    background: var(--color-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    box-shadow: 0 10px 30px rgba(33, 79, 238, 0.35);
    transition: var(--tr);
}
.lbx-chat__launcher:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
}
.lbx-chat__launcher-icon { width: 20px; height: 20px; flex-shrink: 0; }
.lbx-chat__launcher-icon svg { width: 100%; height: 100%; display: block; }
.lbx-chat.is-open .lbx-chat__launcher { display: none; }

/* ---------- Окно ---------- */
.lbx-chat__window {
    width: 370px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(8, 20, 60, 0.28);
    display: flex;
    flex-direction: column;
    max-height: min(620px, calc(100vh - 100px));
    animation: lbxPop .24s ease;
}

.lbx-chat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: radial-gradient(ellipse at center, #083688, #000E2C);
    color: #fff;
}
.lbx-chat__head-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.lbx-chat__head-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 3px;
}
.lbx-chat__close {
    width: 30px; height: 30px;
    color: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
    border-radius: 8px;
}
.lbx-chat__close svg { width: 18px; height: 18px; margin: 0 auto; display: block; }
.lbx-chat__close:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }


/* ---------- Бейдж непрочитанного ---------- */
.lbx-chat__launcher-dot {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px;
    background: #fff; color: var(--color-primary);
    font-size: 11px; font-weight: 700;
}

/* ---------- Шапка окна ---------- */
.lbx-chat__head-ava {
    width: 38px; height: 38px; flex-shrink: 0;
    border-radius: 10px;
    background: var(--color-primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 800;
}
.lbx-chat__head-main { flex: 1; min-width: 0; }
.lbx-chat__head-sub { display: flex; align-items: center; gap: 6px; }
.lbx-chat__dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #3ddc84; flex-shrink: 0;
}

/* ---------- Приветственное сообщение ---------- */
.lbx-msg--intro { animation: lbxPop .3s ease; }

/* ---------- Форма контактов ---------- */
.lbx-chat__intro {
    padding: 14px 16px 16px;
    border-top: 1px solid var(--color-gray-200);
}
.lbx-chat__intro-hint {
    font-size: 12px;
    color: var(--color-gray-500);
    margin-bottom: 10px;
}
.lbx-chat__row { display: flex; gap: 8px; }
.lbx-chat__row input {
    flex: 1; min-width: 0;
    padding: 11px 12px;
    border: 1.5px solid var(--color-gray-200);
    border-radius: 10px;
    font-size: 13.5px;
    color: var(--color-gray-900);
    background: #fff;
    transition: var(--tr-fast);
}
.lbx-chat__row input:focus { outline: none; border-color: var(--color-primary); }
.lbx-chat__submit { margin-top: 10px; }

/* ---------- Кнопки ---------- */

.lbx-chat__submit,
.lbx-chat__send {
    background: var(--color-primary);
    color: #fff;
    transition: var(--tr);
}
.lbx-chat__submit {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.lbx-chat__submit:hover { background: var(--color-primary-dark); }
.lbx-chat__submit[disabled] { opacity: .6; cursor: default; }

.lbx-chat__note {
    margin-top: 10px;
    font-size: 11px;
    line-height: 1.4;
    color: var(--color-gray-400);
}
.lbx-chat__note a { color: var(--color-primary); text-decoration: underline; }

.lbx-chat__error {
    margin-top: 10px;
    font-size: 12px;
    color: #d93025;
}

/* ---------- Переписка ---------- */
.lbx-chat__log {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 180px;
}

.lbx-msg {
    max-width: 84%;
    padding: 10px 13px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: pre-line;
}
.lbx-msg--user {
    align-self: flex-end;
    background: var(--color-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.lbx-msg--admin {
    align-self: flex-start;
    background: var(--color-gray-100);
    color: var(--color-gray-900);
    border-bottom-left-radius: 4px;
}
.lbx-msg__meta {
    display: block;
    margin-top: 5px;
    font-size: 10px;
    opacity: .65;
}

.lbx-chat__compose {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--color-gray-200);
}
.lbx-chat__compose textarea {
    flex: 1;
    resize: none;
    max-height: 110px;
    padding: 11px 13px;
    border: 1.5px solid var(--color-gray-200);
    border-radius: 10px;
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--color-gray-900);
    transition: var(--tr-fast);
}
.lbx-chat__compose textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}
.lbx-chat__send {
    width: 42px; height: 42px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.lbx-chat__send:hover { background: var(--color-primary-dark); }
.lbx-chat__send svg { width: 18px; height: 18px; }

/* ---------- Мобильные ---------- */
@media (max-width: 560px) {
    .lbx-chat { right: 14px; bottom: 14px; left: 14px; align-items: stretch; }
    .lbx-chat__launcher { align-self: flex-end; }
    .lbx-chat__teaser { max-width: none; }
    .lbx-chat__window { width: 100%; max-height: calc(100vh - 90px); }
}
