/**
 * FIFA national teams world ranking page — dark / light mode.
 */

.national-teams-ranking-page {
    --ntr-radius: 16px;
    --ntr-accent: #16ae94;
    --ntr-accent-bright: #39dbbf;
    --ntr-muted: #707488;
    --ntr-text: #bfc3d4;
    --ntr-title: #ffffff;
    --ntr-surface: #191d2d;
    --ntr-border: #303651;
    --ntr-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
    --ntr-row-bg: #1d2233;
    --ntr-row-hover: rgba(57, 219, 191, 0.08);
    --ntr-header-bg: #232838;
    --ntr-header-text: #bfc3d4;
    --ntr-pill-bg: rgba(57, 219, 191, 0.12);
    --ntr-pill-text: #39dbbf;
    --ntr-count-bg: rgba(57, 219, 191, 0.12);
    --ntr-count-text: #39dbbf;
    padding-bottom: max(3rem, env(safe-area-inset-bottom, 0px));
}

html.light:not(.dark) .national-teams-ranking-page {
    --ntr-muted: #707488;
    --ntr-text: #0e1019;
    --ntr-title: #0e1019;
    --ntr-surface: #ffffff;
    --ntr-border: #e3e5f0;
    --ntr-shadow: 0 10px 40px rgba(14, 16, 25, 0.08);
    --ntr-row-bg: #ffffff;
    --ntr-row-hover: rgba(22, 174, 148, 0.08);
    --ntr-header-bg: #e3e5f0;
    --ntr-header-text: #707488;
    --ntr-pill-bg: rgba(22, 174, 148, 0.1);
    --ntr-pill-text: #16ae94;
    --ntr-count-bg: rgba(22, 174, 148, 0.12);
    --ntr-count-text: #16ae94;
}

.national-teams-ranking-page .container {
    max-width: 920px;
}

/* --- Hero --- */
.ntr-hero {
    position: relative;
    border-radius: var(--ntr-radius);
    overflow: hidden;
    padding: 2rem 1.75rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--ntr-border);
    box-shadow: var(--ntr-shadow);
    background: linear-gradient(145deg, #1f2538 0%, #191d2d 50%, #131a24 100%);
}

html.light:not(.dark) .ntr-hero {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fc 55%, #eef6f4 100%);
}

.ntr-hero::after {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, #16ae94, #5a83ff);
}

.ntr-hero__kicker {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.16em;
    color: var(--ntr-accent-bright);
    margin-bottom: 0.5rem;
}

html.light:not(.dark) .ntr-hero__kicker {
    color: var(--ntr-accent);
}

.ntr-hero__title {
    font-size: clamp(1.35rem, 3.2vw, 1.85rem);
    font-weight: 900;
    line-height: 1.25;
    margin: 0 0 0.65rem;
    color: var(--ntr-title);
}

.ntr-hero__lead {
    margin: 0 0 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--ntr-muted);
    max-width: 52ch;
}

.ntr-hero__count {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--ntr-count-bg);
    color: var(--ntr-count-text);
}

/* --- Search --- */
.ntr-toolbar {
    margin-bottom: 1rem;
}

.ntr-search {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--ntr-border);
    background: var(--ntr-surface);
    color: var(--ntr-muted);
}

.ntr-search input {
    flex: 1;
    border: 0;
    background: transparent;
    outline: none;
    font-size: 0.95rem;
    color: var(--ntr-text);
    min-width: 0;
}

.ntr-search input::placeholder {
    color: var(--ntr-muted);
    opacity: 0.85;
}

/* --- Table --- */
.ntr-table-card {
    border-radius: var(--ntr-radius);
    overflow: hidden;
    box-shadow: var(--ntr-shadow);
    background: var(--ntr-surface);
    border: 1px solid var(--ntr-border);
}

.ntr-table-head,
.ntr-table-row {
    display: grid;
    grid-template-columns: 3.25rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
}

.ntr-table-head {
    background: var(--ntr-header-bg);
    color: var(--ntr-header-text);
    font-size: 0.8rem;
    font-weight: 700;
    border-bottom: 1px solid var(--ntr-border);
}

.ntr-table-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 0.35rem 0;
}

a.ntr-table-row {
    text-decoration: none;
    color: var(--ntr-text);
    background: var(--ntr-row-bg);
    transition: background 0.2s ease, color 0.2s ease;
    border-inline-start: 3px solid transparent;
}

a.ntr-table-row:hover {
    background: var(--ntr-row-hover);
}

html.light:not(.dark) a.ntr-table-row:hover .ntr-team-title {
    color: #16ae94;
}

.ntr-col-rank {
    font-weight: 800;
    font-size: 1rem;
    text-align: center;
    color: var(--ntr-text);
}

.ntr-col-team {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.ntr-col-team img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

.ntr-team-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--ntr-text);
    transition: color 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ntr-col-fifa {
    display: flex;
    justify-content: flex-end;
}

.ntr-fifa-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 5.25rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    background: var(--ntr-pill-bg);
    color: var(--ntr-pill-text);
    white-space: nowrap;
}

/* --- Top 3 --- */
.ntr-rank--gold .ntr-col-rank {
    color: #e6a900;
}

.ntr-rank--silver .ntr-col-rank {
    color: #a8b0c2;
}

.ntr-rank--bronze .ntr-col-rank {
    color: #c77b30;
}

.ntr-rank--gold {
    border-inline-start-color: #e6a900;
}

.ntr-rank--silver {
    border-inline-start-color: #a8b0c2;
}

.ntr-rank--bronze {
    border-inline-start-color: #c77b30;
}

.ntr-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--ntr-muted);
    font-size: 0.95rem;
}

/* -------------------------------------------------------------------------
   Responsive — mobile (safe areas, no horizontal overflow, touch-friendly)
   ------------------------------------------------------------------------- */

@media (max-width: 767.98px) {
    .ntr-page-header .container,
    .national-teams-ranking-page .container {
        max-width: 100%;
        padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
        padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
    }

    .national-teams-ranking-page {
        overflow-x: clip;
        padding-bottom: max(2rem, env(safe-area-inset-bottom, 0px));
    }

    .ntr-hero {
        padding: 1.15rem 1rem;
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    /* العنوان يظهر في mobile-header — نخفّف التكرار */
    .ntr-hero__title {
        display: none;
    }

    .ntr-hero__lead {
        font-size: 0.88rem;
        margin-bottom: 0.75rem;
    }

    .ntr-hero__count {
        font-size: 0.75rem;
    }

    .ntr-toolbar {
        margin-bottom: 0.85rem;
    }

    .ntr-search {
        padding: 0.55rem 0.85rem;
    }

    .ntr-search input {
        font-size: 16px; /* يمنع تكبير iOS عند التركيز */
    }

    .ntr-table-card {
        border-radius: 12px;
        max-width: 100%;
    }

    .ntr-table {
        max-width: 100%;
    }

    /* الترتيب موجود في العمود الأول — نخفّف الازدحام */
    .ntr-table-head .ntr-col-fifa,
    .ntr-table-row .ntr-col-fifa {
        display: none;
    }

    .ntr-table-head,
    .ntr-table-row {
        grid-template-columns: 2.75rem minmax(0, 1fr);
        gap: 0.65rem;
        padding: 0.65rem 0.75rem;
        min-height: 52px;
        box-sizing: border-box;
    }

    .ntr-col-rank {
        font-size: 0.9rem;
    }

    .ntr-col-team {
        min-width: 0;
    }

    .ntr-col-team img {
        width: 32px;
        height: 32px;
    }

    .ntr-team-title {
        font-size: 0.88rem;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-height: 1.35;
    }
}
