/* ========== ИМПОРТ ШРИФТОВ ========== */
/* Подключение шрифта Roboto от Google для улучшения читаемости форм */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap');

/* Подключение локального шрифта Gotham Pro */
@font-face {
    font-family: "Gotham Pro Regular";
    src: url("https://ci74.ru/rep/styles/GothamProRegular.ttf") format('truetype');
}

/* ========== ОБЩИЕ СТИЛИ ========== */
*, *::after, *::before {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: #fff;
    font-family: 'Roboto', Arial, sans-serif;
}

/* ========== СТАРТОВЫЙ ЭКРАН ========== */
/* Контейнер для стартового экрана */
.start-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 20px;
    text-align: center;
}

/* Стили для кнопок выбора типа отзыва */
.feedback-btn {
    width: 100%;
    padding: 20px;
    margin: 15px 0;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    display: block;
}

/* Кнопка для отрицательного отзыва (оранжевая) */
.negative-btn {
    background: var(--color-orange);
    color: white;
    box-shadow: 0 4px 6px rgba(241, 112, 54, 0.2);
}

/* Кнопка для положительного отзыва (зеленая) */
.positive-btn {
    background: var(--color-green);
    color: white;
    box-shadow: 0 4px 6px rgba(11, 72, 21, 0.2);
}

/* Эффект при наведении на кнопки */
.feedback-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* ========== МОДАЛЬНЫЕ ОКНА ========== */
/* Кнопки выбора организаций в положительном отзыве */
.positive-org-btn {
    padding: 15px;
    background: var(--color-light);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 10px;
    width: 100%;
    text-align: left;
    font-family: 'Roboto', Arial, sans-serif;
    font-size: 15px;
}

.positive-org-btn:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

/* Стили модальных окон */
#positiveModal {
    background-color: white; /* Убедимся, что фон не прозрачный */
}

#positive-org-buttons {
    display: block; /* или flex, в зависимости от вашего макета */
}



/* Поднятие заголовка "Выберите организацию" в модальном окне хорошего отзыва */
#positive-org-buttons h4 {
    margin-top: 5px; /* Отрицательный отступ сверху для поднятия заголовка */
    margin-bottom: 10px; /* Уменьшенный отступ снизу */
    padding-top: 0; /* Убираем верхний padding */
}

/* Уменьшаем отступы в контейнере с организациями */
#positive-org-buttons {
    padding-top: 0; /* Убираем верхний отступ */
    margin-top: 0; /* Убираем верхний margin */
}

/* Если нужно поднять весь блок с организациями */
#positiveModal .modal-header + #positive-org-buttons {
    margin-top: -5px; /* Поднимаем весь блок с организациями */
}



/* Затемненный фон для модальных окон */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

/* Стили для модального окна */
.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    max-height: 85vh; /* ограничиваем максимальную высоту */
    background: white;
    border-radius: 15px;
    padding: 25px;
    padding-top: 15px; /* Уменьшенный внутренний отступ сверху для поднятия заголовка */
    padding-bottom: 20px; /* Можно немного уменьшить отступ снизу для компактности */
    z-index: 1001;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    overflow-y: auto; /* добавляем вертикальный скролл при необходимости */
}

/* Заголовок модального окна */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px; /* Уменьшенный отступ снизу (было 20px) */
    position: relative; 
    top: 0;
    background: white;
    z-index: 10;
    padding-top: 0px; /* Уменьшаем отступ сверху, чтобы поднять заголовок */
    margin-top: -5px; /* Добавляем отрицательный отступ сверху */
   }



/* Кнопка закрытия модального окна */
.close-btn {
    font-size: 56px;
    cursor: pointer;
    color: #666;
    position: absolute;
    top: -1px; /* При необходимости, корректируем позицию кнопки закрытия Поднимаем кнопку закрытия выше (было -10px) */
    right: 0;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #333;
}

/* ========== ЧАТ ДЛЯ ОТРИЦАТЕЛЬНОГО ОТЗЫВА ========== */
/* Контейнер для сообщений чата */
#chat-messages {
    height: 260px; /* Увеличена высота чата для лучшей видимости */
    overflow-y: auto;
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid var(--color-light_border);
    border-radius: 10px;
    background-color: #fafafa;
}

