/* ========================================
   Модальное окно записи к врачу
   ======================================== */

.booking-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.booking-modal.active {
    display: flex;
}

.booking-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1;
}

.booking-modal .modal-container {
    position: relative;
    z-index: 2;
    background-color: white;
    border-radius: 5px;
    max-width: 896px;
    width: 90%;
    max-height: 90vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.booking-modal .modal-close {
    position: absolute;
    top: -40px;
    right: -40px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #383E4B;
    transition: all 0.3s ease;
    z-index: 3;
}

.booking-modal .modal-close:hover {
    background-color: #E01F26;
    color: white;
    transform: rotate(90deg);
}

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

/* Тело модального окна */
.booking-modal .modal-body {
    padding: 40px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

/* Datepicker даты рождения — поверх модалки */
.air-datepicker-global-container {
    z-index: 10000;
}

.air-datepicker-body--cells.-days- {
    grid-auto-rows: auto !important;
}
.air-datepicker-cell {
    border-radius: 0 !important;
}

/* Верхний блок: информация о враче + заголовок */
.booking-header-block {
    padding: 12px 20px;
    border: 1px solid #EDEDED;
    border-radius: 5px;
    margin-bottom: 33px;
}

.booking-header-wrapper {
    display: flex;
    gap: 30px;
    width: 85%;
    margin: auto;
}

.booking-doctor-info {
    display: flex;
    gap: 16px;
    flex: 0 0 auto;
}

.booking-doctor-photo {
    flex-shrink: 0;
    width: 106px;
    height: 138px;
    border-radius: 2px;
    overflow: hidden;
}

.booking-doctor-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.booking-doctor-details {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 4px;
}

.booking-doctor-name {
    font-size: 15px;
    font-weight: 400;
    color: #383E4B;
    line-height: 1.3;
    margin: 0 0 20px 0;
    max-width: 150px;
}

.booking-doctor-specialization {
    font-size: 15px;
    font-weight: 400;
    color: #383E4B;
    opacity: 0.7;
    line-height: 1.4;
    margin: 0;
}

.booking-header-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.booking-title {
    font-size: 26px;
    font-weight: 400;
    color: #383E4B;
    line-height: 1;
    margin-bottom: 18px;
}

.booking-contact-info {
    font-size: 16px;
    font-weight: 400;
    color: #383E4B;
    line-height: 1.3;
    margin: 0;
    max-width: 280px;
}

.booking-contact-info .phone-red {
    color: #E01F26;
    font-weight: 600;
}

/* Двухколоночный layout: календарь + sidebar */
.booking-calendar-row {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.booking-calendar-row .booking-calendar-wrapper {
    flex: 1;
    margin-bottom: 0;
}

.booking-sidebar {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.booking-sidebar.dms-active {
    justify-content: center;
    align-items: center;
}

.booking-sidebar.dms-active .booking-payment-type {
    flex-direction: row;
    margin-bottom: 0;
}

.booking-sidebar .form-field-time {
    position: relative;
}

/* Выбор способа оплаты */
.booking-payment-type {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.payment-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.payment-option input[type="radio"] {
    display: none;
}

.payment-option .radio-circle {
    width: 23px;
    height: 23px;
    border-radius: 50%;
    border: 2px solid #6E6E6E;
    position: relative;
    transition: all 0.3s ease;
}

.payment-option.active .radio-circle,
.payment-option input[type="radio"]:checked ~ .radio-circle {
    border-color: #E01F26;
}

.payment-option.active .radio-circle::after,
.payment-option input[type="radio"]:checked ~ .radio-circle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background-color: #E01F26;
}

.payment-option .radio-label {
    font-size: 16px;
    font-weight: 400;
    color: #6E6E6E;
    line-height: 1.4;
}

.payment-option.active .radio-label,
.payment-option input[type="radio"]:checked ~ .radio-label {
    color: #E01F26;
}

/* ========================================
   Календарь записи (Air Datepicker)
   ======================================== */

/* Обертка календаря */
.booking-calendar-wrapper {
    position: relative;
    margin-bottom: 30px;
    border: 1px solid #EDEDED;
    border-radius: 1px;
}

/* Контейнер календаря */
.booking-calendar {
    /* Air Datepicker создаст свою структуру внутри */
}

/* Скрытое поле для даты */
#booking-date {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* ========================================
   Кастомизация Air Datepicker под тему
   ======================================== */

/* Основной контейнер календаря */
#booking-calendar .air-datepicker {
    --adp-font-family: var(--font-family);
    --adp-font-size: 16px;
    --adp-width: 100%;
    --adp-padding: 20px;

    /* Цвета темы MedLabPlus */
    --adp-color: #383E4B;                    /* Текст */
    --adp-color-secondary: #999999;          /* Вторичный текст */
    --adp-accent-color: #E01F26;             /* Основной красный */
    --adp-background-color: #FFFFFF;         /* Фон */
    --adp-background-color-hover: #FFF5F5;   /* Ховер (светло-красный) */
    --adp-background-color-active: #E01F26;  /* Выбранная дата */
    --adp-background-color-in-range: #FFE5E5; /* Диапазон */
    --adp-border-color: #EDEDED;             /* Границы */
    --adp-border-radius: 5px;                /* Скругление */

    /* Отключенные дни */
    --adp-color-disabled: #CCCCCC;
    --adp-background-color-disabled: #F5F5F5;

    border: none !important;
    box-shadow: none !important;
}

/* Заголовок с месяцем/годом */
#booking-calendar .air-datepicker-nav {
    border-bottom: 1px solid #EDEDED;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

/* Название месяца и года */
#booking-calendar .air-datepicker-nav--title {
    color: #383E4B;
    font-size: 18px;
    font-weight: 500;
}

/* Кнопки навигации (стрелки) */
#booking-calendar .air-datepicker-nav--action {
    color: #E01F26;
    transition: opacity 0.3s ease;
}

#booking-calendar .air-datepicker-nav--action:hover {
    opacity: 0.7;
    background: transparent;
}

