
	/* ========= Чат-виджет Пансионат Добро ========= */

/* плавающая кнопка */
.pd-chat-btn {
    position: fixed;
    right: 24px;
    bottom: 10px;
    min-width: 64px;
    height: 64px;
    padding: 0 18px;
    border-radius: 999px;
    border: none;
    background: #C9F46C;
    color: #1D1D1F;
    box-shadow: 0 10px 24px rgba(0,0,0,.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 9999;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    font-weight: 600;
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.pd-chat-btn span {
    font-size: 22px;
    line-height: 1;
}
.pd-chat-btn::after {
    content: "Задать вопрос";
    white-space: nowrap;
}
.pd-chat-btn:hover {
    background: #B9E85D;
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(0,0,0,.18);
}
.pd-chat-btn:active {
    transform: translateY(0);
    box-shadow: 0 6px 18px rgba(0,0,0,.2);
}

/* окно чата */
.pd-chat-window {
    position: fixed;
    right: 24px;
    bottom: 10px;
    width: 360px;
    max-width: calc(100% - 32px);
    height: 460px;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 18px 45px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity .2s ease, transform .2s ease;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.pd-chat-window.pd-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* спрятать кнопку, когда окно открыто */
.pd-chat-window.pd-open + .pd-chat-btn {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

/* шапка чата */
.pd-chat-header {
    background: #C9F46C;
    color: #111827;
    padding: 10px 16px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #E5F5C2;
}
.pd-chat-header-left {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.pd-chat-header-title {
    font-size: 13px;
    font-weight: 600;
}
.pd-chat-header-status {
    font-size: 11px;
    color: #4B5563;
}
.pd-chat-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* оператор в шапке по умолчанию скрыт */
.pd-chat-header-operator {
    display: none;
}
/* показываем, когда есть класс .pd-has-operator */
.pd-chat-window.pd-has-operator .pd-chat-header-operator {
    display: flex;
    align-items: center;
    gap: 6px;
}
.pd-chat-header-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ffffff;
}
.pd-chat-header-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.1;
}
.pd-chat-header-right button {
    background: none;
    border: none;
    color: #111827;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    margin-left: 6px;
}

/* область сообщений */
.pd-chat-messages {
    padding: 10px 12px;
    flex: 1;
    overflow-y: auto;
    background: #F6F7FA;
    font-size: 14px;
}

/* базовый пузырь */
.pd-chat-msg {
    margin-bottom: 8px;
    max-width: 90%;
    padding: 8px 10px;
    border-radius: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

/* сообщение пользователя */
.pd-chat-msg-user {
    margin-left: auto;
    background: #4F46E5;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* сообщение бота */
.pd-chat-msg-bot {
    margin-right: 0;
    background: #ffffff;
    color: #111827;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 6px rgba(15,23,42,.06);
}

/* системные сообщения */
.pd-chat-msg-system {
    margin: 4px auto;
    background: none;
    color: #9CA3AF;
    padding: 0;
    font-size: 11px;
    text-align: center;
}
.pd-chat-msg-typing {
    font-size: 11px;
    color: #9CA3AF;
    font-style: italic;
}

/* ряд сообщения бота с аватаркой */
.pd-chat-row {
    display: flex;
    align-items: flex-end;
    margin-bottom: 8px;
}
.pd-chat-row-bot {
    justify-content: flex-start;
}
.pd-chat-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 6px;
    flex-shrink: 0;
}
.pd-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* футер чата */
.pd-chat-footer {
    border-top: 1px solid #E5E7EB;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
}

/* поле ввода — выше, меньше скругление, без полосы прокрутки */
.pd-chat-footer textarea {
    flex: 1;
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    resize: none;
    overflow-y: hidden; /* прячем стрелочки */
    padding: 10px 16px;
    border-radius: 24px;
    border: 1px solid #D1D5DB;
    font: inherit;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

/* чтобы совсем убрать скроллбар в WebKit */
.pd-chat-footer textarea::-webkit-scrollbar {
    display: none;
}

/* кнопка отправки по высоте как поле */
.pd-chat-footer button {
    height: 56px;
    padding: 0 18px;
    border-radius: 28px;
    border: none;
    background: #4F46E5;
    color: #fff;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}
.pd-chat-footer button:disabled {
    opacity: .6;
    cursor: default;
}

/* Мобильная адаптация */
@media (max-width: 600px) {
    .pd-chat-window {
        right: 8px;
        left: 8px;
        bottom: 10px;
        width: auto;
        height: calc(100vh - 180px);
        max-height: 600px;
    }
    .pd-chat-btn {
        right: 16px;
        bottom: 10px;
    }
}

/* Когда начался диалог — прячем левый текстовый блок */
.pd-chat-window.pd-has-operator .pd-chat-header-left {
    display: none;
}

/* Оператор занимает всю шапку */
.pd-chat-window.pd-has-operator .pd-chat-header-right {
    flex: 1;
}

/* Аватар + имя слева, крестик уезжает вправо */
.pd-chat-window.pd-has-operator .pd-chat-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pd-chat-window.pd-has-operator .pd-chat-header-right button {
    margin-left: auto;   /* крестик прижат к правому краю */
}
