/* ============================================================
   Consultant widget (свой) — profpotolok.by / new-level.by
   Версия: 1.0.0 (2026-10-18)
   Зелёный бар с аватаром внизу справа + панель чата.
   Заявки уходят в Telegram (см. functions.php, action pc_consultant_send).
   ============================================================ */

.pcc-root {
    position: fixed;
    right: 16px;
    bottom: 0;
    z-index: 10020;
    font-family: -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* --- бар (виден по умолчанию) --- */
.pcc-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 300px;
    max-width: calc(100vw - 32px);
    padding: 12px 40px 12px 12px;
    background: #31b939;
    color: #fff;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, .18);
    cursor: pointer;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.pcc-bar__avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 46px;
    background: #e8f7e9;
    border: 2px solid rgba(255, 255, 255, .9);
}

.pcc-bar__text {
    min-width: 0;
}

.pcc-bar__title {
    display: block;
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.25;
}

.pcc-bar__sub {
    display: block;
    font-size: 12.5px;
    line-height: 1.3;
    opacity: .95;
    margin-top: 2px;
}

.pcc-close {
    position: absolute;
    top: -34px;
    right: 0;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: #2b2b2b;
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

/* --- лаунчер после закрытия --- */
.pcc-launcher {
    display: none;
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    background: #31b939;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .28);
    align-items: center;
    justify-content: center;
}

.pcc-root.is-collapsed .pcc-bar { display: none; }
.pcc-root.is-collapsed .pcc-launcher { display: flex; }
.pcc-root.is-open .pcc-bar { display: none; }

/* --- панель чата --- */
.pcc-panel {
    display: none;
    flex-direction: column;
    width: 340px;
    max-width: calc(100vw - 24px);
    height: 420px;
    max-height: calc(100vh - 90px);
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 34px rgba(0, 0, 0, .22);
    margin-bottom: 0;
}

.pcc-root.is-open .pcc-panel { display: flex; }

.pcc-panel__head {
    background: #31b939;
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pcc-panel__head img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, .9);
}

.pcc-panel__head-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.pcc-panel__head-sub {
    font-size: 12px;
    opacity: .92;
}

.pcc-panel__min {
    margin-left: auto;
    align-self: flex-start;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
}

.pcc-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    background: #f3f6f4;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pcc-msg {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.pcc-msg--me {
    flex-direction: row-reverse;
}

.pcc-msg__avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 26px;
    background: #e8f7e9;
}

.pcc-msg__bubble {
    background: #fff;
    border-radius: 12px;
    padding: 8px 11px;
    font-size: 13.5px;
    line-height: 1.35;
    color: #222;
    max-width: 78%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
    word-wrap: break-word;
}

.pcc-msg--me .pcc-msg__bubble {
    background: #31b939;
    color: #fff;
}

.pcc-msg__time {
    display: block;
    font-size: 10.5px;
    color: #9aa0a6;
    margin-top: 3px;
}

.pcc-msg--me .pcc-msg__time { color: rgba(255, 255, 255, .8); }

.pcc-typing .pcc-msg__bubble { color: #7d8a7f; font-style: italic; }

/* --- форма ввода --- */
.pcc-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    background: #fff;
    border-top: 1px solid #e6eae7;
}

.pcc-form input[type="text"] {
    flex: 1 1 auto;
    border: 1px solid #d9dedb;
    border-radius: 18px;
    padding: 9px 14px;
    font-size: 13.5px;
    outline: none;
    min-width: 0;
}

.pcc-form input[type="text"]:focus { border-color: #31b939; }

.pcc-send {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: #31b939;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pcc-send[disabled] { opacity: .55; cursor: default; }

.pcc-error {
    display: none;
    padding: 6px 12px;
    background: #fdecea;
    color: #b3261e;
    font-size: 12px;
}

.pcc-error.is-visible { display: block; }

.pcc-hp { /* honeypot: скрыт от людей, виден для ботов */
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* --- мобильная раскладка: бар во всю ширину (как у venyoo) --- */
@media (max-width: 480px) {
    .pcc-root { right: 0; left: 0; align-items: stretch; }
    .pcc-bar {
        width: auto;
        margin: 0 8px;
        border-radius: 12px 12px 0 0;
    }
    .pcc-panel {
        width: auto;
        margin: 0 8px;
        height: 380px;
    }
    .pcc-launcher { margin: 0 12px 10px auto; }
}

@media (prefers-reduced-motion: no-preference) {
    .pcc-panel, .pcc-bar { transition: opacity .18s ease; }
}
