/* ==========================================================================
   Модальное окно заявки (Lead Modal)
   ========================================================================== */

.modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

/* Темный фон */
.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(9, 23, 27, 0.85);
    backdrop-filter: blur(5px);
    cursor: pointer;
}

/* Контентная часть */
.modal__content {
    position: relative;
    background: var(--soft);
    width: 100%;
    max-width: 600px;
    border-radius: 4px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    z-index: 2;
    max-height: 90vh;
    overflow-y: auto;
    border-top: 4px solid var(--lime);
}

/* Кнопка закрытия */
.modal__close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: 0;
    cursor: pointer;
    color: var(--muted);
    transition: color 0.2s;
    z-index: 3;
}

.modal__close:hover {
    color: var(--ink);
}

/* Форма внутри */
.modal-form {
    padding: 40px;
}

.modal-form__head {
    margin-bottom: 25px;
}

.modal-form__head h3 {
    font-size: 32px;
    text-transform: uppercase;
    margin: 0 0 10px;
    color: var(--ink);
    font-family: Oswald, sans-serif;
}

.modal-form__head p {
    font-size: 13px;
    color: var(--muted);
    margin: 0;
}

/* Поля ввода */
.modal-form__body label {
    display: block;
    margin-bottom: 15px;
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
}

.modal-form__body input[type="text"],
.modal-form__body input[type="tel"],
.modal-form__body textarea {
    width: 100%;
    margin-top: 6px;
    padding: 12px;
    border: 1px solid var(--line);
    background: #fff;
    font-family: Manrope, sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.modal-form__body input:focus,
.modal-form__body textarea:focus {
    border-color: #8da000;
    box-shadow: 0 0 0 3px rgba(214, 242, 61, 0.3);
}

/* Кастомный инпут файла */
.file-upload {
    display: block;
    padding: 15px;
    border: 2px dashed var(--line);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
    margin-bottom: 10px;
    background: #fff;
}

.file-upload:hover {
    border-color: #8da000;
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload__text {
    font-weight: 700;
    color: var(--ink);
    display: block;
    margin-bottom: 4px;
}

.file-upload__hint {
    font-size: 11px;
    color: var(--muted);
}

/* Список загруженных файлов */
.file-list {
    font-size: 12px;
    margin-bottom: 20px;
    color: var(--muted);
}

/* Статус отправки */
.modal-form__status {
    padding: 10px;
    margin-bottom: 15px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    border-radius: 4px;
    display: none;
}

.modal-form__status.success {
    display: block;
    background: #e5ff52;
    color: var(--ink);
}

.modal-form__status.error {
    display: block;
    background: #ffe5e5;
    color: #d63031;
}

.modal-form small {
    display: block;
    font-size: 10px;
    color: var(--muted);
    text-align: center;
    margin-top: 10px;
}
@media (max-width: 600px) {
    .modal {
        padding: 10px; /* Небольшой отступ от краев экрана */
        align-items: center; /* Центрируем по вертикали */
    }

    .modal__content {
        width: 100%;
        max-width: 100%;
        max-height: calc(100dvh - 20px); /* 100dvh учитывает панели браузера */
        border-radius: 8px; /* Скругление со всех сторон */
        border-top: none;
        border-bottom: none;
        display: flex;
        flex-direction: column;
    }

    .modal-form {
        display: flex;
        flex-direction: column;
        padding: 20px 15px;
        overflow-y: auto; /* Включаем прокрутку внутри формы */
        flex-grow: 1;
        -webkit-overflow-scrolling: touch; /* Плавная прокрутка на iOS */
    }

    /* Шапка формы (чтобы не уезжала при прокрутке) */
    .modal-form__head {
        flex-shrink: 0;
        margin-bottom: 15px;
        padding-top: 10px;
        padding-right: 30px; /* Отступ для крестика */
    }

    .modal-form__head h3 {
        font-size: 22px;
        margin-bottom: 5px;
    }

    .modal-form__head p {
        font-size: 12px;
    }

    /* Кнопка закрытия */
    .modal__close {
        position: absolute;
        top: 15px;
        right: 15px;
        background: #fff;
        border-radius: 50%;
        width: 32px;
        height: 32px;
        display: grid;
        place-items: center;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        z-index: 10;
    }

    .modal-form__body {
        flex-shrink: 0;
        padding-bottom: 20px;
    }

    /* Поля ввода */
    .modal-form__body input[type="text"],
    .modal-form__body input[type="tel"],
    .modal-form__body textarea {
        padding: 12px;
        font-size: 16px; /* Важно: 16px предотвращает авто-зум в iOS Safari */
    }

    .modal-form__body label {
        margin-bottom: 10px;
    }

    .file-upload {
        padding: 12px;
        margin-bottom: 15px;
    }
}