/*
|--------------------------------------------------------------------------
| PROJECT REDLINE - MODAL SYSTEM
|--------------------------------------------------------------------------
*/

/*
|--------------------------------------------------------------------------
| MODAL OVERLAY
|--------------------------------------------------------------------------
*/

.modal-overlay {
    position: fixed;

    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background:
        rgba(0, 0, 0, 0.72);

    backdrop-filter: blur(10px);

    z-index: 999999;

    opacity: 0;
    visibility: hidden;

    transition:
        opacity 0.22s ease,
        visibility 0.22s ease;
}

/*
|--------------------------------------------------------------------------
| SHOW
|--------------------------------------------------------------------------
*/

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

/*
|--------------------------------------------------------------------------
| MODAL WINDOW
|--------------------------------------------------------------------------
*/

.modal-window {

    position: relative;

    width: 100%;

    max-width: 900px;

    max-height:
        calc(100vh - 40px);

    overflow: hidden;

    display: flex;

    flex-direction: column;

    padding: 0;

    border-radius: 32px;

    border:
        1px solid var(--card-border);

    background:
        var(--modal-background);

    box-shadow:
        0 0 40px rgba(255,42,42,0.08),
        0 0 120px rgba(0,0,0,0.82);

    transform:
        scale(0.94)
        translateY(10px);

    transition:
        transform 0.22s ease;
}

/*
|--------------------------------------------------------------------------
| MODAL SHOW
|--------------------------------------------------------------------------
*/

.modal-overlay.show .modal-window {
    transform:
        scale(1)
        translateY(0);
}

/*
|--------------------------------------------------------------------------
| CLOSE BUTTON
|--------------------------------------------------------------------------
*/

.modal-close {

    position: absolute;

    top: 20px;
    right: 14px;

    width: 42px;
    height: 42px;

    display: flex;

    align-items: center;
    justify-content: center;

    border:
        1px solid var(--card-border);

    border-radius: 14px;

    background:
        var(--card-background);

    color:
        var(--text-color);

    font-size: 22px;

    font-weight: 700;

    cursor: pointer;

    z-index: 999999;

    transition:
        background 0.25s ease,
        border-color 0.25s ease,
        color 0.25s ease,
        box-shadow 0.25s ease;
}

.modal-close:hover {

    background:
        rgba(255,52,52,0.12);

    border-color:
        rgba(255,52,52,0.30);

    color:
        var(--primary-color);

    box-shadow:
        0 0 18px rgba(255,52,52,0.10);
}

/*
|--------------------------------------------------------------------------
| CONTENT
|--------------------------------------------------------------------------
|
| Внутренний скролл модалки.
| Контент не растягивает окно.
|
*/

.modal-content {

    width: 100%;

    flex: 1;

    overflow-y: auto;

    overflow-x: hidden;

    padding: 30px;
}

/*
|--------------------------------------------------------------------------
| MOBILE
|--------------------------------------------------------------------------
*/

@media (max-width: 768px) {

    /*
    |--------------------------------------------------------------------------
    | OVERLAY
    |--------------------------------------------------------------------------
    */

    .modal-overlay {

        align-items: flex-start;

        padding:
            150px
            12px
            120px;

        overflow-y: auto;
    }

    /*
    |--------------------------------------------------------------------------
    | WINDOW
    |--------------------------------------------------------------------------
    */

    .modal-window {

        width: 100%;

        max-width: 480px;

        max-height:
            calc(100vh - 170px);

        margin:
            0 auto;

        border-radius: 28px;

        overflow: hidden;
    }

    /*
    |--------------------------------------------------------------------------
    | CONTENT
    |--------------------------------------------------------------------------
    */

    .modal-content {

        width: 100%;

        max-height:
            calc(100vh - 170px);

        overflow-x: hidden;

        overflow-y: auto;
    }   

    /*
    |--------------------------------------------------------------------------
    | CLOSE
    |--------------------------------------------------------------------------
    */

    .modal-close {

        top: 12px;
        right: 12px;

        width: 38px;
        height: 38px;

        border-radius: 12px;

        font-size: 20px;
    }
}

/*
|--------------------------------------------------------------------------
| LIGHT THEME
|--------------------------------------------------------------------------
*/

body.theme-light .modal-overlay {

    background:
        rgba(0,0,0,0.35);

    backdrop-filter:
        blur(8px);
}