/**
 * Tennis Data Hub — Top 100 ranglisteside styles
 *
 * CSS for [tennis_top100]-shortcoden (verdensrangliste-siden).
 * Loadet via tdh_top100_enqueue_css() i players-top100-shortcode.php,
 * dvs. kun på sider der bruger shortcoden.
 *
 * Genbruger CSS-tokens fra tdh_shared_css i tennis-data-hub.php:
 *   --bg, --bg-card, --bg-card-alt, --border, --border-light,
 *   --text, --text-dim, --text-muted, --primary, --primary-light,
 *   --primary-mid, --red, --gold
 *
 * Navngivning: alle klasser bruger præfikset .tdh-r- (ranking).
 * Fanges af WP Rocket safelist wildcard .tdh-(.*)
 */

/* ── Lokale farve-tokens specifikt til ranking-siden ─────────── */
.tdh-r-wrap {
    --up: #15803d;
    --down: #b91c1c;

    font-family: 'Roboto Condensed', Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    color: var(--text, #1a1a1a);
}
.tdh-r-wrap * { box-sizing: border-box; }

/* ── Tour-tabs (Herrer / Damer) — match tournaments-overview ── */
.tdh-r-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border, #e2dfd8);
}

.tdh-r-tab {
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    padding: 16px 12px;
    font-family: inherit;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-muted, #9b9790);
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: -2px;
    letter-spacing: 0.3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.tdh-r-tab:hover {
    color: var(--text-dim, #5c5a55);
    background: var(--bg-card-alt, #f3f1ed);
}

.tdh-r-tab.active {
    color: var(--primary, #0f5c5c);
    border-bottom-color: var(--primary, #0f5c5c);
}

.tdh-r-tab-sub {
    font-weight: 400;
    font-size: 13px;
    color: var(--text-muted, #9b9790);
}

.tdh-r-tab.active .tdh-r-tab-sub {
    color: var(--text-dim, #5c5a55);
}

/* ── Tour-paneler ───────────────────────────────────────────── */
.tdh-r-panel-wrap { display: none; }
.tdh-r-panel-wrap.active { display: block; }

/* ── Søgefelt + meta ────────────────────────────────────────── */
.tdh-r-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.tdh-r-search {
    flex: 1 1 280px;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border, #e2dfd8);
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    background: var(--bg-card, #fff);
    color: var(--text, #1a1a1a);
}

.tdh-r-search:focus {
    outline: 2px solid var(--primary, #0f5c5c);
    outline-offset: 0;
    border-color: var(--primary, #0f5c5c);
}

.tdh-r-meta {
    font-size: 14px;
    color: var(--text-muted, #9b9790);
    flex-shrink: 0;
}

/* ── Tabel ──────────────────────────────────────────────────── */
.tdh-r-tablewrap {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border, #e2dfd8);
    border-radius: 8px;
    overflow: hidden;
}

.tdh-r-table {
    width: 100%;
    border-collapse: collapse;
}

.tdh-r-table thead th {
    background: var(--bg-card-alt, #f3f1ed);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted, #9b9790);
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border, #e2dfd8);
}

.tdh-r-table thead th.tdh-r-th-num,
.tdh-r-table thead th.tdh-r-th-age,
.tdh-r-table thead th.tdh-r-th-points,
.tdh-r-table thead th.tdh-r-th-move {
    text-align: right;
}

.tdh-r-table tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-light, #ece9e3);
    font-size: 16px;
    vertical-align: middle;
}

.tdh-r-table tbody tr:last-child td { border-bottom: 0; }
.tdh-r-table tbody tr:hover { background: var(--bg-card-alt, #f3f1ed); }

.tdh-r-rank {
    font-size: 17px;
    font-weight: 700;
    color: var(--text, #1a1a1a);
    text-align: right;
    width: 50px;
}

/* Spillercelle */
.tdh-r-playercell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.tdh-r-headshot {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    background: var(--primary-light, rgba(15,92,92,0.08));
    flex-shrink: 0;
    border: 1px solid var(--border-light, #ece9e3);
    display: block;
}

.tdh-r-headshot-empty {
    /* Bevarer størrelse selv uden <img> */
}

.tdh-r-playername {
    font-weight: 600;
    color: var(--text, #1a1a1a);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

a.tdh-r-playername:hover {
    color: var(--primary, #0f5c5c);
    text-decoration: underline;
}

/* Land + flag */
.tdh-r-country {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dim, #5c5a55);
}

.tdh-r-country img {
    width: auto;
    height: 16px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.05);
    flex-shrink: 0;
}

/* Point */
.tdh-r-points {
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    width: 110px;
}

/* Alder (kun synlig p\u00e5 desktop \u2014 skjult p\u00e5 mobil) */
.tdh-r-age {
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-dim, #5c5a55);
    width: 70px;
}

/* Bevægelsespil (uden tal — bare retning) */
.tdh-r-move {
    text-align: right;
    width: 80px;
    font-size: 16px;
    font-weight: 600;
}

.tdh-r-move.up   { color: var(--up); }
.tdh-r-move.down { color: var(--down); }
.tdh-r-move.same { color: var(--text-muted, #9b9790); }

.tdh-r-move-icon {
    display: inline-block;
    width: 0;
    height: 0;
    vertical-align: middle;
}

.tdh-r-move.up .tdh-r-move-icon {
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 9px solid var(--up);
}

.tdh-r-move.down .tdh-r-move-icon {
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 9px solid var(--down);
}

/* Screen-reader-only label til pile (tilgængelighed) */
.tdh-r-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Tom-tilstand */
.tdh-r-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted, #9b9790);
    font-size: 16px;
}

.tdh-r-empty-msg {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted, #9b9790);
    font-size: 15px;
}

/* ═══════════════════════════════════════════════════════════
   Mobil (≤700px)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 700px) {
    .tdh-r-tabs { margin-bottom: 20px; }
    .tdh-r-tab {
        font-size: 17px;
        padding: 12px 8px;
    }

    .tdh-r-controls {
        gap: 10px;
        margin-bottom: 20px;
    }
    .tdh-r-search { flex: 1 1 100%; }
    /* Dato på egen linje øverst, centreret */
    .tdh-r-meta {
        flex: 1 1 100%;
        font-size: 13px;
        text-align: center;
    }

    /* Tabel: kompakt på mobil */
    .tdh-r-table thead th {
        font-size: 11px;
        padding: 10px 8px;
        letter-spacing: 0.5px;
    }
    .tdh-r-table tbody td {
        padding: 10px 8px;
        font-size: 15px;
    }
    .tdh-r-rank { font-size: 15px; width: 32px; }
    .tdh-r-headshot { width: 34px; height: 34px; }
    .tdh-r-playercell { gap: 10px; }
    .tdh-r-playername { font-size: 14px; }
    /* På mobil skjul land-navn — kun flag */
    .tdh-r-country span { display: none; }
    .tdh-r-points { width: 72px; font-size: 14px; }

    /* Skjul Alder og Ændring-kolonner helt på mobil (ikke plads) */
    .tdh-r-table .tdh-r-th-age,
    .tdh-r-table .tdh-r-th-move,
    .tdh-r-table .tdh-r-age,
    .tdh-r-table .tdh-r-move {
        display: none;
    }
}

/* Ekstra kompakt på meget små skærme */
@media (max-width: 380px) {
    .tdh-r-table tbody td { padding: 9px 6px; }
    .tdh-r-rank { width: 26px; font-size: 14px; }
    .tdh-r-headshot { width: 30px; height: 30px; }
    .tdh-r-playercell { gap: 8px; }
    .tdh-r-playername { font-size: 13px; }
    .tdh-r-points { width: 60px; font-size: 13px; }
}

/* ═══════════════════════════════════════════════════════════
   Som turnerings- og spillersidernes tabeller (layout v2, Åge 19. okt. 2026):
   grønt tabelhoved og 16px til kanten i begge sider — også på mobil.
   Gælder både ranglistesiden ([tennis_top100]) og forsidens top 10.
   ═══════════════════════════════════════════════════════════ */
.tdh-r-table thead th {
    background: #0f5c5c;
    color: #fff;
    font-size: 12.5px;
    letter-spacing: 1px;
    padding: 9px 14px;
    border-bottom: 0;
}
.tdh-r-table thead th:first-child,
.tdh-r-table tbody td:first-child { padding-left: 16px; }
.tdh-r-table thead th:last-child,
.tdh-r-table tbody td:last-child { padding-right: 16px; }

@media (max-width: 700px) {
    .tdh-r-table thead th { font-size: 12px; padding: 9px 8px; }
    /* Alder/Ændring er skjult på mobil: point er den synlige sidste kolonne */
    .tdh-r-table thead th.tdh-r-th-points,
    .tdh-r-table tbody td.tdh-r-points { padding-right: 16px; }
    .tdh-r-table thead th:first-child,
    .tdh-r-table tbody td:first-child { padding-left: 12px; }
}

/* Spillersidens rangliste (players-v2.php): spilleren selv fremhævet */
.tdh-r-table tbody tr.tdh-r-me td { background: #E3F3F3; }
.tdh-r-table tbody tr.tdh-r-me .tdh-r-playername { font-weight: 800; }