/* Названия дней недели */
#booking-calendar .air-datepicker-body--day-name {
    color: #999999;
    font-size: 14px;
    font-weight: 400;
    text-transform: uppercase;
}

/* Ячейки дат */
#booking-calendar .air-datepicker-cell {
    border-radius: var(--adp-border-radius);
    height: 40px;
    color: #383E4B;
}

/* Ховер по ячейке */
#booking-calendar .air-datepicker-cell:hover {
    background: #FFF5F5;
    color: #E01F26;
}

/* Выбранная дата */
#booking-calendar .air-datepicker-cell.-selected- {
    background: #E01F26;
    color: #FFFFFF;
    font-weight: 500;
}

/* Сегодня */
#booking-calendar .air-datepicker-cell.-current- {
    border: 2px solid #E01F26;
    color: #E01F26;
}

/* Сегодня + выбрано */
#booking-calendar .air-datepicker-cell.-current-.-selected- {
    background: #E01F26;
    color: #FFFFFF;
    border-color: #E01F26;
}

/* Отключенные дни (воскресенье, прошлое) */
#booking-calendar .air-datepicker-cell.-disabled- {
    background: #F5F5F5;
    color: #CCCCCC;
    cursor: not-allowed;
}

#booking-calendar .air-datepicker-cell.-disabled-:hover {
    background: #F5F5F5;
    color: #CCCCCC;
}

/* Дни из других месяцев */
#booking-calendar .air-datepicker-cell.-other-month- {
    color: #CCCCCC;
}

/* Адаптивность календаря для мобильных */
@media (max-width: 1000px) {
    #booking-calendar .air-datepicker {
        --adp-padding: 15px;
        --adp-font-size: 14px;
    }

    #booking-calendar .air-datepicker-cell {
        height: 35px;
    }
}

/* Форма бронирования: 3 поля в ряд */
.booking-form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

/* Форма для собственных средств (3 поля) */
.booking-form-own .form-field {
    position: relative;
    flex: 1;
}

