/* ========================
   Оверлей формы записи
   ======================== */
.form-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.form-overlay.active {
    display: flex;
}

/* Контейнер формы */
.form-container {
    width: 1000px;
    height: 700px;
    background-color: #FCFCFC;
    border-radius: 10px;
    position: relative;
    padding: 50px 40px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

/* Кнопка закрытия */
.form-container__close {
    position: absolute;
    top: 40px;
    right: 40px;
    background: none;
    border: none;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.form-container__close img {
    width: 100%;
    height: auto;
}

/* Заголовок */
.form-container__title {
    font-size: 30px;
    font-weight: 500;
    font-family: 'Montserrat', sans-serif;
    color: #000;
    margin-bottom: 40px;
    text-align: center;
}

/* Строка с двумя полями */
.form-row {
    display: flex;
    gap: 40px;
    width: 100%;
    margin-bottom: 30px;
}

.form-field {
    flex: 1;
    text-align: left;
}

.form-field__label {
    display: block;
    font-size: 20px;
    font-weight: 400;
    color: #717171;
    margin-bottom: 5px;
}

.form-field__input {
    width: 100%;
    height: 64px;
    background-color: #F0F0F0;
    border: 1px solid #9B9B9B;
    border-radius: 10px;
    padding: 20px 30px;
    font-size: 18px;
    font-family: 'Montserrat', sans-serif;
    color: #000;
    outline: none;
}

.form-field__input::placeholder {
    color: #9B9B9B;
}

/* Кастомный селект */
.custom-select {
    position: relative;
    width: 920px;                
    margin-bottom: 30px;
}

.custom-select__native {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.custom-select__trigger {
    width: 100%;
    height: 65px;
    background-color: #F0F0F0;
    border: 1px solid #9B9B9B;
    border-radius: 10px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 18px;
    font-family: 'Montserrat', sans-serif;
    color: #000;
}

.custom-select__selected.placeholder {
    color: #9B9B9B;
}

.custom-select__arrow {
    width: 14px;
    height: auto;
    transition: transform 0.3s;
}

.custom-select.open .custom-select__arrow {
    transform: rotate(180deg);
}

.custom-select__options {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #FCFCFC;
    border-radius: 10px;
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    max-height: 245px;
    overflow-y: auto;
}

.custom-select.open .custom-select__options {
    display: block;
}

.custom-select__options li {
    padding: 12px 30px;
    font-size: 18px;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
}

.custom-select__options li:hover {
    background-color: #F0F0F0;
}

/* Текстовая область */
.form-textarea {
    width: 920px;
    height: 140px;
    background-color: #F0F0F0;
    border: 1px solid #9B9B9B;
    border-radius: 10px;
    padding: 20px 30px;
    font-size: 18px;
    font-family: 'Montserrat', sans-serif;
    color: #000;
    outline: none;
    resize: none;
    margin-bottom: 30px;
}

.form-textarea::placeholder {
    color: #9B9B9B;
}

/* Чекбоксы */
.form-checkboxes {
    display: flex;
    gap: 78px;
    margin-bottom: 45px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.form-check__input {
    display: none;
}

.form-check__box {
    width: 30px;
    height: 30px;
    background-color: #FCFCFC;
    border: 1px solid #9B9B9B;
    border-radius: 4px;
    position: relative;
    flex-shrink: 0;
}

.form-check__input:checked + .form-check__box::after {
    content: '';
    position: absolute;
    left: 8px;
    top: 4px;
    width: 10px;
    height: 16px;
    border: solid #D90D26;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.form-check__text {
    font-size: 15px;
    font-weight: 400;
    color: #000;
}

/* Кнопка отправки */
.form-submit-btn {
    width: 223px;
    height: 60px;
    border-radius: 10px;
    background: linear-gradient(-41deg, #D90D26, #E94055, #D90D26);
    font-size: 22px;
    font-weight: 400;
    font-family: 'Montserrat', sans-serif;
    color: #FCFCFC;
    border: none;
    cursor: pointer;
    transition: opacity 0.3s, transform 0.2s;
}

.form-submit-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Оверлей успеха */
.success-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.2);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.success-overlay.active {
    display: flex;
}

.success-overlay__box {
    width: 600px;
    height: 345px;
    background-color: #FCFCFC;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 0;
}

.success-overlay__icon {
    width: 100px;
    height: 100px;
    margin-bottom: 30px;
}

.success-overlay__text {
    font-size: 25px;
    font-weight: 500;
    color: #000;
    text-align: center;
    line-height: 1.3;
}

/* Обёртка для полей с ошибкой */
.input-wrapper {
    position: relative;
    flex: 1;
}

/* Красная обводка при ошибке */
.form-field__input.error,
.custom-select__trigger.error {
    border-color: #D90D26 !important;
}

.field-error-text {
    position: absolute;
    right: 8px;
    bottom: 4px;
    color: #D90D26;
    font-size: 12px;
    padding: 0 4px;
    display: none;
    pointer-events: none;
    white-space: nowrap;
}

.input-wrapper .form-field__input.error ~ .field-error-text,
.input-wrapper .custom-select__trigger.error ~ .field-error-text {
    display: block;
}

/* Контейнер чекбоксов – теперь с позиционированием для ошибки */
.form-checkboxes {
    position: relative;
}

/* Ошибка чекбоксов – абсолютно внутри, у правого нижнего угла */
.checkbox-error-text {
    position: absolute;
    right: 0;
    bottom: -20px;           /* отступ 10px от нижнего края блока чекбоксов */
    color: #D90D26;
    font-size: 12px;
    white-space: nowrap;
    display: none;           /* скрыто по умолчанию */
    pointer-events: none;
}

.form-error {
    color: #D90D26;
    font-size: 14px;
    margin-bottom: 15px;
    text-align: left;
}

/* ========================
   Адаптиввность 
   ======================== */
@media (max-width: 768px) {
    .form-overlay.active {
        align-items: center;
        padding: 0;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .form-container {
        width: 328px;
        height: auto;
        min-height: 549px;
        margin: 20px auto;
        padding: 0 15px 30px 15px;
        border-radius: 10px;
        background-color: #FCFCFC;
        box-shadow: 0 8px 20px rgba(0,0,0,0.1);
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* Заголовок */
    .form-container__title {
        font-size: 18px;
        font-weight: 500;
        margin: 30px 0 15px 0;
        text-align: center;
    }

    /* Кнопка закрытия */
    .form-container__close {
        top: 15px;
        right: 15px;
        width: 20px;
        height: 20px;
    }

    .form-row {
        flex-direction: column;
        gap: 20px;
        width: 100%;
        margin-bottom: 20px;
    }

    /* Поля ввода и селект */
    .form-field {
        width: 298px;
        margin: 0 auto;
    }
    .form-field__label {
        font-size: 14px;
        font-weight: 400;
        color: #717171;
        margin-bottom: 5px;
        padding-left: 0;
    }
    .form-field__input {
        width: 298px;
        height: 37px;
        padding: 8px 15px;
        font-size: 14px;
    }

    /* Кастомный селект */
    .custom-select {
        width: 298px;
        margin: 0 auto 20px auto;
    }
    .custom-select__trigger {
        width: 298px;
        height: 50px;
        padding: 0 15px;
        font-size: 12px;
    }
    .custom-select__options li {
        padding: 8px 15px;
        font-size: 14px;
    }

    /* Текстовая область */
    .form-textarea {
        width: 298px;
        height: 90px;
        padding: 10px 15px;
        font-size: 14px;
        margin: 0 auto 15px auto;
    }

    /* Чекбоксы */
    .form-checkboxes {
        flex-direction: column;
        gap: 16px;
        width: 298px;
        margin: 0 auto 25px auto;
        position: relative;
    }
    .form-check {
        gap: 10px;
    }
    .form-check__box {
        width: 30px;
        height: 30px;
    }
    .form-check__input:checked + .form-check__box::after {
        left: 8px;
        top: 4px;
        width: 10px;
        height: 16px;
    }
    .form-check__text {
        font-size: 14px;
        font-weight: 500;
        line-height: 1.3;
    }

    /* Ошибка чекбоксов */
    .checkbox-error-text {
        position: absolute;
        left: 0;
        bottom: -22px;
        right: auto;
        font-size: 12px;
        white-space: nowrap;
    }

    /* Кнопка отправки */
    .form-submit-btn {
        width: 151px;
        height: 50px;
        font-size: 16px;
        font-weight: 500;
        margin: 0 auto;
    }

    .form-submit-btn:hover {
        opacity: 1;
    }

    /* Ошибка поля */
    .field-error-text {
        font-size: 10px;
        bottom: 5px;
        white-space: nowrap;
    }

    /* ===== ОВЕРЛЕЙ УСПЕХА (мобильная версия) ===== */
    .success-overlay {
        align-items: center;
        padding: 20px;
    }
    .success-overlay__box {
        width: auto;
        width: 300px;
        height: auto;
        padding: 30px 20px;
        border-radius: 10px;
        background: #FCFCFC;
        text-align: center;
    }
    .success-overlay__icon {
        width: 60px;
        height: 60px;
        margin-bottom: 20px;
    }
    .success-overlay__text {
        font-size: 18px;
        font-weight: 500;
        line-height: 1.4;
        white-space: nowrap;
    }
}