/* Общие стили для сообщений */
.message {
    margin: 10px 0;
    padding: 14px;
    border-radius: 12px;
    max-width: 85%;
    font-size: 15px;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Стили для сообщений бота */
.bot-message {
    background: #f1f1f1;
    border: 1px solid var(--color-light_border);
    border-top-left-radius: 4px;
}

/* Стили для сообщений пользователя */
.user-message {
    background: var(--color-highlight);
    margin-left: auto;
    border: 1px solid var(--color-highlight_border);
    border-top-right-radius: 4px;
    color: #333;
}

/* ========== КНОПКИ ВЫБОРА ОРГАНИЗАЦИЙ ========== */
/* Контейнер для кнопок выбора организаций */
.clinic-buttons, .org-buttons {
    display: grid;
    gap: 12px;
    margin: 15px 0;
    max-height: calc(85vh - 150px); /* Ограничиваем максимальную высоту */
    overflow-y: auto; /* Добавляем прокрутку */
}

/* Стили для скролбара */
.modal::-webkit-scrollbar,
.org-buttons::-webkit-scrollbar {
    width: 8px;
}

.modal::-webkit-scrollbar-track,
.org-buttons::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal::-webkit-scrollbar-thumb,
.org-buttons::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.modal::-webkit-scrollbar-thumb:hover,
.org-buttons::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Стили для кнопок организаций */
.clinic-btn, .org-btn {
    padding: 15px;
    background: var(--color-light);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Roboto', Arial, sans-serif;
    font-size: 15px;
}

/* Эффект при наведении на кнопки организаций */
.clinic-btn:hover, .org-btn:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

/* ========== ПОЛЕ ВВОДА И СОГЛАСИЕ ========== */
/* Контейнер для поля ввода и кнопки отправки */
.input-container {
    display: none;
    gap: 8px; /* Уменьшаем промежуток между элементами (было 15px) */
    flex-direction: column;
    margin-top: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    background-color: var(--color-light);
    padding: 18px;
}

/* Поле ввода для ответов пользователя */
#user-input {
    width: 100%;
    min-height: 20px;
    padding: 12px 15px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    transition: border-color 0.3s, box-shadow 0.3s, height 0.3s;
    resize: vertical;
    margin-bottom: 10px; /* Уменьшаем нижний отступ (было 15px) */
}

/* Специальные стили для полей ввода на шаге телефона */
#user-input.single-line-input {
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    overflow-y: hidden !important;
    resize: none !important;
}

#user-input:focus {
    outline: none;
    border-color: var(--color-orange);
    box-shadow: 0 0 0 2px rgba(241, 112, 54, 0.2);
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
}

#user-input::placeholder {
    color: #999;
    font-size: 16px;
}

/* Улучшенные стили для маски телефона */
#user-input[data-masked="true"] {
    font-size: 18px;
    letter-spacing: 0.5px;
    text-align: left;
    font-weight: 500;
    font-family: 'Roboto', monospace;
    caret-color: var(--color-orange); /* Делаем курсор более заметным */
    line-height: 1.2;           /* Уменьшаем межстрочный интервал */
    padding-top: 11px;          /* Смещаем текст немного вниз */
    padding-bottom: 9px;        /* Баланс для вертикального центрирования */
    vertical-align: middle;     /* Вертикальное выравнивание */
}

/* Корректировка блока согласия */
.consent-container {
    display: flex;
    align-items: flex-start; /* Выравнивание по верху вместо center */
    margin-top: 0;
    margin-bottom: 10px;
    padding: 8px 10px;
}

/* Стили для кастомного чекбокса */
.custom-checkbox {
    position: relative;
    display: inline-block;
    min-width: 24px;
    width: 24px; /* Фиксированная ширина */
    height: 24px;
    margin-top: 2px; /* Небольшой отступ сверху для выравнивания с текстом */
    flex-shrink: 0; /* Запрещаем сжиматься */
}

.custom-checkbox input {
    opacity: 0;
    width: 0;
    height: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 24px;
    width: 24px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 50%;
    transition: border-color 0.2s, background-color 0.2s;
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: #fff;
    border-color: var(--color-orange);
}

