/* پنل ساخت عکس: کتابخانه عکس کاربر، شخصی‌سازی، انتخاب مدل و تنظیمات خروجی
   در صفحه پرامپت، ابزارها و هوش مصنوعی مشترک است */

.pmg {
    --pmg-ink: #0f172b;
    --pmg-muted: #64748b;
    --pmg-line: #e2e8f0;
    --pmg-soft: #f8fafc;
    --pmg-accent: #4f46e5;
    --pmg-accent-soft: #eef0ff;
    --pmg-teal: #00ac94;
    --pmg-danger: #dc2626;
    background: #fff;
    color: var(--pmg-ink);
    border: 1px solid var(--pmg-line);
    border-radius: 20px;
    box-shadow: 0 12px 36px rgba(148, 163, 184, .15);
    text-align: right;
    direction: rtl;
    overflow: hidden;
    font-size: 14px;
    font-weight: normal;
}

    .pmg *, .pmg *::before, .pmg *::after {
        box-sizing: border-box;
    }

    /* سایت قانون عمومی برای [hidden] ندارد و display های این فایل آن را خنثی می‌کردند */
    .pmg [hidden] {
        display: none !important;
    }

/* ---------- مراحل ---------- */
.pmg-step {
    padding: 18px;
    border-bottom: 1px solid var(--pmg-line);
}

    .pmg-step:last-of-type {
        border-bottom: 0;
    }

.pmg-step-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.pmg-num {
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--pmg-ink);
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    display: grid;
    place-items: center;
}

.pmg-step-title {
    flex: 1;
    min-width: 0;
}

    .pmg-step-title h3 {
        margin: 0;
        font-size: 15px;
        font-weight: bold;
        color: var(--pmg-ink);
        line-height: 28px;
    }

    .pmg-step-title p {
        margin: 2px 0 0;
        font-size: 12.5px;
        color: var(--pmg-muted);
        font-weight: normal;
        line-height: 1.8;
    }

.pmg-pill {
    flex: none;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--pmg-soft);
    border: 1px solid var(--pmg-line);
    color: var(--pmg-muted);
    white-space: nowrap;
}

    .pmg-pill.is-done {
        background: #e6f7f4;
        border-color: #b8ebe2;
        color: #00806e;
    }

/* ---------- کتابخانه عکس ---------- */
.pmg-lib {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 10px;
}

.pmg-photo {
    position: relative;
    aspect-ratio: 1;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    background: var(--pmg-soft);
    border: 2px solid transparent;
    outline: 1px solid var(--pmg-line);
    transition: transform .12s ease, border-color .15s ease, box-shadow .15s ease;
}

    .pmg-photo img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: top;
        display: block;
    }

    .pmg-photo:hover {
        transform: translateY(-1px);
    }

    .pmg-photo:focus-visible {
        outline: 2px solid var(--pmg-accent);
        outline-offset: 2px;
    }

    .pmg-photo.is-selected {
        border-color: var(--pmg-accent);
        outline-color: transparent;
        box-shadow: 0 0 0 3px var(--pmg-accent-soft);
    }

        .pmg-photo.is-selected::after {
            content: "";
            position: absolute;
            inset: 0;
            background: rgba(79, 70, 229, .14);
            pointer-events: none;
        }

.pmg-check {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--pmg-accent);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    display: none;
    place-items: center;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}

.pmg-photo.is-selected .pmg-check {
    display: grid;
}

.pmg-del {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 0;
    padding: 0;
    background: rgba(15, 23, 43, .65);
    color: #fff;
    font-size: 15px;
    line-height: 24px;
    cursor: pointer;
    z-index: 3;
    opacity: 0;
    transition: opacity .15s ease, background .15s ease;
}

    .pmg-del:hover {
        background: var(--pmg-danger);
    }

.pmg-photo:hover .pmg-del, .pmg-photo:focus-within .pmg-del {
    opacity: 1;
}

@media (hover: none) {
    .pmg-del {
        opacity: 1;
    }
}

/* عکسی که در حال حذف است: لودینگ روی خود عکس و غیرقابل انتخاب */
.pmg-photo.is-deleting {
    cursor: progress;
    transform: none;
}

    .pmg-photo.is-deleting img {
        filter: grayscale(1);
        opacity: .5;
    }

