body.modal-open {
    overflow: hidden;
}


/* =========================================================
    BUTTONS
    ========================================================= */

.btn {
    display: inline-block;

    padding: 9px 16px;

    border: 1px solid transparent;
    border-radius: 5px;

    font-size: 14px;
    line-height: 1.5;

    cursor: pointer;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.btn-primary {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

.btn-primary:hover {
    background: #0b5ed7;
    border-color: #0a58ca;
}

.btn-secondary {
    background: #6c757d;
    border-color: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background: #5c636a;
    border-color: #565e64;
}


/* =========================================================
    MODAL BACKDROP
    ========================================================= */

.custom-modal {
    position: fixed;
    z-index: 9999;

    inset: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 20px;

    box-sizing: border-box;

    /*
        * Important:
        * Do NOT use display:none here.
        *
        * opacity + visibility allow the close animation
        * to work properly.
        */
    opacity: 0;
    visibility: hidden;

    background: rgba(0, 0, 0, 0);

    transition:
        opacity 0.25s ease,
        visibility 0.25s ease,
        background-color 0.25s ease;
}


/* =========================================================
    MODAL OPEN STATE
    ========================================================= */

.custom-modal.show {
    opacity: 1;
    visibility: visible;

    background: rgba(0, 0, 0, 0.55);
}


/* =========================================================
    MODAL DIALOG
    ========================================================= */

.custom-modal-dialog {

    width: 100%;
    max-width: 500px;

    max-height: calc(100vh - 40px);

    display: flex;
    flex-direction: column;

    background: #fff;

    border-radius: 8px;

    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.20),
        0 4px 10px rgba(0, 0, 0, 0.10);

    overflow: hidden;

    /*
        * Initial state
        */
    opacity: 0;

    transform:
        translateY(-30px)
        scale(0.97);

    transition:
        opacity 0.25s ease,
        transform 0.25s ease;
}


/* =========================================================
    DIALOG OPEN STATE
    ========================================================= */

.custom-modal.show .custom-modal-dialog {

    opacity: 1;

    transform:
        translateY(0)
        scale(1);
}


/* =========================================================
    MODAL HEADER
    ========================================================= */

.custom-modal-header {

    display: flex;

    align-items: center;
    justify-content: space-between;

    padding: 16px 20px;

    border-bottom: 1px solid #dee2e6;

    flex-shrink: 0;
}


.custom-modal-title {

    margin: 0;

    font-size: 20px;

    font-weight: 600;

    line-height: 1.4;

    color: #212529;
}


/* =========================================================
    CLOSE BUTTON
    ========================================================= */

.custom-modal-close {

    width: 32px;
    height: 32px;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 0;

    border: none;

    background: transparent;

    color: #6c757d;

    font-size: 28px;

    line-height: 1;

    cursor: pointer;

    border-radius: 4px;

    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}


.custom-modal-close:hover {

    background: #f1f3f5;

    color: #212529;
}


/* =========================================================
    MODAL BODY
    ========================================================= */

.custom-modal-body {

    padding: 20px;

    overflow-y: auto;

    font-size: 15px;

    line-height: 1.6;

    color: #212529;
}


.custom-modal-body p {

    margin-top: 0;

    margin-bottom: 12px;
}


/* =========================================================
    MODAL FOOTER
    ========================================================= */

.custom-modal-footer {

    display: flex;

    align-items: center;
    justify-content: flex-end;

    gap: 10px;

    padding: 14px 20px;

    border-top: 1px solid #dee2e6;

    background: #f8f9fa;

    flex-shrink: 0;
}


/* =========================================================
    RESPONSIVE
    ========================================================= */

@media (max-width: 576px) {

    .custom-modal {

        padding: 12px;
    }

    .custom-modal-dialog {

        max-height: calc(100vh - 24px);

        border-radius: 7px;
    }

    .custom-modal-header {

        padding: 14px 16px;
    }

    .custom-modal-body {

        padding: 16px;
    }

    .custom-modal-footer {

        padding: 12px 16px;
    }
}


/* =========================================================
    OPTIONAL: REDUCE MOTION
    ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .custom-modal,
    .custom-modal-dialog {

        transition: none;
    }
}
