/* ── Fonts ────────────────────────────────────────────────── */
@font-face {
    font-family: 'MosesText';
    src: url('../assets/fonts/MosesText_Inter-VF.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
}
@font-face {
    font-family: 'MosesText';
    src: url('../assets/fonts/MosesText_Inter-Light.otf?v=c4168ce4') format('opentype');
    font-weight: 300;
    font-style: normal;
}
@font-face {
    font-family: 'MosesText';
    src: url('../assets/fonts/MosesText_Inter-Regular.otf?v=9275aca6') format('opentype');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'MosesText';
    src: url('../assets/fonts/MosesText_Inter-Medium.otf?v=22fa8d06') format('opentype');
    font-weight: 500;
    font-style: normal;
}
@font-face {
    font-family: 'MosesText';
    src: url('../assets/fonts/MosesText_Inter-Bold.otf?v=770b9b85') format('opentype');
    font-weight: 700;
    font-style: normal;
}

/* ── Reset / base ─────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-red:   #E41D35;
    --primary-blue:  #526BDB;
    --text-dark:     #1A1A1A;
    --text-light:    #666666;
    --bg-light:      #F5F5F5;
    --border-gray:   #DDDDDD;
    --card-bg:       #FFFFFF;
    --header-bg:     #00182F;
}

body {
    font-family: 'MosesText', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    direction: rtl;
    font-weight: 300;
    min-height: 100vh;
    max-width: 1240px;
    margin: 0 auto;
}

/* ── Header ──────────────────────────────────────────────── */
.page-header {
    position: relative;
    user-select: none;
}

.header-inner {
    position: relative;
    max-width: 1280px;
    margin: 0 auto;
    height: 95px;
    overflow: visible;
    background-color: #03122B;
    background-image: url('../assets/images/Teams_bg.png?v=c2059735');
    background-size: cover;
    background-position: center;
    /* clip right overflow (tabs) but allow bottom overflow (trophy hangs below) */
    clip-path: inset(0 0 -200px 0);
}

/* Tab shape — top half (green), peeks from right edge */
.header-inner::before {
    content: '';
    position: absolute;
    right: -53px;
    top: 0;
    width: 97px;
    height: 47.5px;
    background: #0dc95c;
    border-radius: 10000px 0 0 0;
    pointer-events: none;
    z-index: 2;
}

/* Tab shape — bottom half (green), peeks from right edge */
.header-inner::after {
    content: '';
    position: absolute;
    right: -53px;
    bottom: 0;
    width: 97px;
    height: 47.5px;
    background: #007B02;
    border-radius: 10000px 0 0 0;
    pointer-events: none;
    z-index: 2;
}

.header-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 4rem 0 50px;
    direction: rtl;
}

/* Remove old stripes */
.header-content::before {
    display: none;
}

.header-title {
    font-size: 3.875rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.01em;
    line-height: 1;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.header-trophy {
    position: absolute;
    bottom: -45px;
    left: 20px;
    height: 88px;
    width: auto;
    object-fit: contain;
    z-index: 10;
}

/* ── Main content ─────────────────────────────────────────── */
.main-content {
    padding: 16px 20px 40px;
    max-width: 1280px;
    margin: 0 auto;
}

/* ── Stats grid: 1 column on mobile, 2 on tablet, 3 on desktop ─ */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 900px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
        margin-top: 40px;
    }
}

/* ── Stat card ────────────────────────────────────────────── */
.stat-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #E4E8F0;
    display: flex;
    flex-direction: column;
}

/* Card header bar */
.stat-card__header {
    background: #00182F;
    padding: 16px 25px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    direction: rtl;
}

.stat-card__header-inner {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-card__title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    white-space: nowrap;
}

.stat-card__icon {
    width: 25px;
    height: 25px;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
}

/* Player list */
.stat-card__list {
    list-style: none;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: #E4E8F0 transparent;
    direction: ltr; /* pushes scrollbar to the right in RTL pages */
}