.pmg-deleting {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(15, 23, 43, .45);
    color: #fff;
    font-size: 11px;
    font-weight: bold;
}

    .pmg-deleting .pmg-spinner {
        border-color: rgba(255, 255, 255, .35);
        border-top-color: #fff;
    }

/* خانه افزودن عکس: کنار عکس‌ها و هم‌اندازه آن‌ها، نه یک دکمه بزرگ بالای بخش */
.pmg-add {
    aspect-ratio: 1;
    border-radius: 14px;
    border: 1.5px dashed #cbd5e1;
    background: #fff;
    color: var(--pmg-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}

    .pmg-add:hover, .pmg-add:focus-visible {
        border-color: var(--pmg-accent);
        color: var(--pmg-accent);
        background: var(--pmg-accent-soft);
        outline: none;
    }

    .pmg-add b {
        font-size: 24px;
        line-height: 1;
        font-weight: normal;
    }

    /* کتابخانه پر: کمرنگ، ولی قابل کلیک تا پیام حذف عکس نمایش داده شود */
    .pmg-add.is-full {
        opacity: .55;
        background: var(--pmg-soft);
    }

        .pmg-add.is-full:hover, .pmg-add.is-full:focus-visible {
            opacity: .8;
            border-color: #cbd5e1;
            color: var(--pmg-muted);
            background: var(--pmg-soft);
        }

.pmg-uploading {
    aspect-ratio: 1;
    border-radius: 14px;
    background: var(--pmg-soft);
    border: 1px solid var(--pmg-line);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: var(--pmg-muted);
    position: relative;
    overflow: hidden;
}

    .pmg-uploading .bar {
        position: absolute;
        bottom: 0;
        right: 0;
        height: 4px;
        background: var(--pmg-accent);
        transition: width .2s ease;
    }

.pmg-spinner {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2.5px solid var(--pmg-line);
    border-top-color: var(--pmg-accent);
    animation: pmg-spin .8s linear infinite;
}

@keyframes pmg-spin {
    to {
        transform: rotate(360deg);
    }
}

/* وقتی هنوز عکسی آپلود نشده */
.pmg-empty {
    grid-column: 1 / -1;
    border: 1.5px dashed #cbd5e1;
    border-radius: 16px;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    cursor: pointer;
    background: var(--pmg-soft);
    font: inherit;
    color: var(--pmg-ink);
    width: 100%;
}

    .pmg-empty:hover, .pmg-empty:focus-visible {
        border-color: var(--pmg-accent);
        background: var(--pmg-accent-soft);
        outline: none;
    }

    .pmg-empty .icon {
        width: 46px;
        height: 46px;
        border-radius: 50%;
        background: var(--pmg-accent);
        color: #fff;
        font-size: 26px;
        display: grid;
        place-items: center;
    }

    .pmg-empty strong {
        font-size: 14px;
    }

    .pmg-empty span {
        font-size: 12.5px;
        color: var(--pmg-muted);
        max-width: 40ch;
        line-height: 1.8;
    }

.pmg-lib-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    font-size: 12px;
    color: var(--pmg-muted);
}

.pmg-link {
    background: none;
    border: 0;
    padding: 0;
    color: var(--pmg-accent);
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* دکمه کتابخانه عکس‌ها (حالت پنجره‌ای): بزرگ و واضح تا دیده شود */
.pmg-picked + .pmg-lib-foot {
    flex-wrap: wrap;
    margin-top: 14px;
}

.pmg [data-pmg-open-lib] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 20px;
    border: 1.5px solid var(--pmg-accent);
    border-radius: 12px;
    background: var(--pmg-accent-soft);
    color: var(--pmg-accent);
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}

    .pmg [data-pmg-open-lib]::before {
        content: "🖼️";
        font-size: 18px;
        line-height: 1;
    }

    .pmg [data-pmg-open-lib]:hover {
        background: var(--pmg-accent);
        color: #fff;
    }

    .pmg [data-pmg-open-lib]:focus-visible {
        outline: 3px solid var(--pmg-accent-soft);
        outline-offset: 2px;
    }

    .pmg [data-pmg-open-lib] [data-pmg-libcap] {
        font-weight: normal;
        font-size: 12.5px;
    }

@media (max-width: 480px) {
    .pmg [data-pmg-open-lib] {
        width: 100%;
    }
}

.pmg-login {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px;
    border-radius: 14px;
    background: var(--pmg-soft);
    border: 1px solid var(--pmg-line);
    font-size: 13px;
    color: var(--pmg-muted);
}