.custom-checkbox input:checked ~ .checkmark:after {
    content: "";
    position: absolute;
    display: block;
    left: 9px;
    top: 5px;
    width: 5px;
    height: 10px;
    border: solid var(--color-orange);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Удаляем разделитель, вместо этого используем margin */
.consent-spacer {
    display: none; /* Убираем разделяющий элемент */
}

/* Улучшаем стили для текста согласия */
.consent-text {
    flex: 1;
    padding-left: 12px; /* Увеличиваем левый отступ от чекбокса */
    font-size: 14px;
    line-height: 1.4;
    color: #555;
    text-align: left; /* Принудительное выравнивание текста по левому краю */
    word-break: normal; /* Нормальный перенос слов */
    hyphens: auto; /* Автоматические переносы при необходимости */
}

/* Обеспечиваем, чтобы текст был правильно расположен относительно чекбокса */
.consent-container .custom-checkbox + .consent-text {
    margin-left: 0; /* Убираем дополнительный отступ, если он был */
}




/* Исправление цвета ссылки с повышенной специфичностью селектора */
.consent-container .consent-text a,
.input-container .consent-container .consent-text a,
.modal .input-container .consent-container .consent-text a {
    color: #555; /* Тот же цвет, что и для текста */
    text-decoration: none;
}

.consent-container .consent-text a:hover,
.input-container .consent-container .consent-text a:hover,
.modal .input-container .consent-container .consent-text a:hover {
    text-decoration: underline;
    color: #555; /* Сохраняем тот же цвет при наведении */
}

/* Сброс переменных цвета для ссылок в блоке согласия */
.consent-text a {
    --color-link-blue: #555; /* Переопределяем переменную локально */
    color: inherit; /* Наследуем цвет от родителя */
}


/* Кнопка отправки сообщения (оранжевая) */
.send-btn {
    padding: 12px 25px;
    background: var(--color-orange);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Roboto', Arial, sans-serif;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.send-btn:hover {
    background-color: var(--color-orange-dark);
}

/* Стили для неактивной кнопки */
.send-btn[disabled] {
    background: #cccccc;
    cursor: not-allowed;
}

/* Анимированное уведомление о согласии */
.consent-alert {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 15px;
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 8px;
    color: #856404;
    animation: slideDown 0.3s ease-out;
}

.consent-alert-icon {
    font-size: 24px;
    margin-right: 10px;
}

/* Подсветка чекбокса при необходимости согласия */
.consent-highlight {
    animation: pulse 1.5s infinite;
}

/* Анимация для появления уведомления */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Анимация пульсации для привлечения внимания */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 152, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0); }
}

/* ========== МАСКА ДЛЯ ТЕЛЕФОНА ========== */
/* Улучшенная стилизация маски телефона */
#user-input[data-masked="true"] {
    font-size: 18px;
    letter-spacing: 0.5px;
    text-align: left;
    font-weight: 500;
    font-family: 'Roboto Mono', monospace;
}

/* ========== ССЫЛКИ НА ОТЗОВИКИ ========== */
/* Общие стили для блоков с ссылками на отзовики */
.review-links {
    text-align: center;
    padding-top: 0; /* Убираем верхний отступ */
    margin-top: -5px; /* Добавляем отрицательный отступ сверху */
}


.review-links p {
    margin-top: 0; /* Убираем верхний отступ у параграфа */
    margin-bottom: 15px; /* Устанавливаем отступ снизу */
    padding-top: 0; /* Убираем верхний padding */
}

/* Стили для ссылок на отзовики */
.review-link {
    display: block;
    width: 100%;
    padding: 15px;
    margin: 15px 0;
    border: 3px solid;
    border-radius: 10px;
    text-decoration: none;
    color: var(--color-text);
    font-weight: bold;
    font-size: 18px;
    transition: all 0.3s;
    box-sizing: border-box;
}

/* Уменьшаем отступы между ссылками для компактности */
.review-links .review-link {
    margin-top: 10px; /* Уменьшаем отступ сверху (если было больше) */
}

/* Если нужно поднять весь блок с ссылками относительно блока с кнопками организаций */
#positive-org-buttons + .review-links {
    margin-top: -5px; /* Поднимаем весь блок с ссылками */
}


/* Адаптивные стили для ссылок на больших экранах */
@media (min-width: 768px) {
    .review-link {
        max-width: 450px;
        margin: 15px auto;
    }
}

