/* ===============================
   MODAL LAYER SYSTEM
================================= */

:root {
    --z-modal-backdrop: 1000;
    --z-modal: 1010;
    --z-toast: 2000;

    --modal-radius: 12px;
    --modal-shadow: 0 20px 60px rgba(0,0,0,0.25);
}


/* ===============================
   OVERLAY / BACKDROP
================================= */

.modal-overlay {
    position: fixed;
    inset: 0;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 24px;
    overflow-y: auto;

    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);

    z-index: var(--z-modal-backdrop);

    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}


/* ===============================
   MODAL BOX
================================= */

.modal-box {
    position: relative;

    width: 100%;
    max-width: 520px;

    max-height: 90vh;
    display: flex;
    flex-direction: column;

    background: #fff;
    border-radius: var(--modal-radius);
    box-shadow: var(--modal-shadow);

    transform: translateY(20px) scale(0.98);
    opacity: 0;

    transition: all 0.2s ease;
}

.modal-overlay.show .modal-box {
    transform: translateY(0) scale(1);
    opacity: 1;
}


/* ===============================
   HEADER / BODY / FOOTER
================================= */

.modal-header,
.modal-footer {
    padding: 14px 18px;
    flex: 0 0 auto;
}

.modal-header {
    border-bottom: 1px solid #eee;
    font-weight: 600;
}

.modal-footer {
    border-top: 1px solid #eee;
    text-align: right;
}

.modal-body {
    padding: 16px 18px;
    overflow-y: auto;
    flex: 1;
}


/* ===============================
   CLOSE BUTTON
================================= */

.modal-close {
    position: absolute;
    top: 10px;
    right: 12px;

    cursor: pointer;
    font-size: 18px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.modal-close:hover {
    opacity: 1;
}


/* ===============================
   SIZE SYSTEM (clean tokens)
================================= */

.modal-sm  { max-width: 400px; }
.modal-md  { max-width: 600px; }
.modal-lg  { max-width: 800px; }
.modal-xl  { max-width: 1000px; }
.modal-full {
    width: 95vw;
    height: 95vh;
    max-width: none;
}


/* ===============================
   MOBILE OPTIMIZATION
================================= */

@media (max-width: 768px) {

    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal-box {
        width: 100%;
        max-width: 100%;
        height: auto;
        border-radius: 16px 16px 0 0;

        transform: translateY(100%);
    }

    .modal-overlay.show .modal-box {
        transform: translateY(0);
    }
}


/* ===============================
   BODY SCROLL LOCK
================================= */

body.modal-open {
    overflow: hidden;
}

.forgot-modal {

    position: fixed;

    inset: 0;

    background:
        rgba(0,0,0,0.45);

    display: none;

    align-items: center;

    justify-content: center;

    z-index: 1000;
}

.forgot-modal.show {

    display: flex;
}

.forgot-modal-content {

    width: 100%;

    max-width: 520px;

    background: #fff;

    border-radius: 20px;

    padding: 20px;

    position: relative;

    animation:
        modalFade .25s ease;
}

.forgot-close-btn {

    position: absolute;

    top: 12px;

    right: 14px;

    border: none;

    background: none;

    font-size: 28px;

    cursor: pointer;

    color: #64748b;
}

@keyframes modalFade {

    from {

        opacity: 0;

        transform:
            translateY(20px);
    }

    to {

        opacity: 1;

        transform:
            translateY(0);
    }
}