/* ===========================================================
   رنکبندی ورزشکاران — استایل صفحه عمومی
   =========================================================== */

.ranking-page {
    direction: rtl;
    font-family: "IRANSans", "Vazirmatn", sans-serif;
    padding: 8px 0 60px;
}

.ranking-hero {
    text-align: center;
    margin-bottom: 22px;
}

.ranking-hero h1 {
    font-size: 30px;
    font-weight: 900;
    color: #14323a;
    margin-bottom: 8px;
}

.ranking-hero p {
    color: #5b6b72;
    font-size: 15px;
    margin: 0;
}

/* --- نوار تب رشته‌ها --- */
.ranking-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 28px;
}

.ranking-tabs button {
    border: 0;
    background: #eef2f4;
    color: #2b475a;
    font-weight: 700;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    transition: all .2s ease;
}

.ranking-tabs button:hover {
    background: #dfe7ea;
}

.ranking-tabs button.active {
    background: #00808b;
    color: #fff;
    box-shadow: 0 8px 20px rgba(0, 128, 139, .35);
}

/* --- پنل گروه رشته --- */
.ranking-group {
    display: none;
}

.ranking-group.active {
    display: block;
}

/* --- زیرتب‌ها (سطوح هر رشته) --- */
.ranking-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 22px;
}

.ranking-subtabs .ranking-subtab {
    border: 1.5px solid #cfe0e3;
    background: #fff;
    color: #2b475a;
    font-weight: 700;
    font-size: 13px;
    padding: 7px 16px;
    border-radius: 24px;
    cursor: pointer;
    transition: all .2s ease;
}

.ranking-subtabs .ranking-subtab:hover {
    border-color: #00808b;
    color: #00808b;
}

.ranking-subtabs .ranking-subtab.active {
    background: #00808b;
    border-color: #00808b;
    color: #fff;
    box-shadow: 0 6px 16px rgba(0, 128, 139, .3);
}

.ranking-subgroup {
    display: none;
}

.ranking-subgroup.active {
    display: block;
}

/* --- جدول --- */
.rank-table {
    --accent: #00808b;
    position: relative;
    overflow: hidden;
    border-radius: 26px;
    padding: 24px 22px 14px;
    margin-bottom: 34px;
    background:
        linear-gradient(160deg, color-mix(in srgb, var(--accent) 88%, #000 0%) 0%,
            color-mix(in srgb, var(--accent) 70%, #0b1f24 30%) 100%);
    box-shadow: 0 24px 50px rgba(0, 0, 0, .18);
}

/* fallback اگر مرورگر color-mix را پشتیبانی نکند */
@supports not (background: color-mix(in srgb, red, blue)) {
    .rank-table {
        background: linear-gradient(160deg, var(--accent) 0%, #0b3a42 100%);
    }
}

.rank-table__head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    color: #fff;
}

.rank-table__icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    object-fit: cover;
    background: rgba(255, 255, 255, .15);
    flex-shrink: 0;
}

.rank-table__title {
    font-size: 22px;
    font-weight: 900;
    margin: 0;
}

.rank-table__subtitle {
    font-size: 13px;
    opacity: .85;
    margin: 2px 0 0;
}

/* --- ردیف --- */
.rank-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 18px;
    padding: 12px 16px;
    margin-bottom: 12px;
    color: #fff;
    backdrop-filter: blur(3px);
    transition: transform .15s ease, background .15s ease;
}

.rank-row:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, .16);
}

.rank-number {
    width: 46px;
    text-align: center;
    font-size: 30px;
    font-weight: 900;
    opacity: .55;
    flex-shrink: 0;
}

.rank-avatar-wrap {
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    color: inherit;
    font: inherit;
    cursor: zoom-in;
    display: contents;
}

.rank-avatar {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    object-fit: cover;
    background: #fff;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, .35);
    cursor: zoom-in;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.rank-avatar-wrap:hover .rank-avatar,
.rank-avatar-wrap:focus-visible .rank-avatar {
    border-color: rgba(255, 255, 255, .72);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .18);
}

.rank-avatar-wrap:focus-visible {
    outline: none;
}

.rank-info {
    flex-grow: 1;
    min-width: 0;
}

.rank-name {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.55;
    margin: 0;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
}

.rank-meta {
    font-size: 12.5px;
    opacity: .8;
    margin-top: 3px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rank-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.rank-meta .rank-level-badge {
    min-width: 42px;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--level-color, #98a2b3);
    color: #fff;
    opacity: 1;
    font-size: 11.5px;
    font-weight: 900;
    line-height: 1;
}

.rank-points {
    text-align: center;
    flex-shrink: 0;
    padding-inline-start: 8px;
}

.rank-points b {
    display: block;
    font-size: 26px;
    font-weight: 900;
    line-height: 1;
}

.rank-points small {
    font-size: 11px;
    opacity: .8;
}

.rank-trend {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, .9);
}

