/* ========================================
   МОДАЛЬНОЕ ОКНО ЗАПИСИ НА КОНСУЛЬТАЦИИ
   ======================================== */

/* Плавающая кнопка записи */
.booking-float-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;

    display: inline-block;
    padding: 16px 28px;
    font-size: 16px;
    font-weight: 700;
    color: #555555;
    background-color: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    text-decoration: underline;
    text-decoration-color: #6c9c02;
    text-underline-offset: 3px;
    cursor: pointer;

    font-family: 'TildaSans', Arial, sans-serif;
    line-height: 1.2;
    text-align: center;

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;

    /* Отключаем пульсацию */
    animation: none;
}

.booking-float-btn:hover {
    background-color: #f5f5f5;
    border-color: #6c9c02;
    color: #333333;
    text-decoration-color: #6c9c02;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.booking-float-btn:active {
    transform: translateY(0);
}

/* Оверлей модального окна */
.booking-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;

    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.booking-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Модальное окно */
.booking-modal {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    margin: 0 auto;
    /* Центрирование модального окна */

    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);

    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
}

.booking-modal-overlay.active .booking-modal {
    transform: scale(1) translateY(0);
}

/* Заголовок модального окна */
.booking-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 2px solid #6c9c02;
    background: #f5f5f5;
    color: #333333;
}

.booking-modal-title {
    margin: 0;
    font-family: 'TildaSans', Arial, sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: #333333;
}

.booking-modal-close {
    background: none;
    border: none;
    color: #666666;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.booking-modal-close:hover {
    background: rgba(108, 156, 2, 0.1);
    color: #333333;
    transform: rotate(90deg);
}

.booking-modal-close svg {
    width: 24px;
    height: 24px;
}

/* Тело модального окна */
.booking-modal-body {
    padding: 12px 20px 20px 20px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
    /* Дополнительный отступ снизу для видимости кнопки */
    padding-bottom: 100px;
}

/* Убираем скролл на мобильных устройствах */
@media (max-width: 768px) {
    .booking-modal-body {
        overflow-y: visible;
        padding-bottom: 0;
    }
}

/* Кастомный скроллбар для модального окна */
.booking-modal-body::-webkit-scrollbar {
    width: 6px;
}

.booking-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.booking-modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
    transition: background 0.2s ease;
}

.booking-modal-body::-webkit-scrollbar-thumb:hover {
    background: #6c9c02;
}

/* Описание перед формой */
.booking-description {
    margin-bottom: 20px;
    text-align: center;
}

.booking-description p {
    margin: 0 0 12px 0;
    font-family: 'TildaSans', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #555;
}

.booking-description p:last-child {
    margin-bottom: 0;
}

.booking-privacy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px !important;
    color: #6c9c02 !important;
    background: rgba(108, 156, 2, 0.05);
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid rgba(108, 156, 2, 0.1);
}

.privacy-icon {
    flex-shrink: 0;
    color: #6c9c02;
}

/* Сообщения об успехе и ошибке */
.booking-success,
.booking-error {
    text-align: center;
    padding: 40px 20px;
}

.booking-success {
    color: #155724;
}

.booking-error {
    color: #721c24;
}

.success-icon,
.error-icon {
    margin: 0 auto 20px auto;
    width: 48px;
    height: 48px;
}

.success-icon {
    color: #28a745;
}

.error-icon {
    color: #dc3545;
}

.booking-success h3,
.booking-error h3 {
    margin: 0 0 16px 0;
    font-family: 'TildaSans', Arial, sans-serif;
    font-size: 20px;
    font-weight: 600;
}