/* Эффект при наведении на ссылки */
.review-link:hover {
    transform: scale(0.98);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

/* Цвета для разных платформ */
.yandex-link { border-color: var(--color-yandex); }
.dgis-link { border-color: var(--color-dgis); }
.prodoctorov-link { border-color: var(--color-prodoctorov); }
.google-link { border-color: var(--color-google); }
.vk-link { border-color: var(--color-vk); }
.otzovik-link { border-color: var(--color-otzovik); }
.instagram-link { border-color: var(--color-instagram); }
.flamp-link { border-color: var(--color-flamp); }
.avito-link { border-color: var(--color-avito); }

/* ========== ЭКРАН БЛАГОДАРНОСТИ ========== */
/* Контейнер для сообщения благодарности */
.thank-you-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 30px;
    text-align: center;
    background-color: var(--color-light);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    animation: fadeIn 0.5s ease-in-out;
    display: none;
}

/* Внутренний контейнер сообщения благодарности */
.thank-you-box {
    padding: 20px;
}

/* Иконка для сообщения благодарности */
.thank-you-icon {
    font-size: 60px;
    color: var(--color-green);
    margin-bottom: 20px;
    background: #e8f5e9;
    width: 100px;
    height: 100px;
    line-height: 100px;
    border-radius: 50%;
    margin: 0 auto 20px;
}

/* Анимация появления благодарности */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== АДАПТИВНОСТЬ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ ========== */
@media (max-width: 480px) {
    /* Адаптация поля ввода для мобильных */
    .input-container {
        flex-direction: column;
        padding: 15px;
    }
    
    /* Кнопка отправки на всю ширину на мобильных */
    .send-btn {
        width: 100%;
        margin-top: 10px;
    }
    
    /* Специфические стили для текста согласия на мобильных устройствах */
    .consent-text {
        font-size: 12px;
        line-height: 1.2; /* Уменьшенное межстрочное расстояние (было 1.4) */
        padding-left: 10px; /* Немного уменьшаем отступ на мобильных */
    }
    
    /* Уменьшаем размер чекбокса на мобильных для экономии места */
    .custom-checkbox {
        width: 20px;
        height: 20px;
        min-width: 20px;
    }
    
    /* Настройка отступов для блока согласия */
    .consent-container {
        padding: 6px 8px; /* Уменьшаем внутренние отступы */
        margin-bottom: 8px; /* Уменьшаем нижний отступ */
    }
    
    /* Обновленные стили для модального окна на мобильных */
    .modal {
        padding: 15px 12px; /* Уменьшаем отступы по бокам и сверху/снизу */
        max-height: 80vh; /* Немного меньше высота на мобильных */
    }
    
    .modal-header {
        margin-bottom: 12px; /* Еще немного уменьшаем отступ на мобильных */
    }
    
    /* Фиксированная высота контейнера с кнопками организаций */
    .org-buttons {
        max-height: calc(60vh - 100px);
    }
    
    /* Уменьшаем размер шрифта маски телефона на мобильных */
    #user-input[data-masked="true"] {
        font-size: 16px;
    }
}

/* ========== ДОПОЛНИТЕЛЬНЫЕ ЭЛЕМЕНТЫ ========== */
/* Стили для логотипа */
.logo-container {
    margin-bottom: 25px;
}

.logo {
    max-width: 200px;
    height: auto;
}

/* Стили для приглушенной надписи с сервисом */
.service-credit {
    margin-top: 90px;
    opacity: 0.5;
    font-size: 12px;
}

.service-credit a {
    color: #999;
    text-decoration: none;
}

.service-credit a:hover {
    text-decoration: underline;
}

/* Специфические корректировки для iOS */
@supports (-webkit-touch-callout: none) {
    #user-input {
        font-size: 16px; /* Предотвращает масштабирование на iOS */
    }
    
    #user-input[data-masked="true"] {
        font-size: 16px;
    }
}

/* Мобильные оптимизации */
@media (max-width: 480px) {
    #user-input {
        -webkit-appearance: none;
        font-size: 16px;
    }
    
    #user-input:focus {
        font-size: 16px;
    }
}

/* Стили для оповещений */
.alert-message {
    position: fixed;
    left: 50%;
    top: 20px;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 20px;
    background-color: #ff4444;
    color: white;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 10000;
    transition: transform 0.3s;
    max-width: 80%;
    text-align: center;
}

.alert-visible {
    transform: translateX(-50%) translateY(0);
}

/* Стили для кнопки отправки в состоянии отправки */
.send-btn.sending {
    background-color: #cccccc;
    cursor: not-allowed;
}