/* Global modal form */

.form-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.form-modal--open {
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
}

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

.form-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(18, 18, 18, 0.55);
    cursor: pointer;
}

.form-modal__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: calc(520 / 1440 * 100vw);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: calc(40 / 1440 * 100vw) calc(36 / 1440 * 100vw) calc(36 / 1440 * 100vw);
    border-radius: calc(24 / 1440 * 100vw);
    background: var(--clr-white);
    box-shadow: 0 20px 60px rgba(18, 18, 18, 0.2);
    box-sizing: border-box;
}

.form-modal__close {
    position: absolute;
    top: calc(16 / 1440 * 100vw);
    right: calc(16 / 1440 * 100vw);
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(36 / 1440 * 100vw);
    height: calc(36 / 1440 * 100vw);
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--clr-milk);
    cursor: pointer;
    transition: background 0.2s ease;
}

.form-modal__close:hover {
    background: var(--clr-light-gray);
}

.form-modal__close img {
    width: calc(16 / 1440 * 100vw);
    height: calc(16 / 1440 * 100vw);
    display: block;
}

.form-modal__title {
    margin: 0 0 calc(28 / 1440 * 100vw);
    text-align: center;
}

.form-modal__form {
    display: flex;
    flex-direction: column;
    gap: calc(4 / 1440 * 100vw);
}

.form-modal__field {
    margin-bottom: calc(14 / 1440 * 100vw);
}

.form-modal__label {
    display: block;
    margin-bottom: calc(8 / 1440 * 100vw);
}

.form-modal__input {
    border: 1px solid var(--clr-light-gray);
    border-radius: calc(12 / 1440 * 100vw);
    background: var(--clr-white);
}

.form-modal__input:focus {
    outline: 1px solid var(--clr-gray);
}

.form-modal__checkboxes {
    margin: calc(8 / 1440 * 100vw) 0 calc(16 / 1440 * 100vw);
    display: flex;
    flex-direction: column;
    gap: calc(10 / 1440 * 100vw);
}

.form-modal__checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: calc(8 / 1440 * 100vw);
    color: var(--clr-black);
    cursor: pointer;
    line-height: 1.4;
}

.form-modal__checkbox-text {
    flex: 1;
    min-width: 0;
}

.form-modal .global-form__checkbox {
    flex-shrink: 0;
    margin: 2px 0 0;
}

.form-modal .global-form__checkbox:checked {
    background-color: var(--clr-terkot);
    border-color: var(--clr-terkot);
}

.form-modal .error-input {
    color: var(--clr-error);
    text-decoration: none;
}

.form-modal__message {
    margin-bottom: calc(14 / 1440 * 100vw);
    padding: calc(12 / 1440 * 100vw) calc(16 / 1440 * 100vw);
    border-radius: calc(12 / 1440 * 100vw);
    font-family: var(--font-family-secondary);
    font-size: var(--body-size);
    line-height: 1.4;
}

.form-modal__message.is-success {
    background: rgba(197, 193, 0, 0.15);
    color: var(--clr-dark-green);
}

.form-modal__message.is-error {
    background: rgba(255, 0, 0, 0.08);
    color: var(--clr-error);
}

.form-modal__submit {
    width: 100%;
    margin-top: calc(8 / 1440 * 100vw);
    border-radius: calc(32 / 1440 * 100vw);
}

.form-modal__submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Inline CTA form messages */

.cta-form__message {
    width: 100%;
    padding: calc(12 / 1440 * 100vw) calc(16 / 1440 * 100vw);
    border-radius: calc(12 / 1440 * 100vw);
    font-family: var(--font-family-secondary);
    font-size: var(--body-size);
    line-height: 1.4;
    box-sizing: border-box;
}

.cta-form__message.is-success {
    background: rgba(255, 255, 255, 0.15);
    color: var(--clr-white);
}

.cta-form__message.is-error {
    background: rgba(255, 0, 0, 0.15);
    color: var(--clr-white);
}

