/*
 * پاپ‌آپِ صفحه‌ی اصلی — مشترک بینِ سایت و پیش‌نمایشِ پنل ادمین.
 * همه‌ی رنگ‌ها و اندازه‌ها از متغیرهای --npp-* می‌آیند که روی ریشه‌ی پاپ‌آپ
 * (از تنظیماتِ پنل) گذاشته می‌شوند.
 */
.np-popup {
    --npp-bg: #111827;
    --npp-text: #e5e7eb;
    --npp-title: #e6c96f;
    --npp-link: #93c5fd;
    --npp-border: #3b3420;
    --npp-border-w: 1px;
    --npp-overlay: rgba(0, 0, 0, .65);
    --npp-blur: 4px;
    --npp-width: 480px;
    --npp-radius: 20px;
    --npp-pad: 28px;
    --npp-title-size: 22px;
    --npp-body-size: 15px;
    --npp-lh: 1.9;
    --npp-title-align: center;
    --npp-text-align: center;

    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    direction: rtl;
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
}
.np-popup[hidden] { display: none !important; }
.np-popup *, .np-popup *::before, .np-popup *::after { box-sizing: border-box; }

.np-popup--pos-top { align-items: flex-start; padding-top: 6vh; }
.np-popup--pos-bottom { align-items: flex-end; padding-bottom: 4vh; }

.np-popup__overlay {
    position: absolute;
    inset: 0;
    background: var(--npp-overlay);
    -webkit-backdrop-filter: blur(var(--npp-blur));
    backdrop-filter: blur(var(--npp-blur));
    opacity: 0;
    transition: opacity .3s ease;
}

.np-popup__box {
    position: relative;
    width: 100%;
    max-width: var(--npp-width);
    max-height: calc(100% - 8px);
    overflow-y: auto;
    background: var(--npp-bg);
    color: var(--npp-text);
    border: var(--npp-border-w) solid var(--npp-border);
    border-radius: var(--npp-radius);
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .6);
    opacity: 0;
    transition: opacity .3s ease, transform .35s cubic-bezier(.2, .9, .3, 1.2);
    overscroll-behavior: contain;
    outline: none;
}
.np-popup--anim-zoom .np-popup__box { transform: scale(.85); }
.np-popup--anim-slide .np-popup__box { transform: translateY(40px); }
.np-popup--anim-fade .np-popup__box { transform: none; }
.np-popup--anim-none .np-popup__overlay,
.np-popup--anim-none .np-popup__box { transition: none; }

.np-popup.is-open .np-popup__overlay { opacity: 1; }
.np-popup.is-open .np-popup__box { opacity: 1; transform: none; }

.np-popup__image { display: block; line-height: 0; }
.np-popup__image img {
    display: block;
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    border-radius: calc(var(--npp-radius) - var(--npp-border-w)) calc(var(--npp-radius) - var(--npp-border-w)) 0 0;
}

.np-popup__content { padding: var(--npp-pad); }

.np-popup__title {
    margin: 0 0 12px;
    color: var(--npp-title);
    font-size: var(--npp-title-size);
    font-weight: 800;
    line-height: 1.5;
    text-align: var(--npp-title-align);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.np-popup__title:last-child { margin-bottom: 0; }

/* فاصله‌ها و سرِخط‌ها دقیقاً همان‌طور که در پنل نوشته شده حفظ می‌شوند */
.np-popup__body {
    margin: 0;
    font-size: var(--npp-body-size);
    line-height: var(--npp-lh);
    text-align: var(--npp-text-align);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.np-popup__body a { color: var(--npp-link); text-decoration: underline; text-underline-offset: 3px; }
.np-popup__body a:hover { opacity: .85; }
.np-popup__body strong { font-weight: 800; }

.np-popup__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
    justify-content: center;
}
.np-popup__title + .np-popup__actions { margin-top: 18px; }
.np-popup__content > .np-popup__actions:first-child { margin-top: 0; }
.np-popup__actions--start { justify-content: flex-start; }
.np-popup__actions--end { justify-content: flex-end; }
.np-popup__actions--column { flex-direction: column; align-items: center; }
.np-popup__actions--column.np-popup__actions--start { align-items: flex-start; }
.np-popup__actions--column.np-popup__actions--end { align-items: flex-end; }
.np-popup__actions--stretch > .np-popup__btn { flex: 1 1 0; }
.np-popup__actions--column.np-popup__actions--stretch { align-items: stretch; }

/* انتخاب‌گرها عمداً دوکلاسه‌اند تا استایلِ عمومیِ button/a در صفحه رویشان اثر نگذارد */
.np-popup .np-popup__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 22px;
    margin: 0;
    border-radius: 12px;
    border: 2px solid var(--b-bg, #c9a227);
    background: var(--b-bg, #c9a227);
    color: var(--b-fg, #111827);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: transform .15s ease, filter .15s ease, background .15s ease;
    width: auto;
    box-shadow: none;
}
.np-popup .np-popup__btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.np-popup .np-popup__btn:active { transform: translateY(0); }
.np-popup .np-popup__btn--outline { background: transparent; color: var(--b-bg, #c9a227); }
.np-popup .np-popup__btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--b-bg, #c9a227);
    text-decoration: underline;
    text-underline-offset: 4px;
}
.np-popup .np-popup__btn:focus-visible,
.np-popup .np-popup__close:focus-visible { outline: 3px solid var(--npp-link); outline-offset: 2px; }

.np-popup .np-popup__close {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 0;
    background: rgba(0, 0, 0, .35);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}
.np-popup .np-popup__close:hover { background: rgba(0, 0, 0, .55); transform: rotate(90deg); }

body.np-popup-lock { overflow: hidden; }

@media (max-width: 480px) {
    .np-popup { padding: 12px; }
    .np-popup__content { padding: min(var(--npp-pad), 22px); }
    .np-popup--pos-bottom { padding-bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .np-popup__overlay, .np-popup__box { transition: none !important; }
}

/* ===== حالتِ پیش‌نمایش در پنل ادمین: داخلِ یک قاب، نه کلِ صفحه ===== */
.np-popup.np-popup--preview { position: absolute; z-index: 1; }