/* Desktop: scroll within the card */
@media (min-width: 640px) {
    .stat-card__list {
        max-height: 400px;
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}

/* Show-more link (mobile only) */
.stat-card__more {
    display: none;
}

.stat-card__list::-webkit-scrollbar {
    width: 4px;
}

.stat-card__list::-webkit-scrollbar-track {
    background: transparent;
}

.stat-card__list::-webkit-scrollbar-thumb {
    background: #E4E8F0;
    border-radius: 2px;
}

.stat-card__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 16px 14px;
    border-bottom: 1px solid #E4E8F0;
    min-height: 80px;
    direction: rtl; /* restore RTL for content inside the ltr-scrollbar list */
}

.stat-card__row:last-child {
    border-bottom: none;
}

.stat-card__row:hover {
    background: #f7f9fc;
}

/* Player block (right side in RTL) */
.stat-card__player {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

/* Circular player photo */
.stat-card__photo {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    object-fit: cover;
    background: #EEF2FB;
    flex-shrink: 0;
}

/* Rank-1 photo: gradient green border */
.stat-card__photo--first {
    border: 2px solid transparent;
    background:
        linear-gradient(#EEF2FB, #EEF2FB) padding-box,
        linear-gradient(312deg, #D9F3E2 3.93%, #27DF6A 50.47%, #00B140 97.01%) border-box;
    padding: 2px;
}

.stat-card__photo--placeholder {
    display: block;
}

@media (min-width: 640px) {
    .stat-card__photo {
        width: 48px;
        height: 48px;
    }
}

/* Player info text */
.stat-card__info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-card__name {
    font-size: 1rem;
    font-weight: 400;
    color: #03122B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 100%;
}

.stat-card__country {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    font-weight: 400;
    color: #888;
    white-space: nowrap;
}

/* Small flag inline with country */
.stat-card__flag {
    width: 20px;
    height: 20px;
    object-fit: cover;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Value (left side in RTL) */
.stat-card__value {
    font-size: 1.125rem;
    font-weight: 500;
    color: #03122B;
    flex-shrink: 0;
    min-width: 36px;
    text-align: center;
    direction: ltr;
}

/* Rank-1 pill — shared shape */
.stat-card__value--first,
.stat-card__value--yellow,
.stat-card__value--red {
    border-radius: 50%;
    padding: 6px 6px;
    font-weight: 700;
    color: #fff;
}

/* Rank-1 pill — per-category colors */
.stat-card__value--first  { background: #045694; }
.stat-card__value--yellow { background: #FFCC00; color: #03122B; }
.stat-card__value--red    { background: #DF1C3C; }

/* Empty / loading states */
.stat-card__empty {
    padding: 20px 14px;
    font-size: 0.82rem;
    color: var(--text-light);
    text-align: center;
}

/* Skeleton animation for loading */
.stat-card__skeleton-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid #E4E8F0;
    min-height: 80px;
}

.stat-card__skeleton-row:last-child {
    border-bottom: none;
}

@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.45; }
}

.skel {
    border-radius: 4px;
    background: #e0e0e0;
    animation: skeleton-pulse 1.3s ease-in-out infinite;
}

.skel--flag  { width: 30px; height: 22px; flex-shrink: 0; }
.skel--name  { height: 10px; width: 70%; }
.skel--meta  { height: 9px;  width: 45%; margin-block-start: 4px; }
.skel--val   { width: 22px; height: 16px; flex-shrink: 0; margin-inline-start: auto; }

/* ── Mobile (max-width: 639px) ───────────────────────────── */
@media (max-width: 639px) {
    /* Header */
    .header-title {
        font-size: 2.3rem;
    }
    .header-trophy {
        bottom: 0;
    }

    /* Stat card list — collapsed state: hide rows 6+ */
    .stat-card__list--collapsed {
        overflow: clip;
    }
    .stat-card__list--collapsed .stat-card__row:nth-child(n+6) {
        display: none;
    }

    /* Show-more link */
    .stat-card__more {
        display: block;
        padding: 14px 20px;
        text-align: center;
        font-size: 0.9rem;
        font-weight: 600;
        color: #045694;
        cursor: pointer;
        border-top: 1px solid #E4E8F0;
        user-select: none;
    }
    .stat-card__more:hover {
        background: #f7f9fc;
    }
}