/* Поля представителя (2 поля по 50%) */
.booking-form-representative .form-field {
    flex: 1;
}

/* Форма для ДМС (2 поля равной ширины) */
.booking-form-dms {
    justify-content: center;
}

.booking-form-dms .form-field {
    position: relative;
    flex: 0 0 236px;
}

.form-select,
.form-input {
    width: 100%;
    height: 52px;
    padding: 0 25px;
    border: 1px solid #666666;
    border-radius: 1000px;
    font-family: var(--font-family);
    font-size: 16px;
    color: #383E4B;
    outline: none;
    transition: border-color 0.3s ease;
    opacity: 0.8;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: white;
}

.form-select {
    padding-right: 45px;
}

.form-select:focus,
.form-input:focus {
    border-color: #E01F26;
    opacity: 1;
}

.form-select::placeholder,
.form-input::placeholder {
    color: #383E4B;
    opacity: 0.7;
}

.select-arrow {
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #E01F26;
}

/* Кнопка записи */
.btn-booking-submit {
    width: 100%;
    height: 55px;
    padding: 0;
    background-color: #E01F26;
    border: none;
    border-radius: 1000px;
    color: #FFFAFA;
    font-family: var(--font-family);
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.3s ease;
    margin-bottom: 10px;
}

.btn-booking-submit:hover {
    opacity: 0.9;
}

/* Wrapper для варианта ДМС */
.booking-dms-container {
    max-width: 493px;
    margin: 0 auto;
}

/* Чекбокс согласия */
.booking-consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    justify-content: center;
}

.booking-consent input[type="checkbox"] {
    display: none;
}

.booking-consent .consent-checkbox {
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    border: 1px solid #E01F26;
    border-radius: 2px;
    position: relative;
    margin-top: 2px;
}

.booking-consent input[type="checkbox"]:checked ~ .consent-checkbox {
    background-color: #E01F26;
}

.booking-consent input[type="checkbox"]:checked ~ .consent-checkbox::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.booking-consent .consent-text {
    font-size: 14px;
    font-weight: 400;
    color: #383E4B;
    line-height: 1.4;
    opacity: 0.89;
}

.booking-consent .consent-text a {
    color: #383E4B;
    text-decoration: underline;
}

.booking-consent .consent-text a:hover {
    text-decoration: none;
}

/* Адаптивные стили модального окна записи */
@media (max-width: 1000px) {
    .booking-modal .modal-container {
        max-width: 95%;
        width: 95%;
    }

    .booking-modal .modal-body {
        padding: 20px;
        padding-top: 40px;
    }
    .booking-sidebar.dms-active .booking-payment-type {
        flex-direction: column;
    }
    .booking-sidebar.dms-active {
        align-items: unset;
    }

    .booking-header-wrapper {
        flex-direction: column;
        gap: 20px;
    }

    .booking-doctor-info {
        justify-content: center;
    }

    .booking-contact-info {
        max-width: 100%;
    }

    .booking-modal .modal-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        background-color: rgba(255, 255, 255, 0.95);
    }

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

    .booking-modal .modal-close svg path {
        fill: #383E4B;
    }

    .booking-calendar-row {
        flex-direction: column;
    }

    .booking-form-row {
        flex-direction: column;
    }

    .form-field,
    .form-field:first-child,
    .form-field:nth-child(2),
    .form-field:nth-child(3) {
        flex: 1;
        width: 100%;
    }
}

/* ===========================
   Календарь записи (Booking Calendar)
   =========================== */

/* Загрузка календаря */
#booking-calendar.loading {
    position: relative;
    opacity: 0.5;
    pointer-events: none;
}

#booking-calendar.loading::after {
    content: 'Загрузка расписания...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 10px 20px;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 10;
}

/* Недоступные даты */
.air-datepicker-cell.-day-.unavailable-date {
    color: #ccc !important;
    cursor: not-allowed !important;
}

/* Текущая дата - синяя обводка */
#booking-calendar .air-datepicker-cell.-current- {
    border-color: #1976d2 !important;
}