.rank-trend i {
    font-size: 20px;
    font-weight: 700;
}

/* --- مدال نفرات برتر --- */
.rank-row.top-1 { background: linear-gradient(90deg, rgba(255, 215, 0, .30), rgba(255, 255, 255, .08)); border-color: rgba(255, 215, 0, .6); }
.rank-row.top-2 { background: linear-gradient(90deg, rgba(192, 192, 192, .28), rgba(255, 255, 255, .08)); border-color: rgba(220, 220, 220, .6); }
.rank-row.top-3 { background: linear-gradient(90deg, rgba(205, 127, 50, .28), rgba(255, 255, 255, .08)); border-color: rgba(205, 127, 50, .6); }

.rank-row.top-1 .rank-number,
.rank-row.top-2 .rank-number,
.rank-row.top-3 .rank-number { opacity: 1; }

.rank-medal {
    font-size: 24px;
    width: 46px;
    text-align: center;
    flex-shrink: 0;
}

.ranking-empty {
    text-align: center;
    color: #7b8a91;
    padding: 60px 0;
}

.ranking-footer-content {
    margin: 4px 0 34px;
    padding: 24px 26px;
    border: 1px solid #e3e8eb;
    border-radius: 12px;
    background: #fff;
    color: #344054;
    font-size: 14px;
    line-height: 2;
}

.ranking-footer-content h2 {
    margin: 0 0 10px;
    color: #14323a;
    font-size: 21px;
    font-weight: 900;
}

.rank-avatar-modal .modal-dialog {
    max-width: min(92vw, 520px);
}

.rank-avatar-modal .modal-content {
    position: relative;
    overflow: hidden;
    border: 0;
    border-radius: 18px;
    background: #0b1f24;
    color: #fff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .36);
}

.rank-avatar-modal__close {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .76);
    color: #0b1f24;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .24);
    -webkit-backdrop-filter: blur(8px) saturate(1.25);
    backdrop-filter: blur(8px) saturate(1.25);
}

.rank-avatar-modal__img {
    display: block;
    width: 100%;
    max-height: 72vh;
    object-fit: contain;
    background: #0b1f24;
}

.rank-avatar-modal__caption {
    margin: 0;
    padding: 12px 16px 14px;
    text-align: center;
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.7;
    background: rgba(255, 255, 255, .08);
}

@media (max-width: 575.98px) {
    .ranking-hero h1 { font-size: 23px; }
    .rank-avatar-wrap {
        position: relative;
        display: block;
        width: 54px;
        height: 54px;
        flex: 0 0 54px;
    }
    .rank-avatar {
        display: block;
        width: 54px;
        height: 54px;
        border-radius: 15px;
    }
    .rank-number,
    .rank-medal {
        position: absolute;
        left: 3px;
        bottom: 3px;
        z-index: 2;
        width: 25px;
        height: 25px;
        min-width: 25px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 999px;
        background: rgba(255, 255, 255, .68);
        border: 1px solid rgba(255, 255, 255, .8);
        color: #0b3a42;
        opacity: 1;
        box-shadow: 0 8px 18px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .72);
        -webkit-backdrop-filter: blur(9px) saturate(1.35);
        backdrop-filter: blur(9px) saturate(1.35);
    }
    .rank-number {
        text-align: center;
        font-size: 12.5px;
        font-weight: 900;
        line-height: 1;
    }
    .rank-medal {
        font-size: 15.5px;
        line-height: 1;
    }
    .rank-name { font-size: 13px; }
    .rank-points b { font-size: 18px; }
    .rank-row { gap: 10px; padding: 10px 12px; }
    .rank-meta { gap: 6px; }
    .rank-meta .rank-level-badge { height: 22px; padding: 0 8px; font-size: 10.5px; }
    .ranking-footer-content { padding: 18px; border-radius: 10px; }
    .ranking-footer-content h2 { font-size: 18px; }
    .rank-avatar-modal .modal-dialog { margin: 12px; }
    .rank-avatar-modal__close { width: 34px; height: 34px; top: 10px; left: 10px; }
    .rank-avatar-modal__img { max-height: 76vh; }
    .rank-avatar-modal__caption { font-size: 13px; }
}

/* جستجوی بازیکن داخل هر جدول رنکبندی */
.rank-search-wrap {
    position: relative;
    margin: 10px 14px 14px;
}
.rank-search-wrap .bi-search {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: #9aa8ae;
    font-size: 15px;
    pointer-events: none;
}
.rank-search {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: 1px solid #e3e8eb;
    border-radius: 12px;
    font-size: 14px;
    background: #fafcfc;
    color: #2b3a41;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.rank-search:focus {
    border-color: var(--accent, #00808b);
    box-shadow: 0 0 0 3px rgba(0, 128, 139, .12);
    background: #fff;
}
.rank-search-empty {
    text-align: center;
    color: #7b8a91;
    padding: 16px 0;
    margin: 0;
}