.booking-success p,
.booking-error p {
    margin: 0 0 12px 0;
    font-family: 'TildaSans', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

.booking-success p:last-child,
.booking-error p:last-child {
    margin-bottom: 20px;
}

.booking-error a {
    color: #6c9c02;
    text-decoration: none;
    font-weight: 500;
}

.booking-error a:hover {
    text-decoration: underline;
}

/* Кнопки в сообщениях */
.success-actions,
.error-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-close-success,
.btn-try-again,
.btn-close-error {
    padding: 8px 16px;
    border-radius: 6px;
    font-family: 'TildaSans', Arial, sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1.5px solid transparent;
    min-height: 34px;
}

.btn-close-success {
    background: #28a745;
    color: white;
}

.btn-close-success:hover {
    background: #218838;
    transform: translateY(-1px);
}

.btn-try-again {
    background: #007cba;
    color: white;
}

.btn-try-again:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.btn-close-error {
    background: white;
    color: #666;
    border: 1.5px solid #e0e0e0;
}

.btn-close-error:hover {
    background: #f5f5f5;
    border-color: #c0c0c0;
    color: #333;
}

/* Анимации появления/исчезновения модального окна */
.booking-modal-overlay.closing {
    opacity: 0;
    visibility: visible;
}

.booking-modal-overlay.closing .booking-modal {
    transform: scale(0.9) translateY(20px);
}

/* Состояния для отправки формы */
.booking-modal.submitting .booking-form {
    opacity: 0.6;
    pointer-events: none;
}

.booking-modal.success .booking-form,
.booking-modal.error .booking-form {
    display: none;
}

.booking-modal.success .booking-success {
    display: block;
}

.booking-modal.error .booking-error {
    display: block;
}

/* Фокус для доступности */
.booking-modal-overlay:focus-within .booking-modal {
    outline: 2px solid #6c9c02;
    outline-offset: 2px;
}

/* Отключение прокрутки body при открытом модальном окне */
/* Основные стили применяются через JavaScript для корректной работы */
body.booking-modal-open {
    /* position, top, left, right, paddingRight устанавливаются через JS */
    overflow: hidden !important;
}

/* На десктопе скрываем кнопку при открытом модальном окне */
@media (min-width: 481px) {
    body.booking-modal-open .booking-float-btn {
        display: none;
    }
}

/* Медиазапросы для адаптивности */
@media (max-width: 768px) {
    .booking-float-btn {
        bottom: 20px;
        right: 20px;
        padding: 14px 20px;
        font-size: 14px;
    }

    .booking-modal-overlay {
        padding: 10px;
        align-items: flex-start;
        padding-top: 20px;
    }

    .booking-modal {
        border-radius: 12px;
        max-height: calc(100vh - 40px);
    }

    .booking-modal-header {
        padding: 12px 16px;
    }

    .booking-modal-title {
        font-size: 16px;
    }

    .booking-modal-body {
        padding: 8px 12px;
        max-height: calc(100vh - 60px);
    }

    .booking-description {
        margin-bottom: 8px;
    }

    .booking-description p {
        font-size: 13px;
        margin: 0 0 6px 0;
    }

    .booking-privacy {
        font-size: 13px !important;
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    .booking-float-btn {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        border-radius: 0;
        text-align: center;
        transform: none !important;
        /* Убираем все трансформации */
        -webkit-transform: none !important;
    }

    .booking-modal-overlay {
        padding: 0;
        align-items: stretch;
        overflow-x: hidden;
        /* Предотвращаем горизонтальный скролл */
    }

    .booking-modal {
        height: auto;
        max-height: 100vh;
        border-radius: 0;
        width: 100%;
        transform: none !important;
        /* Убираем transform на мобильных */
    }

    .booking-modal-body {
        max-height: calc(100vh - 40px);
        padding: 6px 10px;
    }
}

/* Высокая контрастность для accessibility */
@media (prefers-contrast: high) {
    .booking-modal-header {
        background: #e0e0e0;
        border-bottom-color: #333333;
    }

    .booking-float-btn {
        background: #ffffff;
        border: 2px solid #333333;
    }

    .booking-privacy {
        border-color: #6c9c02;
        background: rgba(108, 156, 2, 0.1);
    }
}

/* Уменьшенная анимация для пользователей с чувствительностью к движению */
@media (prefers-reduced-motion: reduce) {
    .booking-float-btn {
        animation: none;
    }

    .booking-modal-overlay,
    .booking-modal,
    .booking-modal-close {
        transition: none;
    }

    .booking-float-btn:hover {
        transform: none;
    }
}