/* ===== منتقل‌شده از CSS اسکوپ‌شده‌ی Blazor: TripleMadoleTabs.razor.css =====
   اکنون سراسری است؛ برای حفظ همان اولویت قبلی (specificity) انتخاب‌گرها ایمن‌سازی شده‌اند. */
/* ==========================================================
   کادر سه‌تبه‌ی انتهای صفحه‌ی اصلی (TripleMadoleManagement)
   - فقط از ویژگی‌های منطقی (inline-start/end) استفاده شده تا RTL و LTR خودکار درست کار کند
   - رنگ‌ها از متغیرهای app.css (پالت نیلی-بنفش) می‌آیند
   ========================================================== */

.tm-section.tm-section {
    width: 100%;
    padding: 30px 3% 14px;
    box-sizing: border-box;
}

/* ---------- کادر اصلی ---------- */
.tm-card.tm-card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    max-width: 1120px;
    margin: 0 auto;
    padding: 36px 30px 30px;
    box-sizing: border-box;
    border: 1px solid transparent;
    border-radius: 28px;
    /* حاشیه‌ی گرادیانی: پس‌زمینه‌ی داخلی روی padding-box و گرادیان روی border-box */
    background: linear-gradient(180deg, #ffffff 0%, #fbfaff 100%) padding-box, linear-gradient(135deg, var(--color-primary-light, #a5b4fc), var(--color-accent-light, #c4b5fd) 45%, rgba(99, 102, 241, .15)) border-box;
    box-shadow: 0 10px 30px rgba(99, 102, 241, .14), 0 34px 60px -34px rgba(99, 102, 241, .45);
}

/* ظهور نرم هنگام رسیدن اسکرول به کادر (فقط مرورگرهایی که پشتیبانی می‌کنند) */
@supports (animation-timeline: view()) {
    .tm-card.tm-card {
        animation: tm-reveal linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 40%;
    }
}

