/* =========================================================
   Legacy .tabber  →  same look as .yaghut-quote-tabs
   HTML: .tabber > header.tabber__header + section.tabber__section > article.tabber__panel[data-title]
   دکمه‌های تب را legacy-tabber.js از روی data-title می‌سازد.
   بدون JS: همه پنل‌ها زیر هم و با عنوان نمایش داده می‌شوند.
   ========================================================= */

.tabber {
    direction: rtl;
    width: 100%;
    margin: 1.5rem 0;
    padding: 0.6rem;
    color: inherit;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

/* ---------- نوار عنوان تب‌ها (ساخته‌شده با JS) ---------- */
.tabber .tabber__header {
    display: flex;
    align-items: stretch;
    gap: 0.6rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

.tabber:not(.is-enhanced) .tabber__header {
    display: none;
}

.tabber .tabber__tab {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: max-content;
    margin: 0;
    padding: 0.85rem 1.15rem;
    font: inherit;
    font-weight: 500;
    line-height: 1.8;
    text-align: center;
    color: #1e2a5a;
    cursor: pointer;
    background: #edf1f5;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0.6rem 0.6rem 0 0;
    transition: color .2s ease, background-color .2s ease, border-color .2s ease;
}

.tabber .tabber__tab:hover {
    background: #e3e9f0;
}

.tabber .tabber__tab.is-active {
    color: #b0124f;
    font-weight: 700;
    background: #fbe4ea;
    border-bottom-color: #c2185b;
}

.tabber .tabber__tab:focus-visible {
    outline: 2px solid #c2185b;
    outline-offset: 2px;
}

/* ---------- بدنه ---------- */
.tabber .tabber__section {
    position: relative;
    margin-top: 0.6rem;
    padding: 1.5rem 1.5rem 1.25rem;
    background: #f6f7fb;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    line-height: 2;
    overflow-wrap: anywhere;
}

/* علامت نقل‌قول */
.tabber .tabber__section::before {
    content: "\201D";
    position: absolute;
    top: 0.2rem;
    right: 1.1rem;
    font-family: Georgia, serif;
    font-size: 4rem;
    line-height: 1;
    color: #f4a6bf;
    pointer-events: none;
}

.tabber .tabber__panel {
    margin-top: 1.6rem;
    padding-inline-start: 1rem;
    border-inline-start: 3px solid #d6336c;
    max-height: 30rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #d6336c55 transparent;
    -webkit-overflow-scrolling: touch;
}

.tabber .tabber__panel::-webkit-scrollbar { width: 6px; }
.tabber .tabber__panel::-webkit-scrollbar-thumb {
    background: #d6336c55;
    border-radius: 999px;
}

.tabber .tabber__panel[hidden] { display: none !important; }

/* بدون JS: عنوان هر پنل از data-title و پنل‌ها زیر هم */
.tabber:not(.is-enhanced) .tabber__panel + .tabber__panel {
    margin-top: 1.75rem;
}
.tabber:not(.is-enhanced) .tabber__panel::before {
    content: attr(data-title);
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: #b0124f;
}

/* ---------- محتوای داخل پنل ---------- */
.tabber .tabber__panel > :first-child { margin-top: 0; }
.tabber .tabber__panel > :last-child  { margin-bottom: 0; }

.tabber .textq,
.tabber .scroller {
    max-height: none;
    overflow: visible;
}

.tabber .box-goftavard {
    margin: 0 0 0.75rem;
}

.tabber .tabber__panel p {
    margin: 0 0 0.75rem;
}

/* پرسش‌وپاسخ‌ها (dl > dd > dl > dd) بدون تورفتگی زیاد */
.tabber .tabber__panel dl,
.tabber .tabber__panel dd {
    margin: 0;
    padding: 0;
}

.tabber .tabber__panel dl dl {
    padding-inline-start: 0.9rem;
    margin-bottom: 0.5rem;
    border-inline-start: 2px solid #f4a6bf66;
}

/* جدول‌های خالیِ باقی‌مانده از قالب قدیمی و پاراگراف‌های خالی */
.tabber .tabber__panel table.tableWikiYaghut:has(td > p:only-child:empty),
.tabber .tabber__panel .mw-empty-elt {
    display: none;
}

/* ---------- موبایل: تب‌ها زیر هم ---------- */
@media (max-width: 768px) {
    .tabber { padding: 0.5rem; border-radius: 0.85rem; }

    .tabber .tabber__header {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 0.4rem;
        overflow: visible;
    }

    .tabber .tabber__tab {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
        justify-content: flex-start;
        padding: 0.7rem 0.9rem;
        font-size: 0.95rem;
        line-height: 1.7;
        text-align: right;
        border-radius: 0.6rem;
    }

    .tabber .tabber__section {
        margin-top: 0.5rem;
        padding: 1.1rem 0.85rem 0.9rem;
        border-radius: 0.65rem;
        line-height: 1.95;
        font-size: 0.95rem;
    }

    .tabber .tabber__section::before {
        top: 0.1rem;
        right: 0.75rem;
        font-size: 3rem;
    }

    .tabber .tabber__panel {
        margin-top: 1.3rem;
        padding-inline-start: 0.75rem;
        max-height: min(22rem, 60vh);
    }
}