/* ---------- شخصی‌سازی (متغیرها و حجاب) ---------- */
.pmg #variables {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin: 0;
    width: 100%;
    direction:ltr;
}

    .pmg #variables label {
        display: flex;
        flex-direction: column;
        gap: 4px;
        margin: 0;
        width: auto;
        color: var(--pmg-muted);
        font-size: 12px;
        direction: ltr;
        text-align: left;
    }

        .pmg #variables label span {
            text-transform: uppercase;
            font-weight: bold;
            letter-spacing: .03em;
        }

    .pmg #variables input {
        width: 100%;
        height: 42px;
        border-radius: 12px;
        border: 1px solid var(--pmg-line);
        background: #fff;
        padding: 0 12px;
        font: inherit;
        font-size: 14px;
        color: var(--pmg-ink);
        text-align: center;
        direction: auto;
    }

        .pmg #variables input:focus {
            outline: none;
            border-color: var(--pmg-accent);
            box-shadow: 0 0 0 3px var(--pmg-accent-soft);
        }

.pmg-hijab {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

    .pmg-hijab .HijabSelection {
        margin: 0;
        padding: 8px 14px;
        border-radius: 999px;
        border: 1px solid var(--pmg-line);
        background: #fff;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        width: auto;
    }

        .pmg-hijab .HijabSelection p {
            margin: 0;
            font-size: 13px;
            color: var(--pmg-ink);
        }

        .pmg-hijab .HijabSelection.active {
            border-color: var(--pmg-accent);
            background: var(--pmg-accent-soft);
        }

.pmg-note {
    font-size: 12px;
    color: var(--pmg-muted);
    line-height: 1.8;
    margin: 0;
}

/* ---------- انتخاب مدل ---------- */
.pmg-engines {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pmg-engine {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    border: 1.5px solid var(--pmg-line);
    background: #fff;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
    text-align: right;
    width: 100%;
    font: inherit;
    color: inherit;
}

    .pmg-engine:hover {
        border-color: #cbd5e1;
    }

    .pmg-engine:focus-visible {
        outline: 2px solid var(--pmg-accent);
        outline-offset: 2px;
    }

    .pmg-engine.is-selected {
        border-color: var(--pmg-accent);
        background: var(--pmg-accent-soft);
        box-shadow: 0 0 0 3px rgba(79, 70, 229, .08);
    }

    .pmg-engine.is-disabled {
        opacity: .5;
        cursor: not-allowed;
    }

.pmg-engine-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--pmg-soft);
    border: 1px solid var(--pmg-line);
    display: grid;
    place-items: center;
    font-size: 18px;
}

.pmg-engine-body {
    min-width: 0;
}

.pmg-engine-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: bold;
}

.pmg-tag {
    font-size: 10.5px;
    font-weight: normal;
    padding: 1px 8px;
    border-radius: 999px;
}

    .pmg-tag.warn {
        background: #fff7e6;
        color: #8a5a00;
    }

    .pmg-tag.off {
        background: #fee2e2;
        color: #991b1b;
    }

.pmg-engine-desc {
    font-size: 12px;
    color: var(--pmg-muted);
    margin-top: 2px;
    line-height: 1.7;
}

.pmg-engine-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.pmg-price {
    font-size: 12px;
    font-weight: bold;
    color: #00806e;
    background: #e6f7f4;
    border-radius: 999px;
    padding: 2px 10px;
    white-space: nowrap;
}

.pmg-radio {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    display: grid;
    place-items: center;
}

.pmg-engine.is-selected .pmg-radio {
    border-color: var(--pmg-accent);
}

    .pmg-engine.is-selected .pmg-radio::after {
        content: "";
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: var(--pmg-accent);
    }

/* ---------- تنظیمات خروجی (رزولوشن و اندازه) ---------- */
.pmg-out {
    display: grid;
    gap: 18px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--pmg-line);
}

.pmg-out-label {
    font-size: 12.5px;
    font-weight: bold;
    color: var(--pmg-ink);
    margin-bottom: 8px;
}

/* کیفیت: کنترل چندبخشی */
.pmg-seg {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 14px;
    background: #f1f5f9;
    border: 1px solid var(--pmg-line);
}

