/* ── تیم‌ها (teams) — پیشوند tm- ─────────────────────────── */

.tm-hero {
    position: relative;
    overflow: hidden;
    border: 0;
    border-radius: 20px;
    background: linear-gradient(135deg, #0f766e 0%, #0e7490 55%, rgb(var(--primary-rgb)) 115%);
    color: #fff;
    box-shadow: 0 18px 45px rgba(15, 118, 110, .22);
}

.tm-hero::before,
.tm-hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
}

.tm-hero::before { width: 300px; height: 300px; inset-inline-end: -90px; top: -140px; }
.tm-hero::after { width: 170px; height: 170px; inset-inline-end: 150px; bottom: -110px; }

.tm-hero .card-body { position: relative; z-index: 1; padding: 1.7rem; }
.tm-hero h4, .tm-hero p { color: #fff; }
.tm-hero p { opacity: .85; max-width: 640px; }
.tm-hero .btn-light { color: #0f766e; border: 0; }
.tm-hero-actions { display: flex; flex-wrap: wrap; gap: .65rem; }

.tm-hero-chip {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .42rem .75rem; border-radius: 30px;
    background: rgba(255, 255, 255, .14); font-size: .75rem;
}
.tm-hero-chip i { font-size: .95rem; }

/* کارت‌های آمار */
.tm-stat { border: 0; border-radius: 16px; transition: transform .18s ease, box-shadow .18s ease; }
.tm-stat:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(15, 23, 42, .08); }
.tm-stat-icon { display: grid; place-items: center; width: 45px; height: 45px; border-radius: 14px; font-size: 1.25rem; flex-shrink: 0; }

/* نوار ابزار */
.tm-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.tm-search { position: relative; min-width: min(100%, 300px); flex: 1; }
.tm-search > i { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); z-index: 2; }
.tm-search input { padding-inline-start: 2.45rem; border-radius: 12px; }
.tm-search .k-input { border-radius: 12px; }
/* TelerikTextBox روی input داخلی dir=ltr رندر می‌کند — برای فارسی راست‌چین می‌کنیم */
.tm-search input.k-input-inner { direction: rtl; text-align: right; padding-inline-start: 2.45rem; }

/* عنوان بخش‌ها */
.tm-section { display: flex; align-items: center; gap: .6rem; margin: 1.4rem 0 .9rem; }
.tm-section h6 { margin: 0; font-weight: 700; }
.tm-section .tm-section-line { flex: 1; height: 1px; background: var(--default-border); }
.tm-section .badge { font-weight: 600; }

/* گرید و کارت تیم */
.tm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 1rem; }

.tm-card {
    position: relative; display: flex; flex-direction: column; gap: .9rem;
    padding: 1.15rem 1.2rem; border-radius: 18px;
    background: var(--custom-white); border: 1px solid var(--default-border);
    cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tm-card:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(15, 23, 42, .1); border-color: rgba(var(--primary-rgb), .35); }

