/* === 1. Глобальные настройки === */
:root {
    --primary-color: #0d6efd;
    --yellow-accent: #ffc107; /* Акцентный желтый */
    --gray-bg: #f5f7fa;      /* Мягкий фон */
    --promo-bg: #6a7ee8;      /* Фон промо-блока */
    --border-color: #ced4da;
    --text-dark: #212529;
    --text-muted: #6c757d;
}
body, html {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === 2. Фон и основной контейнер === */
.login-page-background {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--gray-bg) 0%, #e9ecef 100%);
    padding: 20px;
    box-sizing: border-box;
}

.login-container {
    display: grid;
    grid-template-columns: 1fr;
    max-width: 900px;
    width: 100%;
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}
@media (min-width: 768px) {
    .login-container {
        grid-template-columns: minmax(320px, 1fr) 1fr;
    }
}

/* === 3. Левая колонка: Форма === */
.login-form-section {
    padding: 30px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.login-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-top: 0;
    margin-bottom: 30px;
}
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; font-size: 0.9rem; font-weight: 500; margin-bottom: 8px; color: var(--text-muted); }
.form-control { width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 1rem; box-sizing: border-box; }
.form-control:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(13,110,253,0.2); outline: none; }

.phone-input-wrapper { position: relative; }
.phone-input-wrapper span { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-dark); font-weight: 500; }
.phone-input-wrapper input { padding-left: 45px !important; }

.btn { padding: 12px 20px; border-radius: 8px; cursor: pointer; font-weight: 600; width: 100%; transition: all 0.2s; }
.btn-warning { background-color: var(--yellow-accent); border: 1px solid var(--yellow-accent); color: var(--text-dark); }
.btn-warning:hover { filter: brightness(0.95); }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-dark); margin-top: 15px; }
.btn-outline:hover { background-color: var(--gray-bg); }
.login-error { color: #dc3545; font-size: 0.9rem; text-align: center; }


/* === 4. Правая колонка: Промо === */
.login-promo-section {
    background-color: var(--promo-bg);
    color: white;
    padding: 40px;
    position: relative;
    overflow: hidden;
    display: none;
}
@media (min-width: 768px) {
    .login-promo-section { display: block; }
}
.promo-bg-image { position: absolute; right: -80px; bottom: -50px; max-width: 100%; opacity: 0.2; z-index: 1; }
.promo-content { position: relative; z-index: 2; }
.promo-content h2 { font-size: 2.2rem; font-weight: 600; line-height: 1.3; margin-top: 0; }
.promo-content p { opacity: 0.8; }
.qr-code-block { display: flex; align-items: center; gap: 20px; margin-top: 30px; }
.qr-code-block img { width: 100px; height: 100px; background-color: white; padding: 5px; border-radius: 8px; }
.qr-code-block p { font-size: 0.9rem; }
/* ========================================= */
/*       5. СТИЛИ ДЛЯ ГОСТЕВОГО ЧАТА (Светлая тема) */
/* ========================================= */
.chat-widget {
    position: fixed; bottom: 25px; right: 25px;
    width: 350px; height: 480px; z-index: 1000;
    background-color: #ffffff;
    border: 1px solid #dee2e6; border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    overflow: hidden;
    /* --- ГЛАВНЫЕ ИЗМЕНЕНИЯ ЗДЕСЬ --- */
    display: flex; /* <-- Уже было, но убедитесь, что есть */
    flex-direction: column; /* <-- И это тоже */
}
.chat-widget.minimized { height: 57px; }

.chat-header {
    padding: 15px 20px;
    background-color: var(--promo-bg); /* Синий фон, как у промо-блока */
    color: white; font-weight: 600;
    cursor: pointer; display: flex;
    justify-content: space-between; align-items: center;
    flex-shrink: 0;
}
.chat-close { font-size: 1.8rem; font-weight: 400; opacity: 0.8; }

/* Форма сбора данных */
.chat-pre-form {
    padding: 25px;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    /* Убедимся, что занимает всю доступную высоту */
    flex-grow: 1; 
}
.chat-pre-form h4 {
    margin-top: 0; text-align: center; color: var(--text-dark);
}
.chat-pre-form p {
    text-align: center; font-size: 0.9rem;
    color: var(--text-muted); margin-bottom: 20px;
}
.chat-pre-form .form-group { margin-bottom: 15px; }
.chat-pre-form .form-control {
    background-color: #f8f9fa; color: #212529;
    border: 1px solid #ced4da;
    border-radius: 8px; /* Как на основной странице */
    padding: 12px;
}
.chat-pre-form .btn-primary { /* Адаптируем кнопку под общий стиль */
    background-color: var(--primary-color);
    border: none;
    color: white;
    font-weight: 500;
    padding: 12px;
    border-radius: 8px;
}

/* Окно переписки */
.chat-main-window {
    display: none; /* Изначально скрыто */
    flex-direction: column;
    flex-grow: 1; /* <-- Занимает все доступное место */
    height: 100%; /* <-- Растягивается на всю высоту виджета */
    overflow: hidden; /* Предотвращает "выпадение" футера */
}
.chat-body {
    flex-grow: 1; /* <-- Растягивается, занимая все место, кроме футера */
    padding: 15px;
    overflow-y: auto; /* Позволяет прокручивать сообщения */
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
}
.message-bubble {
    padding: 10px 15px; border-radius: 18px; margin-bottom: 10px;
    max-width: 80%; line-height: 1.5; word-wrap: break-word;
}
.message-bubble.client { /* Сообщения гостя */
    background-color: var(--primary-color);
    color: white; align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.message-bubble.admin { /* Сообщения админа */
    background-color: #e9ecef;
    color: var(--text-dark);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* Футер чата */
.chat-footer {
    display: flex;
    align-items: center; /* Выравниваем инпут и кнопку по центру */
    padding: 10px;
    border-top: 1px solid #e0e0e0;
    background-color: #ffffff;
    flex-shrink: 0; /* <-- Запрещает этому блоку сжиматься и "уезжать" вниз */
}
#chat-input {
    flex-grow: 1;
    background-color: #f1f3f5;
    border: 1px solid transparent;
    border-radius: 20px; padding: 8px 15px;
    color: #212529; outline: none;
}
#send-chat-btn {
    background: var(--primary-color);
    color: white; border: none; border-radius: 50%;
    width: 40px; height: 40px; font-size: 1.5rem;
    cursor: pointer; transition: background-color 0.2s;
    flex-shrink: 0; margin-left: 8px;
    line-height: 40px; text-align: center;
}
.chat-placeholder {
    text-align: center;
    color: var(--text-muted);
    margin: auto;
}