/* ==================================================
   БАЗОВЫЕ ЭЛЕМЕНТЫ ФОРМ
================================================== */

input,
textarea,
select,
button {
    font: inherit;
}


/* ==================================================
   ПОДПИСИ ПОЛЕЙ
================================================== */

label {
    display: inline-block;
    margin-bottom: 7px;

    color: var(--color-text);

    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}


/* ==================================================
   ТЕКСТОВЫЕ ПОЛЯ
================================================== */

input,
textarea,
select {
    width: 100%;
    padding: 13px 15px;

    color: var(--color-text);
    background: #ffffff;

    border: 1px solid #d9dde5;
    border-radius: var(--radius-small);

    outline: none;

    transition:
        color var(--transition),
        background var(--transition),
        border-color var(--transition),
        box-shadow var(--transition);
}

input::placeholder,
textarea::placeholder {
    color: #9ca2ad;
    opacity: 1;
}

input:hover,
textarea:hover,
select:hover {
    border-color: #bfc5d1;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--color-accent);

    box-shadow:
        0 0 0 4px rgba(49, 87, 213, 0.12);
}


/* ==================================================
   TEXTAREA
================================================== */

textarea {
    min-height: 130px;
    resize: vertical;
}


/* ==================================================
   SELECT
================================================== */

select {
    cursor: pointer;
}


/* ==================================================
   CHECKBOX И RADIO
================================================== */

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;

    flex: 0 0 18px;

    accent-color: var(--color-accent);

    cursor: pointer;
}

.form-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.form-check label {
    margin-bottom: 0;

    color: var(--color-text-soft);

    font-size: 14px;
    font-weight: 500;

    cursor: pointer;
}


/* ==================================================
   ФАЙЛ
================================================== */

input[type="file"] {
    padding: 10px;

    cursor: pointer;
}

input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 9px 14px;

    color: var(--color-accent);
    background: var(--color-accent-soft);

    border: 0;
    border-radius: 8px;

    font-weight: 700;

    cursor: pointer;
}


/* ==================================================
   КНОПКИ
================================================== */

button,
.button {
    display: inline-flex;
    min-height: 44px;
    padding: 0 20px;

    align-items: center;
    justify-content: center;
    gap: 8px;

    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            var(--color-accent),
            #5e4edc
        );

    border: 0;
    border-radius: 999px;

    font-weight: 700;
    line-height: 1;

    text-decoration: none;

    cursor: pointer;

    box-shadow:
        0 10px 24px rgba(49, 87, 213, 0.22);

    transition:
        transform var(--transition),
        box-shadow var(--transition),
        opacity var(--transition),
        background var(--transition);
}

button:hover,
.button:hover {
    color: #ffffff;

    transform: translateY(-1px);

    box-shadow:
        0 14px 30px rgba(49, 87, 213, 0.28);

    text-decoration: none;
}

button:active,
.button:active {
    transform: translateY(0);
}


/* ==================================================
   ВТОРИЧНАЯ КНОПКА
================================================== */

.button--secondary {
    color: var(--color-accent);
    background: var(--color-accent-soft);

    box-shadow: none;
}

.button--secondary:hover {
    color: var(--color-accent-hover);
    background: #e3e9ff;

    box-shadow: none;
}


/* ==================================================
   КНОПКА С РАМКОЙ
================================================== */

.button--outline {
    color: var(--color-accent);
    background: transparent;

    border: 1px solid var(--color-accent);

    box-shadow: none;
}

.button--outline:hover {
    color: #ffffff;
    background: var(--color-accent);

    box-shadow:
        0 10px 24px rgba(49, 87, 213, 0.18);
}


/* ==================================================
   ОПАСНАЯ КНОПКА
================================================== */

.button--danger {
    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            #c7372f,
            #a81e18
        );

    box-shadow:
        0 10px 24px rgba(180, 35, 24, 0.2);
}


/* ==================================================
   ОТКЛЮЧЕННЫЕ ЭЛЕМЕНТЫ
================================================== */

button:disabled,
input:disabled,
textarea:disabled,
select:disabled,
.button.is-disabled {
    opacity: 0.55;

    cursor: not-allowed;
}

