/* ==================================================
   МскСборка — единое оформление почтовых форм
   Form.css
   ================================================== */


/* ==================================================
   01. Основные параметры
   ================================================== */

.msk-modal,
.msk-form {
    --msk-text: #545454;
    --msk-label: #777777;
    --msk-border: #d5d5d5;
    --msk-field-bg: #ffffff;
    --msk-primary: #e85b35;
    --msk-primary-hover: #cc4827;
    --msk-accent: #c35a56;
    --msk-error: #b95750;
    --msk-radius: 6px;
    --msk-field-height: 42px;
    --msk-address-height: 90px;
    --msk-comment-height: 100px;
}


/* ==================================================
   02. Модальное окно
   ================================================== */

.msk-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.msk-modal.is-open {
    display: flex;
}

.msk-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}

.msk-modal__window {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: 35px;
    background: #ffffff;
    border-radius: 10px;
    box-sizing: border-box;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.msk-modal__window h2 {
    margin: 0 35px 12px 0;
    padding: 0;
    height: auto;
    font-size: 25px;
    line-height: 1.3;
    text-align: left;
    color: #222222;
}

.msk-modal__description {
    margin: 0 0 25px;
    color: #777777;
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
}

.msk-modal__close {
    position: absolute;
    top: 12px;
    right: 18px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: transparent;
    color: #777777;
    font-size: 32px;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
}

.msk-modal__close:hover {
    color: #333333;
}

body.msk-modal-open {
    overflow: hidden;
}


/* ==================================================
   03. Общая структура формы
   ================================================== */

table.msk-form {
    width: 100%;
    max-width: 100%;
    border: 0;
    border-spacing: 0;
    table-layout: fixed;
    text-align: left;
    font-size: 13px;
    color: var(--msk-label);
    box-sizing: border-box;
}

.msk-form td {
    padding: 8px 5px;
    vertical-align: top;
    line-height: 1.5;
    overflow-wrap: break-word;
}

.msk-form tr > td:first-child:not([colspan]) {
    width: 35%;
}

.msk-form tr > td:nth-child(2) {
    width: 65%;
}


/* ==================================================
   04. Поля ввода и выпадающие списки
   ================================================== */

.msk-form input[type="text"],
.msk-form input[type="email"],
.msk-form input[type="tel"],
.msk-form input[type="date"],
.msk-form select,
.msk-form textarea {
    display: block;
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--msk-border);
    border-radius: var(--msk-radius);
    background: var(--msk-field-bg);
    color: var(--msk-text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    box-sizing: border-box;
}

.msk-form input[type="text"],
.msk-form input[type="email"],
.msk-form input[type="tel"],
.msk-form input[type="date"],
.msk-form select {
    height: var(--msk-field-height);
    min-height: var(--msk-field-height);
}

.msk-form input:focus,
.msk-form select:focus,
.msk-form textarea:focus {
    outline: 2px solid var(--msk-accent);
    outline-offset: 1px;
}

.msk-form input::placeholder,
.msk-form textarea::placeholder {
    color: #999999;
    opacity: 1;
}


/* ==================================================
   05. Адрес и комментарий
   ================================================== */

.msk-form textarea {
    resize: vertical;
}

.msk-form textarea.msk-field-address {
    height: var(--msk-address-height) !important;
    min-height: var(--msk-address-height) !important;
}

.msk-form textarea.msk-field-comment {
    height: var(--msk-comment-height) !important;
    min-height: var(--msk-comment-height) !important;
}


/* ==================================================
   06. Календарь
   ================================================== */

.msk-form input[type="date"] {
    padding: 0 12px;
    text-align: left;
    cursor: pointer;
}

.msk-form input[type="date"]::-webkit-date-and-time-value {
    min-width: 0;
    margin: 0;
    text-align: left;
}


/* ==================================================
   07. Прикрепление файлов
   ================================================== */

.msk-form input[type="file"] {
    display: block;
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
    min-height: 40px;
    margin: 0;
    font-family: inherit;
    font-size: 13px;
    color: var(--msk-text);
    box-sizing: border-box;
}

.msk-form input[type="file"]::file-selector-button {
    margin-right: 8px;
    padding: 10px 12px;
    border: 1px solid #dddddd;
    border-radius: var(--msk-radius);
    background: #e8e8e8;
    color: var(--msk-text);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

.msk-form input[type="file"]::file-selector-button:hover {
    background: #dddddd;
}


/* ==================================================
   08. Переключатели и согласие
   ================================================== */

.msk-form input[type="radio"],
.msk-form input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0 6px 0 0;
    vertical-align: middle;
    accent-color: var(--msk-accent);
    cursor: pointer;
}

.msk-form input[type="radio"] + label {
    display: inline-block;
    margin-right: 18px;
    padding: 8px 0;
    cursor: pointer;
}

.msk-form .msk-field-policy + a {
    line-height: 1.6;
}


/* ==================================================
   09. Кнопки управления формой
   ================================================== */

.msk-form td.msk-form-actions {
    padding-top: 18px;
    text-align: right;
}

.msk-form input[type="submit"],
.msk-form input[type="reset"] {
    display: inline-block;
    width: auto;
    min-height: 44px;
    padding: 12px 24px;
    border-radius: var(--msk-radius);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    box-sizing: border-box;
    cursor: pointer;
}

.msk-form input[type="submit"] {
    border: 1px solid transparent;
    background: var(--msk-primary);
    color: #ffffff;
    font-weight: 600;
}

.msk-form input[type="submit"]:hover {
    background: var(--msk-primary-hover);
}

.msk-form input[type="reset"] {
    margin-left: 8px;
    border: 1px solid #dddddd;
    background: #eeeeee;
    color: #777777;
}

.msk-form input[type="reset"]:hover {
    background: #e0e0e0;
}

.msk-form input[type="submit"]:disabled,
.msk-form input[type="reset"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* ==================================================
   10. Предупреждения и ошибки
   ================================================== */

.msk-form .msk-field-error {
    border: 1px solid var(--msk-error) !important;
    background: #fff7f6 !important;
}

.msk-form .msk-error-message {
    display: block;
    margin: 8px 0 0;
    padding: 0;
    color: var(--msk-error);
    font-size: 13px;
    font-weight: normal;
    line-height: 1.5;
    text-align: left;
}

.msk-form .msk-error-message[hidden] {
    display: none;
}


/* ==================================================
   11. Мобильная адаптация
   ================================================== */

@media screen and (max-width: 767px) {

    .msk-form {
        --msk-field-bg: #f2f2f2;
        --msk-primary: #c35a56;
        --msk-primary-hover: #ad4945;
        --msk-field-height: 44px;
    }


    /* Модальное окно */

    .msk-modal {
        padding: 10px;
    }

    .msk-modal__window {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        max-height: 92dvh;
        padding: 20px 15px;
        border-radius: 12px;
        -webkit-overflow-scrolling: touch;
    }

    .msk-modal__window h2 {
        font-size: 21px !important;
        line-height: 1.3 !important;
        text-align: left !important;
        margin: 0 30px 12px 0 !important;
        padding: 0 !important;
        height: auto !important;
    }

    .msk-modal__description {
        font-size: 15px !important;
        line-height: 1.5;
        margin: 0 0 18px;
    }

    .msk-modal__close {
        top: 8px;
        right: 8px;
        width: 40px;
        height: 40px;
        padding: 0;
        font-size: 32px;
        line-height: 40px;
        z-index: 10;
    }


    /* Структура формы */

    table.msk-form,
    .msk-form tbody,
    .msk-form tr,
    .msk-form td {
        display: block;
        width: 100% !important;
        max-width: 100%;
        box-sizing: border-box;
    }

    table.msk-form {
        font-size: 14px;
    }

    .msk-form tr {
        margin: 0 0 14px;
    }

    .msk-form td {
        padding: 3px 0 !important;
        text-align: left;
        line-height: 1.4;
    }


    /* Поля ввода */

    .msk-form input[type="text"],
    .msk-form input[type="email"],
    .msk-form input[type="tel"],
    .msk-form input[type="date"],
    .msk-form select,
    .msk-form textarea {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0;
        font-size: 16px !important;
        padding: 10px 12px !important;
    }


    /* Календарь — адаптация iPhone */

    .msk-form input[type="date"] {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
        padding: 0 12px !important;
        -webkit-appearance: none;
        appearance: none;
        box-sizing: border-box !important;
    }


    /* Переключатели */

    .msk-form input[type="radio"],
    .msk-form input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }


    /* Кнопки */

    .msk-form td.msk-form-actions {
        padding-top: 8px !important;
    }

    .msk-form input[type="submit"] {
        display: block;
        width: 100% !important;
        min-height: 50px;
        margin: 0 0 10px;
        padding: 12px !important;
        font-size: 16px !important;
    }

    .msk-form input[type="reset"] {
        display: block;
        width: 100% !important;
        min-height: 44px;
        margin: 0;
        padding: 10px !important;
        font-size: 14px !important;
    }

    .msk-form td.msk-form-actions > br {
        display: none;
    }


    /* Предупреждения */

    .msk-form .msk-error-message {
        font-size: 14px;
    }

}
/* ==================================================
   МОДАЛЬНОЕ ОКНО — ЗАКРЕПЛЕННЫЙ ЗАГОЛОВОК
   ================================================== */

.msk-modal__window:has(> .msk-modal__header) {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

/* Неподвижная верхняя часть */

.msk-modal__header {
    position: relative;
    flex-shrink: 0;
    padding: 25px 35px 20px;
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    box-sizing: border-box;
    z-index: 10;
}

/* Заголовок */

.msk-modal__header h2 {
    margin: 0 35px 0 0 !important;
    padding: 0 !important;
    height: auto !important;

    font-family: Verdana, Arial, sans-serif !important;
    font-size: 24px !important;
    font-weight: 600 !important;
    font-style: normal !important;

    line-height: 1.3 !important;
    text-align: left !important;
    text-transform: none !important;
    letter-spacing: normal !important;

    color: #333333;
}

/* Кнопка закрытия */

.msk-modal__header .msk-modal__close {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    line-height: 40px;
    text-align: center;
}

/* Прокручиваемая область */

.msk-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    padding: 20px 35px 35px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

/* Мобильная версия */

@media screen and (max-width: 767px) {

    .msk-modal__window:has(> .msk-modal__header) {
        padding: 0 !important;
        overflow: hidden !important;
    }

    .msk-modal__header {
        padding: 18px 15px;
    }

    .msk-modal__header h2 {
        margin: 0 40px 0 0 !important;
        font-size: 20px !important;
        line-height: 1.35 !important;
    }

    .msk-modal__header .msk-modal__close {
        top: 50%;
        right: 8px;
    }

    .msk-modal__body {
        padding: 15px 15px 20px;
    }

}
/* ==================================================
   ПОДСКАЗКА В ПУСТОМ ПОЛЕ ДАТЫ
   ================================================== */

@media screen and (max-width: 767px) {

    .msk-form input.msk-field-date {
        position: relative;
    }

    .msk-form input.msk-field-date.msk-date-empty::before {
        content: "Выберите дату";
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        color: #999999;
        font-size: 16px;
        font-weight: normal;
        pointer-events: none;
    }

    .msk-form input.msk-field-date.msk-date-empty:focus::before {
        display: none;
    }

}


/* ==================================================
   Конец Form.css
   ================================================== */