.tm-card-head { display: flex; align-items: flex-start; gap: .8rem; }
.tm-card-title { flex: 1; min-width: 0; }
.tm-card-name { font-weight: 700; font-size: .98rem; color: var(--default-text-color); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tm-card-desc { color: var(--text-muted); font-size: .78rem; margin-top: .15rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.3em; }

/* آواتار تیم — تنوع رنگی */
.tm-av {
    display: grid; place-items: center; flex-shrink: 0;
    width: 52px; height: 52px; border-radius: 16px;
    color: #fff; font-size: 1.45rem;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .14) inset, 0 6px 14px rgba(15, 23, 42, .12);
}
.tm-av.lg { width: 74px; height: 74px; border-radius: 22px; font-size: 2.1rem; }
.tm-av-violet { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.tm-av-blue { background: linear-gradient(135deg, #2563eb, #38bdf8); }
.tm-av-teal { background: linear-gradient(135deg, #0d9488, #2dd4bf); }
.tm-av-green { background: linear-gradient(135deg, #16a34a, #86efac); }
.tm-av-amber { background: linear-gradient(135deg, #d97706, #fbbf24); }
.tm-av-rose { background: linear-gradient(135deg, #e11d48, #fb7185); }
.tm-av-pink { background: linear-gradient(135deg, #db2777, #f472b6); }
.tm-av-slate { background: linear-gradient(135deg, #475569, #94a3b8); }

/* نشان نقش و وضعیت زنده */
.tm-role-badge { font-size: .68rem; font-weight: 600; padding: .3rem .6rem; border-radius: 20px; }

.tm-live {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .28rem .65rem; border-radius: 20px;
    background: rgba(34, 197, 94, .12); color: #16a34a;
    font-size: .68rem; font-weight: 700;
}
.tm-live i {
    width: 7px; height: 7px; border-radius: 50%; background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, .5); animation: tm-pulse 1.6s infinite;
}
@keyframes tm-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .45); }
    70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* پشتهٔ آواتار اعضا */
.tm-avstack { display: flex; align-items: center; }
.tm-avstack .tm-mini {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center; font-size: .72rem; font-weight: 700; color: #fff;
    border: 2px solid var(--custom-white); margin-inline-start: -8px;
    background: linear-gradient(135deg, #64748b, #94a3b8);
}
.tm-avstack .tm-mini:first-child { margin-inline-start: 0; }
.tm-avstack .tm-mini.more { background: var(--default-background, #eef2f7); color: var(--text-muted); font-size: .66rem; }

/* پایین کارت */
.tm-card-foot { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: auto; padding-top: .8rem; border-top: 1px dashed var(--default-border); }
.tm-card-meta { display: flex; align-items: center; gap: .8rem; color: var(--text-muted); font-size: .72rem; }
.tm-card-meta span { display: inline-flex; align-items: center; gap: .3rem; }
.tm-card-actions { display: flex; align-items: center; gap: .4rem; }
.tm-card-actions .btn { border-radius: 10px; }

/* کارت ایجاد تیم */
.tm-create {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .7rem;
    min-height: 190px; border: 1.6px dashed var(--default-border); border-radius: 18px;
    background: transparent; color: var(--text-muted); cursor: pointer;
    font: inherit; transition: .18s ease;
}
.tm-create:hover { border-color: rgb(var(--primary-rgb)); color: rgb(var(--primary-rgb)); background: rgba(var(--primary-rgb), .04); }
.tm-create .tm-create-plus {
    display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
    background: rgba(var(--primary-rgb), .09); font-size: 1.5rem;
}

/* حالت خالی */
.tm-empty { padding: 3.5rem 1rem; text-align: center; }
.tm-empty-icon {
    display: grid; place-items: center; width: 76px; height: 76px; margin: 0 auto 1rem;
    border-radius: 24px; background: rgba(var(--primary-rgb), .09);
    color: rgb(var(--primary-rgb)); font-size: 2.1rem;
}
.tm-empty-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }

/* ── صفحهٔ جزئیات تیم ── */
.tm-detail-hero { border: 0; border-radius: 20px; overflow: hidden; }
.tm-detail-hero .card-body { padding: 1.5rem; }
.tm-detail-head { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.tm-detail-title { flex: 1; min-width: 220px; }
.tm-detail-title h4 { font-weight: 800; margin-bottom: .25rem; }
.tm-detail-title p { color: var(--text-muted); font-size: .82rem; margin: 0; }
.tm-detail-badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; }
.tm-chip {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .32rem .7rem; border-radius: 20px; font-size: .7rem;
    background: var(--default-background, #f1f5f9); color: var(--text-muted);
}
.tm-chip code { direction: ltr; font-size: .72rem; color: var(--default-text-color); }
.tm-detail-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* کادر دعوت */
.tm-invite {
    display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
    padding: .7rem .85rem; border: 1px dashed rgba(var(--primary-rgb), .45);
    border-radius: 14px; background: rgba(var(--primary-rgb), .05);
}
.tm-invite code {
    direction: ltr; font-size: .95rem; font-weight: 800; letter-spacing: .18em;
    color: rgb(var(--primary-rgb));
}
.tm-invite small { color: var(--text-muted); }

/* اعضا */
.tm-member {
    display: flex; align-items: center; gap: .8rem;
    padding: .7rem .9rem; border: 1px solid var(--default-border); border-radius: 14px;
    transition: border-color .15s ease, background .15s ease;
}
.tm-member:hover { border-color: rgba(var(--primary-rgb), .35); }
.tm-member-av {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .9rem;
}
.tm-member-info { flex: 1; min-width: 0; }
.tm-member-name { font-weight: 600; font-size: .86rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tm-member-name .tm-you { color: rgb(var(--primary-rgb)); font-size: .68rem; font-weight: 700; }
.tm-member-sub { color: var(--text-muted); font-size: .7rem; direction: ltr; text-align: end; }
.tm-member-side { display: flex; align-items: center; gap: .45rem; flex-shrink: 0; }
.tm-member-role { min-width: 74px; }
.tm-members-list { display: grid; gap: .55rem; }

/* نتایج جستجوی کاربر در مودال افزودن عضو */
.tm-userpick { max-height: 250px; overflow-y: auto; border: 1px solid var(--default-border); border-radius: 12px; }
.tm-userpick-item {
    display: flex; align-items: center; gap: .7rem; width: 100%;
    padding: .6rem .8rem; border: 0; background: transparent; color: var(--default-text-color);
    text-align: start; font: inherit; cursor: pointer; transition: background .13s ease;
}
.tm-userpick-item:hover { background: rgba(var(--primary-rgb), .06); }
.tm-userpick-item .tm-member-av { width: 34px; height: 34px; font-size: .78rem; }
.tm-userpick-item small { color: var(--text-muted); direction: ltr; }

/* انتخاب آیکون و رنگ در مودال ساخت */
.tm-icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .5rem; }
.tm-icon-pick {
    display: grid; place-items: center; aspect-ratio: 1; border-radius: 12px;
    border: 1px solid var(--default-border); background: transparent;
    color: var(--text-muted); font-size: 1.15rem; cursor: pointer; transition: .14s ease;
}
.tm-icon-pick:hover { border-color: rgba(var(--primary-rgb), .5); color: rgb(var(--primary-rgb)); }
.tm-icon-pick.active { border-color: rgb(var(--primary-rgb)); background: rgba(var(--primary-rgb), .1); color: rgb(var(--primary-rgb)); }

.tm-color-grid { display: flex; flex-wrap: wrap; gap: .55rem; }
.tm-color-pick {
    width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent;
    cursor: pointer; padding: 0; transition: .14s ease; position: relative;
}
.tm-color-pick.active { border-color: var(--custom-white); box-shadow: 0 0 0 2.5px rgb(var(--primary-rgb)); transform: scale(1.08); }

/* پیش‌نمایش زنده در مودال */
.tm-preview { display: flex; align-items: center; gap: .8rem; padding: .8rem; border-radius: 14px; background: var(--default-background, #f1f5f9); }
.tm-preview .tm-card-name { font-size: .9rem; }
.tm-preview small { color: var(--text-muted); }

/* دکمهٔ بستن مودال */
.tm-modal-close {
    width: 2rem; height: 2rem;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: .5rem;
}

@media (max-width: 575.98px) {
    .tm-grid { grid-template-columns: 1fr; }
    .tm-icon-grid { grid-template-columns: repeat(4, 1fr); }
    .tm-detail-head { align-items: flex-start; }
}