button:disabled:hover,
.button.is-disabled:hover {
    transform: none;
}


/* ==================================================
   СТРУКТУРА ФОРМЫ
================================================== */

.form {
    width: 100%;
}

.form-row {
    margin-bottom: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;

    margin-top: 28px;
}


/* ==================================================
   ПОДСКАЗКИ
================================================== */

.form-help {
    margin-top: 7px;

    color: var(--color-text-soft);

    font-size: 13px;
    line-height: 1.5;
}


/* ==================================================
   ОШИБКИ ПОЛЕЙ
================================================== */

.form-error {
    margin-top: 7px;

    color: var(--color-error);

    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

.is-error input,
.is-error textarea,
.is-error select,
input.is-error,
textarea.is-error,
select.is-error {
    border-color: var(--color-error);

    box-shadow:
        0 0 0 4px rgba(180, 35, 24, 0.1);
}


/* ==================================================
   УСПЕШНОЕ ПОЛЕ
================================================== */

.is-success input,
.is-success textarea,
.is-success select,
input.is-success,
textarea.is-success,
select.is-success {
    border-color: var(--color-success);

    box-shadow:
        0 0 0 4px rgba(24, 121, 78, 0.1);
}


/* ==================================================
   СЛУЖЕБНЫЕ СООБЩЕНИЯ
================================================== */

.error,
.success,
.notice {
    margin: 24px 0;
    padding: 16px 18px;

    border-radius: var(--radius-small);

    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
}

.error {
    color: var(--color-error);
    background: var(--color-error-bg);

    border: 1px solid #f3c1bc;
}

.success {
    color: var(--color-success);
    background: var(--color-success-bg);

    border: 1px solid #b9e1ca;
}

.notice {
    color: var(--color-notice);
    background: var(--color-notice-bg);

    border: 1px solid #efd59a;
}


/* ==================================================
   ДОСТУПНОСТЬ
================================================== */

button:focus-visible,
.button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(49, 87, 213, 0.35);
    outline-offset: 3px;
}











/* ==================================================
   МОДАЛЬНОЕ ОКНО
================================================== */

.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    background: rgba(20, 25, 38, 0.58);

    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);

    opacity: 0;

    transition: opacity 0.2s ease;
}

.modal[hidden] {
    display: none;
}

.modal.is-open {
    opacity: 1;
}


/* Карточка */

.modal__dialog {
    position: relative;

    width: min(100%, 520px);
    max-height: calc(100vh - 48px);
    overflow-y: auto;

    padding: 34px;

    background: #ffffff;

    border: 1px solid #e1e4ea;
    border-radius: var(--radius-medium);

    box-shadow:
        0 28px 80px rgba(20, 25, 38, 0.28);
}


/* Заголовок */

.modal__title {
    margin: 0 50px 28px 0;

    color: var(--color-text);

    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}


/* Форма внутри модалки */

.modal__form {
    width: 100%;
}

.modal__form .form-actions {
    margin-top: 24px;
}


/* Крестик */

.modal__close {
    position: absolute;
    top: 18px;
    right: 18px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 38px;
    height: 38px;
    min-height: 0;
    padding: 0;

    color: #777e8b;
    background: transparent;

    border: 0;
    border-radius: 50%;

    box-shadow: none;

    font-size: 28px;
    font-weight: 400;
    line-height: 1;

    cursor: pointer;
}

.modal__close:hover {
    color: var(--color-text);
    background: #f2f4f7;

    box-shadow: none;
    transform: none;
}


/* При открытой модалке страница не прокручивается */

body.modal-open {
    overflow: hidden;
}


/* ==================================================
   МОДАЛКА — МОБИЛЬНЫЙ
================================================== */

@media (max-width: 560px) {

    .modal {
        padding: 14px;
    }

    .modal__dialog {
        max-height: calc(100vh - 28px);
        padding: 26px 20px 22px;
    }

    .modal__title {
        margin-bottom: 24px;
        font-size: 24px;
    }

    .modal__close {
        top: 12px;
        right: 12px;
    }

}