@keyframes tm-reveal {
    from {
        opacity: 0;
        transform: translateY(44px) scale(.97);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ---------- حباب‌های رنگی شناور پشت کادر ---------- */
.tm-orb.tm-orb {
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    filter: blur(58px);
    opacity: .55;
    pointer-events: none;
}

.tm-orb-a.tm-orb-a {
    width: 280px;
    height: 280px;
    top: -100px;
    inset-inline-start: -70px;
    background: radial-gradient(circle, var(--color-accent-light, #c4b5fd), transparent 70%);
    animation: tm-float 14s ease-in-out infinite;
}

.tm-orb-b.tm-orb-b {
    width: 330px;
    height: 330px;
    bottom: -130px;
    inset-inline-end: -90px;
    background: radial-gradient(circle, var(--color-primary-light, #a5b4fc), transparent 70%);
    animation: tm-float 18s ease-in-out infinite reverse;
}

@keyframes tm-float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(28px, 22px) scale(1.12);
    }
}

/* ---------- سرتیتر ---------- */
.tm-head.tm-head {
    text-align: center;
}

.tm-eyebrow.tm-eyebrow {
    display: inline-block;
    margin-bottom: 10px;
    padding: 4px 16px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    color: #4f46e5;
    background: rgba(99, 102, 241, .10);
}

.tm-title.tm-title {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.6;
    color: #4338ca; /* پشتیبان؛ اگر گرادیان متن پشتیبانی نشد */
    background: var(--gradient-primary, linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tm-sub.tm-sub {
    margin: 0;
    font-size: 14.5px;
    color: #6b7280;
}

/* ---------- نوار تب‌ها (کنترل قطعه‌ای با قرص متحرک) ---------- */
.tm-tablist.tm-tablist {
    --tm-pad: 6px;
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--tm-n, 3), minmax(0, 1fr));
    max-width: 780px;
    margin: 26px auto 26px;
    padding: var(--tm-pad);
    box-sizing: border-box;
    border-radius: 20px;
    border: 1px solid rgba(99, 102, 241, .16);
    background: rgba(99, 102, 241, .08);
    box-shadow: inset 0 1px 4px rgba(67, 56, 202, .08);
}

/* قرص گرادیانی که زیر تب فعال می‌لغزد؛ موقعیتش با inline-start در RTL/LTR درست می‌شود */
.tm-pill.tm-pill {
    position: absolute;
    top: var(--tm-pad);
    bottom: var(--tm-pad);
    z-index: 0;
    width: calc((100% - 2 * var(--tm-pad)) / var(--tm-n, 3));
    inset-inline-start: calc(var(--tm-pad) + var(--tm-i, 0) * (100% - 2 * var(--tm-pad)) / var(--tm-n, 3));
    border-radius: 15px;
    background: var(--gradient-button, linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%));
    box-shadow: 0 8px 22px rgba(99, 102, 241, .40), inset 0 1px 0 rgba(255, 255, 255, .28);
    transition: inset-inline-start .55s cubic-bezier(.34, 1.36, .64, 1);
}

.tm-tab.tm-tab {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 0;
    min-height: 54px;
    padding: 8px 12px;
    border: 0;
    border-radius: 15px;
    background: transparent;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    color: #4338ca;
    cursor: pointer;
    transition: color .3s ease, background-color .3s ease;
    -webkit-tap-highlight-color: transparent;
}

    .tm-tab.tm-tab:focus-visible {
        outline: 3px solid var(--color-focus-ring, #a5b4fc);
        outline-offset: 2px;
    }

.tm-tab.is-active.is-active {
    color: #fff;
}

.tm-tab-name.tm-tab-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- ناحیه‌ی محتوای تب ---------- */
.tm-panel.tm-panel {
    min-height: 340px; /* کادر با عوض‌شدن تب‌ها بالا و پایین نمی‌پرد */
    outline: none;
}

    .tm-panel.tm-panel:focus-visible {
        outline: 3px solid var(--color-focus-ring, #a5b4fc);
        outline-offset: 4px;
        border-radius: 18px;
    }

.tm-panel-inner.tm-panel-inner {
    animation: tm-panel-in .55s cubic-bezier(.22, 1, .36, 1) backwards;
}

@keyframes tm-panel-in {
    from {
        opacity: 0;
        transform: translateX(var(--tm-slide, 0px));
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.tm-panel-head.tm-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px dashed rgba(99, 102, 241, .28);
}

.tm-panel-title.tm-panel-title {
    margin: 0;
    min-width: 0;
    font-size: 19px;
    font-weight: 800;
    line-height: 1.7;
    color: #164a8a;
    overflow-wrap: anywhere;
}

.tm-panel-count.tm-panel-count {
    flex-shrink: 0;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    color: #4f46e5;
    background: rgba(99, 102, 241, .10);
}

/* ---------- شبکه‌ی آیتم‌ها ---------- */
.tm-grid.tm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    gap: 22px;
}

/* فقط یک آیتم: چیدمان افقی و بزرگ */
.tm-grid.is-single.is-single {
    grid-template-columns: minmax(0, 1fr);
}

.tm-grid.is-single .tm-item.tm-item {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    align-items: center;
}

.tm-grid.is-single .tm-item-media.tm-item-media {
    height: 100%;
    aspect-ratio: 4 / 3;
}

.tm-grid.is-single .tm-item-body.tm-item-body {
    padding: 22px 26px;
}

.tm-grid.is-single .tm-item-title.tm-item-title {
    font-size: 21px;
}

.tm-grid.is-single .tm-item-text.tm-item-text {
    font-size: 15px;
}

/* ---------- کارت هر آیتم ---------- */
.tm-item.tm-item {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--color-border-light, #ddd6fe);
    border-radius: 20px;
    background: #fff;
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(99, 102, 241, .1));
    transition: transform .35s cubic-bezier(.22, 1, .36, 1), box-shadow .35s ease, border-color .35s ease;
    /* ورود پله‌ای: هر کارت کمی دیرتر از قبلی (backwards تا بعد از پایان انیمیشن، hover دوباره کار کند) */
    animation: tm-item-in .65s cubic-bezier(.22, 1, .36, 1) backwards;
    animation-delay: calc(var(--tm-d, 0) * 90ms + 80ms);
}

@keyframes tm-item-in {
    from {
        opacity: 0;
        transform: translateY(26px) scale(.96);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (hover: hover) {
    .tm-item.tm-item:hover {
        transform: translateY(-6px);
        border-color: var(--color-primary-light, #a5b4fc);
        box-shadow: var(--shadow-lg, 0 16px 40px rgba(99, 102, 241, .22));
    }

    .tm-item:hover .tm-item-media.tm-item-media img {
        transform: scale(1.08);
    }

    .tm-item:hover .tm-item-shine.tm-item-shine {
        transform: translateX(130%);
    }
}

.tm-item-media.tm-item-media {
    position: relative;
    margin: 0;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    background: #eef2ff;
}

    .tm-item-media.tm-item-media img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform .9s cubic-bezier(.2, .7, .2, 1);
    }

    /* سایه‌ی ملایم پایین عکس */
    .tm-item-media.tm-item-media::after {
        content: "";
        position: absolute;
        inset: auto 0 0 0;
        height: 42%;
        background: linear-gradient(to top, rgba(30, 27, 75, .26), transparent);
        pointer-events: none;
    }

/* برق عبوری روی عکس هنگام hover */
.tm-item-shine.tm-item-shine {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .45) 50%, transparent 65%);
    transform: translateX(-130%);
    transition: transform .9s ease;
    pointer-events: none;
}

.tm-item-body.tm-item-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    padding: 16px 18px 18px;
    text-align: start;
}

.tm-item-title.tm-item-title {
    position: relative;
    margin: 0;
    padding-inline-start: 14px;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.7;
    color: #1e1b4b;
    overflow-wrap: anywhere;
}

    /* خط رنگی کنار عنوان */
    .tm-item-title.tm-item-title::before {
        content: "";
        position: absolute;
        inset-block: 6px;
        inset-inline-start: 0;
        width: 4px;
        border-radius: 4px;
        background: var(--gradient-primary, linear-gradient(180deg, #6366f1, #a78bfa));
    }

.tm-item-text.tm-item-text {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    font-size: 14px;
    line-height: 2;
    color: #4b5563;
    white-space: normal;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
}

.tm-item-text.is-open.is-open {
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    animation: tm-fade .4s ease backwards;
}

@keyframes tm-fade {
    from {
        opacity: .2;
    }

    to {
        opacity: 1;
    }
}

/* ---------- دکمه‌ی «نمایش بیشتر / کمتر» ---------- */
.tm-item-toggle.tm-item-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    margin-top: auto;
    padding: 6px 14px;
    border: 1px solid rgba(99, 102, 241, .26);
    border-radius: 999px;
    background: rgba(99, 102, 241, .07);
    font: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: #4f46e5;
    cursor: pointer;
    transition: background-color .25s ease, color .25s ease, border-color .25s ease;
    -webkit-tap-highlight-color: transparent;
}

    .tm-item-toggle.tm-item-toggle:hover {
        color: #fff;
        border-color: transparent;
        background: var(--gradient-button, linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%));
    }

    .tm-item-toggle.tm-item-toggle:focus-visible {
        outline: 3px solid var(--color-focus-ring, #a5b4fc);
        outline-offset: 2px;
    }

/* فلش کوچک (با border فیزیکی، چون چرخش‌اش به جهت متن وابسته نیست) */
.tm-chev.tm-chev {
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .3s ease;
}

.tm-chev.is-up.is-up {
    transform: rotate(-135deg) translate(-1px, -1px);
}

/* ---------- تبلت و موبایل ---------- */
@media (max-width: 768px) {
    .tm-section.tm-section {
        padding: 18px 12px 6px;
    }

    .tm-card.tm-card {
        padding: 24px 14px 16px;
        border-radius: 22px;
    }

    .tm-title.tm-title {
        font-size: 21px;
    }

    .tm-sub.tm-sub {
        font-size: 13px;
    }

    .tm-tablist.tm-tablist {
        margin: 18px 0 18px;
        border-radius: 16px;
    }

    .tm-pill.tm-pill {
        border-radius: 12px;
    }

    /* در موبایل نام تب در مرکز (تا سه تب در یک ردیف جا شوند) */
    .tm-tab.tm-tab {
        flex-direction: column;
        gap: 4px;
        min-height: 66px;
        padding: 8px 4px;
        border-radius: 12px;
        font-size: 12.5px;
        line-height: 1.5;
    }

    .tm-tab-name.tm-tab-name {
        display: -webkit-box;
        white-space: normal;
        text-align: center;
        overflow-wrap: anywhere;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .tm-panel.tm-panel {
        min-height: 0;
    }

    .tm-panel-title.tm-panel-title {
        font-size: 17px;
    }

    .tm-grid.tm-grid {
        gap: 14px;
    }

    .tm-item.tm-item {
        border-radius: 16px;
    }

    .tm-item-body.tm-item-body {
        padding: 14px 14px 16px;
    }

    .tm-item-title.tm-item-title {
        font-size: 16px;
    }

    .tm-item-text.tm-item-text {
        font-size: 13.5px;
    }

    .tm-grid.is-single .tm-item.tm-item {
        display: flex;
    }

    .tm-grid.is-single .tm-item-media.tm-item-media {
        height: auto;
        aspect-ratio: 16 / 10;
    }

    .tm-grid.is-single .tm-item-body.tm-item-body {
        padding: 14px 14px 16px;
    }

    .tm-grid.is-single .tm-item-title.tm-item-title {
        font-size: 17px;
    }

    .tm-grid.is-single .tm-item-text.tm-item-text {
        font-size: 13.5px;
    }
}

/* صفحه‌ی نمایش بزرگ‌تر از تبلت: ارتفاع کادر محدود و داخل خودش اسکرول می‌شود */
@media (min-width: 769px) {
    .tm-panel.tm-panel {
        max-height: 640px;
        overflow-y: auto;
        padding: 6px 8px 10px;
        scrollbar-width: thin;
        scrollbar-color: var(--color-primary-light, #a5b4fc) transparent;
    }
}

@media (max-width: 380px) {
    .tm-tab.tm-tab {
        font-size: 11.5px;
    }

    .tm-card.tm-card {
        padding-inline: 10px;
    }
}

/* ---------- کاربرانی که انیمیشن کم می‌خواهند ---------- */
@media (prefers-reduced-motion: reduce) {
    .tm-card.tm-card,
    .tm-orb.tm-orb,
    .tm-panel-inner.tm-panel-inner,
    .tm-item.tm-item,
    .tm-item-text.is-open.is-open {
        animation: none !important;
    }

    .tm-pill.tm-pill,
    .tm-tab.tm-tab,
    .tm-item.tm-item,
    .tm-item-media.tm-item-media img,
    .tm-item-shine.tm-item-shine,
    .tm-chev.tm-chev {
        transition: none !important;
    }
}
