/* =========================================================================
   MsOTP — پاپ‌آپ ورود/عضویت
   دسکتاپ: modal وسط با backdrop blur
   موبایل: slide از پایین، حس native app
   ========================================================================= */

.msotp-popup-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 22px;
    background: #5caf21;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background .18s ease;
}

.msotp-popup-trigger:hover { background: #4e9a1c; }

/* --- ظرف پاپ‌آپ --- */
.msotp-popup {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.msotp-popup[hidden] { display: none; }

/* --- backdrop --- */
.msotp-popup__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 17, 17, .45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity .25s ease;
}

.msotp-popup.is-open .msotp-popup__backdrop { opacity: 1; }

/* --- پنل (دسکتاپ: modal وسط) --- */
.msotp-popup__panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    margin: 16px;
    background: #fff;
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
    transform: translateY(16px) scale(.98);
    opacity: 0;
    transition: transform .25s cubic-bezier(.22, 1, .36, 1), opacity .25s ease;
}

.msotp-popup.is-open .msotp-popup__panel {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* درون پاپ‌آپ، کارت فرم بدون سایه/حاشیه مضاعف */
.msotp-popup__panel .msotp { max-width: none; }
.msotp-popup__panel .msotp__card {
    border: none;
    box-shadow: none;
    padding: 24px 20px;
}

/* --- دکمه بستن --- */
.msotp-popup__close {
    position: absolute;
    inset-inline-end: 14px;
    top: 12px;
    z-index: 2;
    width: 34px;
    height: 34px;
    border: none;
    background: #f3f3f3 !important;
    font-size: 22px;
    line-height: 1;
    color: #555;
    transition: background .18s ease;
    margin: 0;
    padding: 0;
    min-height: auto;
}

.msotp-popup__close:hover { background: #e6e6e6; }

/* --- دستگیره (فقط موبایل دیده می‌شود) --- */
.msotp-popup__handle { display: none; }

/* =========================================================================
   موبایل: اسلاید از پایین به بالا (Bottom Sheet) با حس native
   ========================================================================= */
@media (max-width: 600px) {
    .msotp-popup {
        align-items: flex-end;
        justify-content: stretch;
    }

    .msotp-popup__panel {
        max-width: none;
        width: 100%;
        margin: 0;
        border-radius: 20px 20px 0 0;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
        /* شروع از پایین (خارج از صفحه) */
        transform: translateY(100%);
        opacity: 1;
        transition: transform .32s cubic-bezier(.22, 1, .36, 1);
    }

    .msotp-popup.is-open .msotp-popup__panel {
        transform: translateY(0);
    }

    /* دستگیره بالای شیت */
    .msotp-popup__handle {
        display: block;
        width: 42px;
        height: 5px;
        margin: 8px auto 4px;
        background: #d8d8d8;
        border-radius: 99px;
    }

    .msotp-popup__close { top: 10px; }
}

/* احترام به کاهش حرکت */
@media (prefers-reduced-motion: reduce) {
    .msotp-popup__backdrop,
    .msotp-popup__panel {
        transition: none;
    }
}
