/* ==========================================================================
   ۱. توکن‌های طراحی و تنظیمات پایه (کاملاً ایزوله شده)
   ========================================================================== */
:root {
    --pdl-font-persian: inherit;
    --pdl-clr-primary: #3498db;
    --pdl-clr-primary-hover: #2980b9;
    --pdl-clr-dark: #2c3e50;
    --pdl-clr-text: #333333;
    --pdl-clr-muted: #7f8c8d;
    --pdl-clr-bg-light: #f8f9fa;
    --pdl-clr-border: #eaedf2;
}

/* ==========================================================================
   ۲. استایل‌های حالت اشتراک غیرفعال (Empty State)
   ========================================================================== */
.pdl-wrapper {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--ink-2);
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    text-align: center;
    margin-bottom: 20px;
    box-sizing: border-box;
    width: 100%;
    font-family: var(--pdl-font-persian);
}

.pdl-empty-state {
    text-align: center;
    padding: 40px 15px;
}

.pdl-empty-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 24px;
    position: relative;
}
.pdl-empty-icon::before {
    content: '';
    position: absolute;
    inset: 8px 12px;
    background: #ededea;
    border-radius: 4px;
    border: 1.5px solid #d8d8d4;
}
.pdl-empty-icon::after {
    content: '';
    position: absolute;
    width: 8px;
    top: 0; bottom: 0;
    right: 8px;
    background: #d8d8d4;
    border-radius: 4px;
}
.pdl-empty-icon-inner {
    position: absolute;
    width: 8px;
    top: 0; bottom: 0;
    left: 8px;
    background: #d8d8d4;
    border-radius: 4px;
    z-index: 1;
}

.pdl-empty-title {
    font-size: 18px;
    color: #e74c3c;
    margin-top: 0;
    margin-bottom: 10px;
    font-weight: bold;
}

.pdl-empty-body {
    font-size: 13px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
    padding: 0 5px;
}

.pdl-empty-cta {
    display: block;
    background: #2c3e50;
    color: #fff !important;
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.3s;
    margin: 0 auto 25px auto;
    max-width: 280px;
    box-sizing: border-box;
}

.pdl-empty-cta:hover {
    background: #81d742;
}