.pmg-seg-btn {
    flex: 1 1 0;
    min-width: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 8px 6px;
    /* کادر کمرنگ تا برچسب هزینه اضافه معلوم باشد مال کدام گزینه است */
    border: 1px solid #dfe5ee;
    border-radius: 10px;
    background: rgba(255, 255, 255, .55);
    color: var(--pmg-muted);
    font: inherit;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

    .pmg-seg-btn b {
        font-size: 15px;
        color: var(--pmg-ink);
        direction: ltr;
    }

    .pmg-seg-btn span {
        font-size: 11px;
    }

    .pmg-seg-btn em {
        position: absolute;
        top: -8px;
        left: 6px;
        font-style: normal;
        font-size: 10px;
        font-weight: bold;
        padding: 1px 7px;
        border-radius: 999px;
        background: #fff7e6;
        color: #8a5a00;
        border: 1px solid #fde7b0;
        white-space: nowrap;
    }

    .pmg-seg-btn:hover {
        color: var(--pmg-ink);
        border-color: #cbd5e1;
        background: #fff;
    }

    .pmg-seg-btn:focus-visible {
        outline: 2px solid var(--pmg-accent);
        outline-offset: 1px;
    }

    .pmg-seg-btn.is-selected {
        border-color: transparent;
        background: #fff;
        color: var(--pmg-accent);
        box-shadow: 0 1px 3px rgba(15, 23, 43, .12), 0 0 0 1.5px var(--pmg-accent);
    }

        .pmg-seg-btn.is-selected b {
            color: var(--pmg-accent);
        }

/* اندازه: کاشی با پیش‌نمایش قاب */
.pmg-ratios {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 8px;
}

.pmg-ratio {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px 8px;
    border-radius: 14px;
    border: 1.5px solid var(--pmg-line);
    background: #fff;
    font: inherit;
    color: var(--pmg-ink);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

    .pmg-ratio:hover {
        border-color: #cbd5e1;
    }

    .pmg-ratio:focus-visible {
        outline: 2px solid var(--pmg-accent);
        outline-offset: 2px;
    }

.pmg-ratio-frame {
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pmg-frame {
    display: block;
    border: 2px solid #94a3b8;
    border-radius: 4px;
    background: #f1f5f9;
    transition: border-color .15s ease, background .15s ease;
}

.pmg-frame-auto {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: bold;
    color: #94a3b8;
    border-style: dashed;
}

.pmg-ratio-name {
    font-size: 12px;
    font-weight: bold;
}

.pmg-ratio-val {
    font-size: 11px;
    color: var(--pmg-muted);
    direction: ltr;
}

.pmg-ratio.is-selected {
    border-color: var(--pmg-accent);
    background: var(--pmg-accent-soft);
}

    .pmg-ratio.is-selected .pmg-frame {
        border-color: var(--pmg-accent);
        background: rgba(79, 70, 229, .15);
    }

    .pmg-ratio.is-selected .pmg-frame-auto {
        color: var(--pmg-accent);
    }

    .pmg-ratio.is-selected .pmg-ratio-val {
        color: var(--pmg-accent);
    }

/* برچسب گزینه پیش‌فرض */
.pmg-ratio {
    position: relative;
}

.pmg-default-tag {
    position: absolute;
    top: -8px;
    right: 6px;
    font-style: normal;
    font-size: 9.5px;
    font-weight: bold;
    line-height: 1.6;
    padding: 0 7px;
    border-radius: 999px;
    background: #e6f7f4;
    color: #00796a;
    border: 1px solid #b4e9e0;
    white-space: nowrap;
    pointer-events: none;
}

/* راهنمای انتخاب کیفیت */
.pmg-hint {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, #f5f3ff 0%, #eef0ff 100%);
    border: 1px solid #e0e0fb;
    color: #3730a3;
    font-size: 12px;
    line-height: 1.9;
    transition: background .25s ease, border-color .25s ease, color .25s ease, box-shadow .25s ease;
}

.pmg-hint-icon {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #fff;
    color: var(--pmg-accent);
    box-shadow: 0 1px 3px rgba(15, 23, 43, .08);
    transition: color .25s ease;
}

.pmg-hint-text b {
    display: block;
    font-size: 12.5px;
    color: inherit;
}

.pmg-hint.is-active {
    background: linear-gradient(135deg, #fffbeb 0%, #fff4dc 100%);
    border-color: #fcd98a;
    color: #8a5a00;
    box-shadow: 0 6px 18px rgba(245, 158, 11, .14);
    animation: pmg-hint-pop .35s ease;
}

    .pmg-hint.is-active .pmg-hint-icon {
        color: #d97706;
    }

@keyframes pmg-hint-pop {
    0% { transform: scale(.98); }
    60% { transform: scale(1.01); }
    100% { transform: scale(1); }
}

/* ---------- دکمه نهایی ---------- */
.pmg-cta {
    padding: 16px 18px 18px;
    background: var(--pmg-soft);
    border-top: 1px solid var(--pmg-line);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pmg-btn {
    width: 100%;
    height: 52px;
    border: 0;
    border-radius: 14px;
    background: var(--pmg-ink);
    color: #fff;
    font: inherit;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform .12s ease, opacity .15s ease;
}

    .pmg-btn:hover {
        opacity: .92;
    }

    .pmg-btn:active {
        transform: scale(.99);
    }

    .pmg-btn:focus-visible {
        outline: 3px solid var(--pmg-accent-soft);
        outline-offset: 2px;
    }

    .pmg-btn .pmg-btn-price {
        font-size: 13px;
        background: rgba(255, 255, 255, .14);
        border-radius: 999px;
        padding: 3px 10px;
    }

.pmg-cta-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--pmg-muted);
}

@media (max-width: 480px) {
    .pmg-step {
        padding: 14px;
    }

    /* وضعیت انتخاب زیر عنوان بیاید تا توضیح مرحله فشرده نشود */
    .pmg-step-head {
        flex-wrap: wrap;
    }

    .pmg-step-title {
        flex: 1 1 calc(100% - 40px);
    }

    .pmg-pill {
        order: 3;
        margin-inline-start: 40px;
    }

    .pmg-lib {
        grid-template-columns: repeat(3, 1fr);
    }

    .pmg-engine {
        gap: 10px;
        padding: 10px;
    }

    .pmg-engine-icon {
        width: 36px;
        height: 36px;
    }

    .pmg-ratios {
        grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
        gap: 6px;
    }

    .pmg-ratio {
        padding: 8px 4px 6px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pmg-spinner {
        animation-duration: 2s;
    }

    .pmg-photo, .pmg-btn {
        transition: none;
    }

    .pmg-hint.is-active {
        animation: none;
    }
}

/* ---------- متن پرامپت (صفحه هوش مصنوعی) ---------- */
.pmg-textarea {
    width: 100%;
    min-height: 130px;
    resize: vertical;
    border-radius: 14px;
    border: 1px solid var(--pmg-line);
    background: var(--pmg-soft);
    padding: 12px 14px;
    font: inherit;
    font-size: 14px;
    line-height: 1.9;
    color: var(--pmg-ink);
}

    .pmg-textarea:focus {
        outline: none;
        border-color: var(--pmg-accent);
        background: #fff;
        box-shadow: 0 0 0 3px var(--pmg-accent-soft);
    }

.pmg-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- کتابخانه در پنجره جدا (صفحه پرامپت، ابزارها و ویدیو) ----------
   در صفحه فقط عکس‌های انتخاب‌شده دیده می‌شوند تا کاربر فکر نکند همه عکس‌های کتابخانه استفاده می‌شوند */
.pmg-picked .pmg-photo {
    cursor: pointer;
}

    /* برداشتن عکس از این ساخت همیشه دیده شود، نه فقط با رفتن ماوس */
    .pmg-picked .pmg-del {
        opacity: 1;
    }

.pmg-change {
    position: absolute;
    right: 0;
    left: 0;
    bottom: 0;
    z-index: 3;
    padding: 4px 0;
    background: rgba(15, 23, 43, .62);
    color: #fff;
    font-size: 11px;
    text-align: center;
}

.pmg-pick-add small {
    font-size: 10.5px;
    color: var(--pmg-muted);
}

.pmg-libmodal {
    position: fixed;
    inset: 0;
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    direction: rtl;
}

    .pmg-libmodal[hidden] {
        display: none !important;
    }

.pmg-libmodal-back {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 43, .5);
}

.pmg-libmodal-box {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(620px, 100%);
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    box-shadow: 0 24px 60px rgba(15, 23, 43, .25);
}

.pmg-libmodal-x {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: var(--pmg-soft);
    color: var(--pmg-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

    .pmg-libmodal-x:hover {
        background: var(--pmg-line);
        color: var(--pmg-ink);
    }

.pmg-libmodal-head {
    padding: 18px 18px 10px 56px;
}

    .pmg-libmodal-head h3 {
        margin: 0 0 4px;
        font-size: 16px;
    }

    .pmg-libmodal-head p {
        margin: 0;
        font-size: 12.5px;
        color: var(--pmg-muted);
        line-height: 1.8;
    }

.pmg-libmodal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px 18px 18px;
}

.pmg-libmodal-foot {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid var(--pmg-line);
    background: var(--pmg-soft);
    font-size: 12px;
    color: var(--pmg-muted);
}

.pmg-libmodal-done {
    min-width: 110px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    background: var(--pmg-ink);
    color: #fff;
    font: inherit;
    font-weight: bold;
    cursor: pointer;
}

body.pmg-libmodal-open {
    overflow: hidden;
}

/* ---------- پنجره تایید نهایی ساخت (window.pmConfirm) ---------- */
.swal2-popup.pmc-popup {
    width: min(440px, calc(100vw - 24px));
    padding: 22px 20px 18px;
    border-radius: 22px;
    font-family: inherit;
    direction: rtl;
}

.pmc-title {
    padding: 0 !important;
    margin: 0 0 14px !important;
    font-size: 19px !important;
    font-weight: bold;
    color: #0f172b !important;
}

.swal2-html-container.pmc-body {
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible;
}

.pmc {
    text-align: right;
    color: #0f172b;
}

/* عکس‌ها: یک عکس بزرگ عمودی؛ چند عکس (تا ۵) کنار هم و شماره‌دار */
.pmc-photos {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.pmc-photo {
    position: relative;
    flex: none;
    margin: 0;
    aspect-ratio: 1;
    border-radius: 14px;
    overflow: hidden;
    background: #f1f5f9;
    box-shadow: 0 0 0 1px #e2e8f0;
}

    .pmc-photo img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: top;
    }

/* یک عکس بزرگ عمودی؛ چند عکس (تا ۵ نفر) کوچک‌تر کنار هم، و در موبایل ردیف دوم وسط‌چین */
.pmc-photos--1 .pmc-photo { width: 150px; aspect-ratio: 4 / 5; }
.pmc-photos--2 .pmc-photo { width: 120px; }
.pmc-photos--3 .pmc-photo { width: 100px; }
.pmc-photos--4 .pmc-photo { width: 78px; }
.pmc-photos--5 .pmc-photo { width: 64px; }

.pmc-num {
    position: absolute;
    bottom: 5px;
    right: 5px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 99px;
    background: #4f46e5;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    line-height: 20px;
    text-align: center;
}

.pmc-count {
    margin: 8px 0 0;
    text-align: center;
    font-size: 12px;
    color: #64748b;
}

/* جزئیات: مدل، کیفیت، اندازه یا مدت */
.pmc-details {
    margin: 16px 0 0;
    padding: 4px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
}

    .pmc-details div {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 8px 0;
        font-size: 13px;
    }

        .pmc-details div + div {
            border-top: 1px dashed #e2e8f0;
        }

    .pmc-details dt {
        color: #64748b;
        font-weight: normal;
    }

    .pmc-details dd {
        margin: 0;
        font-weight: bold;
    }

.pmc-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #eef0ff;
    color: #4f46e5;
    font-size: 13px;
}

    .pmc-price b {
        font-size: 20px;
    }

        .pmc-price b small {
            font-size: 12px;
            font-weight: normal;
        }

.pmc-note {
    margin: 12px 0 0;
    font-size: 12px;
    line-height: 1.9;
    color: #64748b;
    text-align: center;
}

.swal2-actions.pmc-actions {
    width: 100%;
    margin: 18px 0 0;
    gap: 8px;
    flex-wrap: nowrap;
}

.pmc-btn {
    flex: 1 1 0;
    height: 48px;
    margin: 0;
    border: 0;
    border-radius: 14px;
    font-family: inherit;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity .15s ease, background .15s ease;
}

.pmc-btn--primary {
    flex-grow: 2;
    background: #0f172b;
    color: #fff;
}

    .pmc-btn--primary:hover {
        opacity: .9;
    }

.pmc-btn--ghost {
    background: #f1f5f9;
    color: #475569;
}

    .pmc-btn--ghost:hover {
        background: #e2e8f0;
    }

.pmc-btn:focus-visible {
    outline: 3px solid #c7d2fe;
    outline-offset: 2px;
}