@media screen and (max-width: 1024px) {
    .form-modal__dialog {
        max-width: 520px;
        padding: 36px 28px 28px;
        border-radius: 24px;
    }

    .form-modal__close {
        top: 16px;
        right: 16px;
        width: 36px;
        height: 36px;
    }

    .form-modal__close img {
        width: 16px;
        height: 16px;
    }

    .form-modal__title {
        margin-bottom: 24px;
    }

    .form-modal__field {
        margin-bottom: 12px;
    }

    .form-modal__label {
        margin-bottom: 8px;
    }

    .form-modal__input {
        border-radius: 12px;
    }

    .form-modal__checkboxes {
        margin: 8px 0 14px;
        gap: 10px;
    }

    .form-modal__message {
        margin-bottom: 12px;
        padding: 12px 16px;
        border-radius: 12px;
    }

    .form-modal__submit {
        margin-top: 8px;
        border-radius: 32px;
    }

    .cta-form__message {
        padding: 12px 16px;
        border-radius: 12px;
    }
}

@media screen and (max-width: 768px) {
    .form-modal {
        padding: 12px;
        align-items: flex-end;
    }

    .form-modal__dialog {
        max-height: calc(100vh - 24px);
        border-radius: 20px 20px 0 0;
    }
}

/* Form success notification modal */

.form-success-modal {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.form-success-modal--open {
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
}

body.form-success-modal-open {
    overflow: hidden;
}

.form-success-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(18, 18, 18, 0.55);
    cursor: pointer;
}

.form-success-modal__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: calc(420 / 1440 * 100vw);
    padding: calc(40 / 1440 * 100vw) calc(36 / 1440 * 100vw) calc(36 / 1440 * 100vw);
    border-radius: calc(24 / 1440 * 100vw);
    background: var(--clr-white);
    box-shadow: 0 20px 60px rgba(18, 18, 18, 0.2);
    box-sizing: border-box;
    text-align: center;
}

.form-success-modal__close {
    position: absolute;
    top: calc(16 / 1440 * 100vw);
    right: calc(16 / 1440 * 100vw);
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(36 / 1440 * 100vw);
    height: calc(36 / 1440 * 100vw);
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--clr-milk);
    cursor: pointer;
    transition: background 0.2s ease;
}

.form-success-modal__close:hover {
    background: var(--clr-light-gray);
}

.form-success-modal__close img {
    width: calc(16 / 1440 * 100vw);
    height: calc(16 / 1440 * 100vw);
    display: block;
}

.form-success-modal__icon {
    width: calc(64 / 1440 * 100vw);
    height: calc(64 / 1440 * 100vw);
    margin-bottom: calc(20 / 1440 * 100vw);
}

.form-success-modal__title {
    margin: 0 0 calc(12 / 1440 * 100vw);
}

.form-success-modal__text {
    margin: 0 0 calc(28 / 1440 * 100vw);
    line-height: 1.5;
}

.form-success-modal__btn {
    width: 100%;
    border-radius: calc(32 / 1440 * 100vw);
}

@media screen and (max-width: 1024px) {
    .form-success-modal__dialog {
        max-width: 420px;
        padding: 36px 28px 28px;
        border-radius: 24px;
    }

    .form-success-modal__close {
        top: 16px;
        right: 16px;
        width: 36px;
        height: 36px;
    }

    .form-success-modal__close img {
        width: 16px;
        height: 16px;
    }

    .form-success-modal__icon {
        width: 64px;
        height: 64px;
        margin-bottom: 20px;
    }

    .form-success-modal__title {
        margin-bottom: 12px;
    }

    .form-success-modal__text {
        margin-bottom: 24px;
    }

    .form-success-modal__btn {
        border-radius: 32px;
    }
}

@media screen and (max-width: 768px) {
    .form-success-modal {
        padding: 12px;
        align-items: flex-end;
    }

    .form-success-modal__dialog {
        border-radius: 20px 20px 0 0;
    }
}