.pdl-empty-plans {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.pdl-empty-plan-pill {
    background: var(--ink-1);
    border: 1px solid var(--ink-2);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.pdl-plan-thumb {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    margin-bottom: 8px;
}
.pdl-plan-thumb--bronze { background: #7d4a14; }
.pdl-plan-thumb--bronze::before, .pdl-plan-thumb--bronze::after { content: ''; position: absolute; border-radius: 50%; border: 2px solid #cd7f32; }
.pdl-plan-thumb--bronze::before { width: 24px; height: 24px; top: 4px; right: 4px; opacity: .7; }
.pdl-plan-thumb--bronze::after { width: 14px; height: 14px; top: 9px; right: 9px; border-color: #e8a050; opacity: 1; }

.pdl-plan-thumb--silver { background: #5a6068; background-image: repeating-linear-gradient( 135deg, transparent, transparent 4px, rgba(255,255,255,.18) 4px, rgba(255,255,255,.18) 8px ); }
.pdl-plan-thumb--silver::before { content: ''; position: absolute; width: 16px; height: 16px; top: 8px; right: 8px; border-radius: 50%; background: #bec3c8; opacity: .9; }

.pdl-plan-thumb--gold { background: #8a6200; }
.pdl-plan-thumb--gold::before { content: ''; position: absolute; inset: -2px; background: conic-gradient( from 0deg, #f0c040 0deg 30deg, #8a6200 30deg 60deg, #f0c040 60deg 90deg, #8a6200 90deg 120deg, #f0c040 120deg 150deg, #8a6200 150deg 180deg, #f0c040 180deg 210deg, #8a6200 210deg 240deg, #f0c040 240deg 270deg, #8a6200 270deg 300deg, #f0c040 300deg 330deg, #8a6200 330deg 360deg ); opacity: .85; }
.pdl-plan-thumb--gold::after { content: ''; position: absolute; width: 14px; height: 14px; top: 9px; right: 9px; border-radius: 50%; background: #f0c040; z-index: 1; }

.pdl-empty-plan-pill-name {
    display: block;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--pdl-clr-dark);
}

.pdl-empty-plan-pill-desc {
    font-size: 12px;
    color: #777;
    line-height: 1.4;
}

/* ==========================================================================
   ۳. طراحی لیست دانلودها (کارت‌ها و آکاردئون Mobile-First از 240px)
   ========================================================================== */
.pdl-membership-area {
    font-family: var(--pdl-font-persian);
}

.pdl-membership-area.pdl-custom-downloads {
    margin-top: 20px;
    width: 100%;
    box-sizing: border-box;
}

.pdl-membership-area .pdl-downloads-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

.pdl-membership-area .pdl-dl-item {
    background: #ffffff;
    border: 1px solid var(--pdl-clr-border);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    box-sizing: border-box;
    width: 100%;
}

.pdl-membership-area .pdl-dl-item:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}

.pdl-membership-area .pdl-dl-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    margin-bottom: 15px;
    width: 100%;
}

.pdl-membership-area .pdl-dl-image-link {
    flex-shrink: 0;
    display: inline-block;
}

.pdl-membership-area .pdl-dl-thumb {
    width: 75px;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: block;
}

.pdl-membership-area .pdl-dl-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
}

.pdl-membership-area .pdl-dl-title {
    font-size: 14px;
    margin: 0 0 6px 0;
    line-height: 1.5;
    font-weight: 700;
}

.pdl-membership-area .pdl-dl-title a {
    color: var(--pdl-clr-dark);
    text-decoration: none;
    transition: color 0.3s ease;
    word-break: break-word;
}

.pdl-membership-area .pdl-dl-title a:hover {
    color: var(--pdl-clr-primary);
}

.pdl-membership-area .pdl-dl-author {
    font-size: 12px;
    color: var(--pdl-clr-muted);
    line-height: 1.4;
}

/* ─── اصلاح استایل نام نویسنده‌ها ─── */
.pdl-membership-area .pdl-dl-author a {
    color: var(--pdl-clr-primary);
    text-decoration: none;
    font-weight: 600; /* حالت بولد برای نویسنده لینک‌دار */
    font-style: italic; /* حالت ایتالیک برای نویسنده لینک‌دار */
}

.pdl-membership-area .pdl-dl-author a:hover {
    text-decoration: underline;
}

.pdl-membership-area .pdl-author-plain-text {
    font-style: italic; /* حالت ایتالیک برای نویسنده بدون لینک */
}
/* ─────────────────────────────────── */

.pdl-membership-area .pdl-toggle-btn {
    background: var(--pdl-clr-bg-light);
    color: var(--pdl-clr-dark);
    border: 1px solid var(--pdl-clr-border);
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-top: auto;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    outline: none;
}

.pdl-membership-area .pdl-toggle-btn:hover,
.pdl-membership-area .pdl-toggle-btn.active {
    background: #eef2f5;
    border-color: #d1d8e0;
}

.pdl-membership-area .pdl-dl-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    width: 100%;
    box-sizing: border-box;
}

.pdl-membership-area .pdl-dl-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 12px;
    width: 100%;
    box-sizing: border-box;
}

.pdl-membership-area .pdl-file-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: #2c3e50;
    color: #ffffff !important;
    padding: 11px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 12px;
    text-align: center;
    transition: background 0.3s ease;
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
}

.pdl-membership-area .pdl-file-btn:hover {
    background: #8bc34a;
}

.pdl-membership-area .pdl-format-badge {
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 0.5px;
    margin-right: 8px;
    flex-shrink: 0;
}

/* ==========================================================================
   ۴. طراحی صفحه‌بندی (Pagination)
   ========================================================================== */
.pdl-membership-area .pdl-pagination {
    margin-top: 25px;
    text-align: center;
    width: 100%;
}

.pdl-membership-area .pdl-pagination ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: inline-flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.pdl-membership-area .pdl-pagination li a,
.pdl-membership-area .pdl-pagination li span {
    display: inline-block;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid var(--pdl-clr-border);
    border-radius: 6px;
    color: var(--pdl-clr-text);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s ease;
    min-width: 35px;
    box-sizing: border-box;
}

.pdl-membership-area .pdl-pagination li a:hover {
    background: var(--pdl-clr-bg-light);
    border-color: #d1d8e0;
}

.pdl-membership-area .pdl-pagination li span.current {
    background: var(--pdl-clr-primary);
    color: #fff;
    border-color: var(--pdl-clr-primary);
}

/* ==========================================================================
   ۵. نقاط شکست واکنش‌گرا (Media Queries)
   ========================================================================== */
@media (min-width: 480px) {
    .pdl-wrapper {
        padding: 25px;
    }
    .pdl-empty-title {
        font-size: 20px;
    }
    .pdl-empty-plans {
        grid-template-columns: repeat(3, 1fr);
    }
    .pdl-empty-cta {
        display: inline-block;
    }
    .pdl-membership-area .pdl-dl-header {
        flex-direction: row;
        text-align: right;
        align-items: flex-start;
        gap: 16px;
    }
    .pdl-membership-area .pdl-dl-title {
        font-size: 15px;
    }
}

@media (min-width: 768px) {
    .pdl-membership-area .pdl-downloads-wrapper {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    .pdl-membership-area .pdl-dl-item {
        padding: 20px;
    }
    .pdl-membership-area .pdl-dl-title {
        font-size: 16px;
    }
    .pdl-membership-area .pdl-file-btn {
        font-size: 13px;
        padding: 12px 16px;
    }
}

/* ==========================================================================
   ۶. انیمیشن جذاب هاور (Hover Effect)
   ========================================================================== */
.pdl-membership-area .pdl-dl-image-link {
    perspective: 1000px;
    display: inline-block;
    overflow: visible;
}

.pdl-membership-area .pdl-dl-thumb {
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), 
                box-shadow 0.4s cubic-bezier(0.25, 1, 0.5, 1), 
                filter 0.4s ease;
    will-change: transform, box-shadow;
}

.pdl-membership-area .pdl-dl-image-link:hover .pdl-dl-thumb {
    transform: translateY(-8px) rotateX(4px) scale(1.03);
    box-shadow: 0 15px 30px rgba(44, 62, 80, 0.22);
    filter: brightness(1.05);
}

.pdl-membership-area .pdl-dl-image-link:active .pdl-dl-thumb {
    transform: translateY(-2px) scale(0.98);
    box-shadow: 0 5px 10px rgba(44, 62, 80, 0.15);
}

.pdl-notice {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eaedf2;
    color: #555;
    font-family: var(--pdl-font-persian);
}


/* ==========================================================================
   ۷. دکمه‌های جدید Group B — ایزوله با پیشوند pdl2-
   *** هیچ کد اصلی بالا حذف یا تغییر نکرده — فقط افزودنی ***
   *** Zero original selectors removed or renamed — APPENDED ONLY ***
   ========================================================================== */

/* ─── دکمه «دانلود تمامی فایل‌ها» ─── */
/* معادل Group A: .papyrus-download-all-btn — کاملاً ایزوله، بدون هیچ تداخلی */
.pdl2-download-all-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    background: #e67e22;
    color: #ffffff !important;
    padding: 13px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    text-align: center;
    font-family: var(--pdl-font-persian);
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    line-height: 1.5;
    outline: none;
}

.pdl2-download-all-btn:hover {
    background: #d35400;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(230, 126, 34, 0.4);
}

.pdl2-download-all-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ─── دکمه «گزارش لینک‌های معیوب» ─── */
/* معادل Group A: .papyrus-report-btn — کاملاً ایزوله، بدون هیچ تداخلی */
.pdl2-report-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    background: #e74c3c;
    color: #ffffff !important;
    padding: 13px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    text-align: center;
    font-family: var(--pdl-font-persian);
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    line-height: 1.5;
    outline: none;
    margin-top: 0;
}

.pdl2-report-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.pdl2-report-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ─── واکنش‌گرایی دکمه‌های pdl2- از 480px به بالا ─── */
@media (min-width: 480px) {
    .pdl2-download-all-btn,
    .pdl2-report-btn {
        font-size: 14px;
        padding: 14px 16px;
        border-radius: 9px;
    }
}

@media (min-width: 768px) {
    .pdl2-download-all-btn,
    .pdl2-report-btn {
        font-size: 14px;
        padding: 14px 18px;
        border-radius: 10px;
    }
}

/* ─── عرض‌های بسیار کم: 240px – 500px ─── */
@media (max-width: 500px) {
    .pdl2-download-all-btn,
    .pdl2-report-btn {
        font-size: 12px !important;
        padding: 10px 8px !important;
        border-radius: 8px !important;
        line-height: 1.5 !important;
    }
}

/* ─── باریک‌ترین صفحه‌ها: 240px – 350px ─── */
@media (max-width: 350px) {
    .pdl2-download-all-btn,
    .pdl2-report-btn {
        font-size: 11px !important;
        padding: 8px 6px !important;
        border-radius: 6px !important;
    }
}

/* ==========================================================================
   ۸. اصلاح جایگاه دکمه حذف لینک (papyrus-remove-input-btn) در مودال Group B
   مشکل: flex-wrap: wrap در custom-style.css باعث می‌شد دکمه − به خط بعد برود.
   راه‌حل: بازنویسی کنترل‌شده فقط داخل دیالوگ‌های Group B.
   *** هیچ کد اصلی بالا حذف یا تغییر نکرده — فقط افزودنی ***
   ========================================================================== */

/* اطمینان از اینکه سطر لینک همیشه یک‌خطی (nowrap) است */
.papyrus-dialog-modal .papyrus-link-input-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;   /* لغو flex-wrap: wrap که در custom-style.css تنظیم شده */
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin-bottom: 4px;
}

/* فیلد ورودی لینک: تمام عرض باقی‌مانده را می‌گیرد */
.papyrus-dialog-modal .papyrus-link-input-row .papyrus-report-field.broken-link-input,
.papyrus-dialog-modal .papyrus-link-input-row .papyrus-report-field.pdl2-broken-link-input {
    flex: 1 1 0% !important;
    text-align: left;
    min-width: 0 !important;        /* جلوگیری از overflow فیلد متن */
    margin-bottom: 0 !important;    /* حذف margin پایین که در custom-style.css باعث فاصله می‌شد */
    width: auto !important;
}

/* دکمه حذف: اندازه ثابت، هیچ‌وقت shrink نمی‌شود */
.papyrus-dialog-modal .papyrus-link-input-row .papyrus-remove-input-btn {
    flex: 0 0 30px !important;
    width: 30px !important;
    height: 30px !important;
    margin-bottom: 0 !important;
    align-self: center !important;
}

/* پیام خطا — به عنوان المان مستقل بعد از .papyrus-link-input-row درج می‌شود (نه داخل آن)
   بنابراین دیگر نیازی به flex tricks نیست — فقط display: block کافی است */
.papyrus-dialog-modal .papyrus-input-error-msg {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    color: #e74c3c !important;
    font-size: 11px !important;
    margin-top: 3px !important;
    margin-bottom: 6px !important;
    padding-right: 4px;
    line-height: 1.4;
}