/* ==========================================================================
   RANKING OFICIAL 3X3 MÉXICO — ESTILOS OFICIALES (NEGRO, BLANCO Y ROJO)
   Tipografía Oficial: United Sans Serif Reg
   Compatible con la arquitectura de 3x3mexico.mx (rp/head.php, rp/navbar.php, rp/footer.php)
   ========================================================================== */

/* ===== FUENTE OFICIAL: UNITED SANS SERIF REG ===== */
@font-face {
    font-family: 'United Sans Serif Reg';
    src: url('../fonts/UnitedSansReg-Black.otf') format('opentype'),
         url('/fonts/UnitedSansReg-Black.otf') format('opentype');
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'United Sans';
    src: url('../fonts/UnitedSansReg-Black.otf') format('opentype'),
         url('/fonts/UnitedSansReg-Black.otf') format('opentype');
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}

:root {
    /* ALTURA DEL NAVBAR PARA EVITAR SOLAPAMIENTOS */
    --navbar-total-height: 100px;

    /* TIPOGRAFÍA OFICIAL */
    --rk-font: 'United Sans Serif Reg', 'United Sans', 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* MODO LUZ (POR DEFECTO): FONDO BLANCO, LETRA NEGRA, ACENTOS ROJOS */
    --rk-bg: #ffffff;
    --rk-surface: #ffffff;
    --rk-surface-subtle: #f8f9fa;
    --rk-card: #ffffff;
    --rk-border: #e5e7eb;
    --rk-border-focus: #111111;
    --rk-text-primary: #0a0a0a;
    --rk-text-secondary: #4b5563;
    --rk-text-muted: #71717a;
    --rk-primary: #f22d3a;
    --rk-primary-hover: #d91f2c;
    --rk-primary-active: #b91520;
    --rk-primary-soft: rgba(242, 45, 58, 0.08);
    --rk-primary-border: rgba(242, 45, 58, 0.25);
    --rk-rank-badge-bg: #f4f4f5;
    --rk-rank-badge-text: #18181b;
    --rk-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --rk-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --rk-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
    --rk-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* MODO OSCURO: FONDO NEGRO/OSCURO, LETRA BLANCA Y ROJA */
body.theme-dark {
    --rk-bg: #0a0a0a;
    --rk-surface: #121212;
    --rk-surface-subtle: #18181b;
    --rk-card: #141416;
    --rk-border: #27272a;
    --rk-border-focus: #f4f4f5;
    --rk-text-primary: #ffffff;
    --rk-text-secondary: #d4d4d8;
    --rk-text-muted: #a1a1aa;
    --rk-primary: #f22d3a;
    --rk-primary-hover: #ff4d58;
    --rk-primary-active: #dc2626;
    --rk-primary-soft: rgba(242, 45, 58, 0.15);
    --rk-primary-border: rgba(242, 45, 58, 0.35);
    --rk-rank-badge-bg: #27272a;
    --rk-rank-badge-text: #f4f4f5;
    --rk-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --rk-shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.5);
    --rk-shadow-lg: 0 12px 20px -3px rgba(0, 0, 0, 0.6);
    background-color: var(--rk-bg);
    color: var(--rk-text-primary);
}

body[data-page="ranking"] {
    background-color: var(--rk-bg);
    color: var(--rk-text-primary);
    transition: background-color 0.25s ease, color 0.25s ease;
    font-family: var(--rk-font);
    min-height: 100vh;
}

/* ==========================================================================
   ANIMACIONES VISUALES (BOOM VISUAL EN ROJO/BLANCO/NEGRO)
   ========================================================================== */
@keyframes rkPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(242, 45, 58, 0.5);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(242, 45, 58, 0);
    }
}

@keyframes rkFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rkScaleIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================================================
   HERO SECTION RANKING (ESPACIADO EXACTO PARA NAVBAR FIJO)
   ========================================================================== */
.ranking-hero {
    position: relative;
    background: #000000;
    color: #ffffff;
    padding-top: calc(var(--navbar-total-height, 100px) + 35px);
    padding-bottom: 50px;
    padding-left: 20px;
    padding-right: 20px;
    border-bottom: 3px solid var(--rk-primary);
    overflow: hidden;
}

.ranking-hero__bg-pattern {
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(242, 45, 58, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(242, 45, 58, 0.15) 0%, transparent 45%);
    opacity: 0.9;
    pointer-events: none;
}

.ranking-hero__container {
    max-width: 1240px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.ranking-hero__tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--rk-primary);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 16px;
    animation: rkPulse 2.5s infinite;
    font-family: var(--rk-font);
}

.ranking-hero__title {
    font-family: var(--rk-font);
    font-size: clamp(2rem, 4.5vw, 3.2rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.5px;
    margin: 0 0 14px;
    text-transform: uppercase;
}

.ranking-hero__title span {
    color: var(--rk-primary);
}

.ranking-hero__subtitle {
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    color: #d4d4d8;
    max-width: 780px;
    line-height: 1.5;
    margin: 0 0 24px;
}

.ranking-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.ranking-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 0.82rem;
    color: #ffffff;
    font-family: var(--rk-font);
}

.ranking-hero__badge i {
    color: var(--rk-primary);
}

/* ==========================================================================
   MAIN WRAPPER & CONTROLS (ESPACIADO EXACTO ANTES DEL FOOTER)
   ========================================================================== */
.ranking-main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 36px 20px 90px; /* 90px de separación limpia antes del footer */
}

/* Branch Selector: Varonil / Femenil */
.ranking-branches {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.ranking-branch-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 20px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: var(--rk-transition);
    border: 2px solid var(--rk-border);
    background-color: var(--rk-surface);
    color: var(--rk-text-primary);
    font-family: var(--rk-font);
}

.ranking-branch-btn:hover {
    border-color: var(--rk-primary);
    color: var(--rk-primary);
    transform: translateY(-2px);
}

.ranking-branch-btn--active {
    background-color: var(--rk-primary);
    border-color: var(--rk-primary);
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(242, 45, 58, 0.35);
}

/* Categories Bar (Strictly independent categories) */
.ranking-categories-bar {
    background-color: var(--rk-surface);
    border: 1px solid var(--rk-border);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 24px;
    box-shadow: var(--rk-shadow-sm);
}

.ranking-categories-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--rk-border);
}

.ranking-categories-label {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--rk-text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--rk-font);
}

.ranking-categories-label i {
    color: var(--rk-primary);
}

.ranking-categories-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ranking-cat-pill {
    padding: 9px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--rk-transition);
    border: 1px solid var(--rk-border);
    background-color: var(--rk-surface-subtle);
    color: var(--rk-text-primary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-family: var(--rk-font);
}

.ranking-cat-pill:hover {
    border-color: var(--rk-primary);
    color: var(--rk-primary);
    transform: translateY(-2px);
}

.ranking-cat-pill--active {
    background-color: #000000;
    border-color: #000000;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

body.theme-dark .ranking-cat-pill--active {
    background-color: #ffffff;
    border-color: #ffffff;
    color: #000000 !important;
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.25);
}

.ranking-cat-pill--elite {
    border-left: 3px solid var(--rk-primary);
}

.ranking-extra-cats {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--rk-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.ranking-extra-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--rk-text-muted);
}

/* ==========================================================================
   FILTROS, BÚSQUEDA Y MODO OSCURO
   ========================================================================== */
.ranking-filters-card {
    background-color: var(--rk-surface);
    border: 1px solid var(--rk-border);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: var(--rk-shadow-sm);
}

.ranking-search-wrap {
    position: relative;
    flex: 1;
    max-width: 440px;
}

.ranking-search-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--rk-text-muted);
    font-size: 0.9rem;
}

.ranking-search-input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border-radius: 6px;
    border: 1px solid var(--rk-border);
    background-color: var(--rk-surface-subtle);
    color: var(--rk-text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: var(--rk-transition);
    font-family: var(--rk-font);
}

.ranking-search-input:focus {
    border-color: var(--rk-primary);
    background-color: var(--rk-surface);
    box-shadow: 0 0 0 3px rgba(242, 45, 58, 0.15);
}

.ranking-actions-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ranking-select {
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid var(--rk-border);
    background-color: var(--rk-surface-subtle);
    color: var(--rk-text-primary);
    font-size: 0.88rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: var(--rk-transition);
    font-family: var(--rk-font);
}

.ranking-select:focus {
    border-color: var(--rk-primary);
}

/* Theme Toggle Button */
.ranking-theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 6px;
    border: 1px solid var(--rk-border);
    background-color: var(--rk-surface-subtle);
    color: var(--rk-text-primary);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--rk-transition);
    user-select: none;
    font-family: var(--rk-font);
}

.ranking-theme-toggle:hover {
    border-color: var(--rk-primary);
    color: var(--rk-primary);
    transform: translateY(-2px);
    box-shadow: var(--rk-shadow-sm);
}

.ranking-theme-toggle i {
    color: var(--rk-primary);
}

/* ==========================================================================
   LAYOUT 2 COLUMNAS (TABLA PRINCIPAL + SIDEBAR)
   ========================================================================== */
.ranking-grid-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
}

@media (min-width: 1024px) {
    .ranking-grid-layout {
        grid-template-columns: 8fr 4fr;
    }
}

/* ==========================================================================
   TABLA PRINCIPAL Y REGISTROS
   ========================================================================== */
.ranking-main-col {
    min-width: 0;
}

.ranking-summary-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding: 0 4px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--rk-text-secondary);
}

.ranking-summary-title {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--rk-text-primary);
    text-transform: uppercase;
    font-family: var(--rk-font);
}

.ranking-summary-title span {
    color: var(--rk-primary);
}

.ranking-summary-count {
    background: var(--rk-primary);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 4px;
    font-family: var(--rk-font);
}

.ranking-table-card {
    background-color: var(--rk-surface);
    border: 1px solid var(--rk-border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--rk-shadow-md);
}

.ranking-table-responsive {
    width: 100%;
    overflow-x: auto;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.92rem;
}

.ranking-table thead {
    background-color: var(--rk-surface-subtle);
    border-bottom: 2px solid var(--rk-border);
}

.ranking-table th {
    padding: 14px 18px;
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--rk-text-secondary);
    white-space: nowrap;
    font-family: var(--rk-font);
}

.ranking-table tbody tr {
    border-bottom: 1px solid var(--rk-border);
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.ranking-table tbody tr:hover {
    background-color: var(--rk-surface-subtle);
}

.ranking-table td {
    padding: 14px 18px;
    vertical-align: middle;
}

/* Rank Badge */
.ranking-rank-cell {
    font-weight: 900;
    width: 60px;
}

.ranking-rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background-color: var(--rk-rank-badge-bg);
    color: var(--rk-rank-badge-text);
    font-size: 0.82rem;
    font-weight: 900;
    font-family: var(--rk-font);
    transition: var(--rk-transition);
}

/* Podio especial */
.ranking-rank-badge--1 {
    background-color: var(--rk-primary);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(242, 45, 58, 0.4);
    animation: rkPulse 2s infinite;
}

.ranking-rank-badge--2 {
    background-color: #000000;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

body.theme-dark .ranking-rank-badge--2 {
    background-color: #27272a;
    border: 1px solid #3f3f46;
}

.ranking-rank-badge--3 {
    background-color: #27272a;
    color: #ffffff;
}

/* Player Cell (Con foto oficial FIBA) */
.ranking-player-cell {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ranking-avatar-wrap {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.ranking-avatar-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--rk-border);
    background-color: #0a0a0a;
}

.ranking-avatar-fallback {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #18181b;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.85rem;
    border: 1px solid var(--rk-border);
}

.ranking-player-name {
    font-weight: 800;
    color: var(--rk-text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.15s ease;
    cursor: pointer;
    display: block;
    line-height: 1.25;
}

.ranking-player-name:hover {
    color: var(--rk-primary);
}

.ranking-player-sub {
    font-size: 0.78rem;
    color: var(--rk-text-muted);
    margin-top: 2px;
    display: block;
}

.ranking-cat-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 800;
    background-color: var(--rk-surface-subtle);
    border: 1px solid var(--rk-border);
    color: var(--rk-text-secondary);
    text-transform: uppercase;
    font-family: var(--rk-font);
}

.ranking-points-cell {
    font-weight: 900;
    font-size: 1.05rem;
    color: var(--rk-primary);
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: var(--rk-font);
}

.ranking-btn-details {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    background-color: transparent;
    border: 1px solid var(--rk-border);
    color: var(--rk-text-primary);
    transition: var(--rk-transition);
    font-family: var(--rk-font);
}

.ranking-btn-details:hover {
    background-color: var(--rk-primary);
    border-color: var(--rk-primary);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(242, 45, 58, 0.3);
}

/* ==========================================================================
   VISTA MÓVIL EN TARJETAS
   ========================================================================== */
.ranking-mobile-cards {
    display: none;
    flex-direction: column;
    gap: 12px;
}

.ranking-mobile-card {
    background-color: var(--rk-surface);
    border: 1px solid var(--rk-border);
    border-radius: 10px;
    padding: 16px;
    box-shadow: var(--rk-shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: var(--rk-transition);
}

.ranking-mobile-card:hover {
    border-color: var(--rk-primary);
    transform: translateY(-2px);
}

.ranking-mobile-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ranking-mobile-card__name {
    font-size: 1rem;
    font-weight: 800;
    color: var(--rk-text-primary);
}

.ranking-mobile-card__points {
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--rk-primary);
    font-family: var(--rk-font);
}

.ranking-mobile-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--rk-text-muted);
}

/* ==========================================================================
   PAGINACIÓN
   ========================================================================== */
.ranking-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
}

.ranking-pagination-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border-radius: 6px;
    border: 1px solid var(--rk-border);
    background-color: var(--rk-surface);
    color: var(--rk-text-primary);
    font-size: 0.88rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--rk-transition);
    font-family: var(--rk-font);
}

.ranking-pagination-btn:hover:not(:disabled) {
    border-color: var(--rk-primary);
    color: var(--rk-primary);
    transform: translateY(-2px);
}

.ranking-pagination-btn--active {
    background-color: var(--rk-primary);
    border-color: var(--rk-primary);
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(242, 45, 58, 0.35);
}

.ranking-pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ==========================================================================
   SIDEBAR (DATOS IMPORTANTES, RESUMEN, LÍDERES, ESTADOS)
   ========================================================================== */
.ranking-sidebar-col {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.ranking-side-panel {
    background-color: var(--rk-surface);
    border: 1px solid var(--rk-border);
    border-top: 4px solid var(--rk-primary);
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--rk-shadow-sm);
}

.ranking-side-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--rk-border);
}

.ranking-side-title {
    font-size: 0.88rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--rk-text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--rk-font);
}

.ranking-side-title i {
    color: var(--rk-primary);
}

/* Resumen Stats Grid */
.ranking-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ranking-stat-box {
    background-color: var(--rk-surface-subtle);
    border: 1px solid var(--rk-border);
    padding: 14px;
    border-radius: 8px;
    text-align: center;
}

.ranking-stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--rk-text-muted);
    margin-bottom: 4px;
    font-family: var(--rk-font);
}

.ranking-stat-value {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--rk-text-primary);
    font-family: var(--rk-font);
}

.ranking-stat-value--red {
    color: var(--rk-primary);
}

/* Líderes Top 5 List */
.ranking-leaders-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ranking-leader-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 6px;
    background-color: var(--rk-surface-subtle);
    border: 1px solid var(--rk-border);
    transition: var(--rk-transition);
    cursor: pointer;
}

.ranking-leader-item:hover {
    border-color: var(--rk-primary);
    transform: translateX(3px);
}

.ranking-leader-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.ranking-leader-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--rk-border);
    background-color: #0a0a0a;
    flex-shrink: 0;
}

.ranking-leader-name {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--rk-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.ranking-leader-state {
    font-size: 0.72rem;
    color: var(--rk-text-muted);
}

.ranking-leader-points {
    font-size: 0.95rem;
    font-weight: 900;
    color: var(--rk-primary);
    flex-shrink: 0;
    margin-left: 10px;
    font-family: var(--rk-font);
}

/* Presencia por Estado */
.ranking-states-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

.ranking-state-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    background-color: var(--rk-surface-subtle);
    border: 1px solid var(--rk-border);
    cursor: pointer;
    transition: var(--rk-transition);
}

.ranking-state-row:hover {
    border-color: var(--rk-primary);
    color: var(--rk-primary);
    transform: translateX(3px);
}

.ranking-state-row--active {
    background-color: var(--rk-primary) !important;
    border-color: var(--rk-primary) !important;
    color: #ffffff !important;
}

.ranking-state-badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    background-color: var(--rk-surface);
    color: var(--rk-text-secondary);
    border: 1px solid var(--rk-border);
    font-family: var(--rk-font);
}

.ranking-state-row--active .ranking-state-badge {
    background-color: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    border-color: transparent;
}

/* ==========================================================================
   MODAL DE FICHA TÉCNICA DEL ATLETA CON FOTO
   ========================================================================== */
.ranking-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.ranking-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.ranking-modal {
    background-color: var(--rk-surface);
    border: 2px solid var(--rk-border);
    border-radius: 12px;
    max-width: 480px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.ranking-modal-overlay.active .ranking-modal {
    transform: scale(1);
    animation: rkScaleIn 0.2s ease;
}

.ranking-modal-header {
    background: #000000;
    color: #ffffff;
    padding: 24px;
    position: relative;
    border-bottom: 3px solid var(--rk-primary);
    display: flex;
    align-items: center;
    gap: 16px;
}

.ranking-modal-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--rk-primary);
    box-shadow: 0 4px 10px rgba(242, 45, 58, 0.4);
    flex-shrink: 0;
    background-color: #0a0a0a;
}

.ranking-modal-header-info {
    flex: 1;
    min-width: 0;
}

.ranking-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--rk-transition);
}

.ranking-modal-close:hover {
    background: var(--rk-primary);
}

.ranking-modal-rank {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--rk-primary);
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 6px;
    font-family: var(--rk-font);
}

.ranking-modal-name {
    font-family: var(--rk-font);
    font-size: 1.35rem;
    font-weight: 900;
    margin: 0;
    line-height: 1.2;
}

.ranking-modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ranking-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ranking-modal-stat {
    background-color: var(--rk-surface-subtle);
    border: 1px solid var(--rk-border);
    padding: 12px;
    border-radius: 6px;
}

.ranking-modal-stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--rk-text-muted);
    margin-bottom: 4px;
    font-family: var(--rk-font);
}

.ranking-modal-stat-val {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--rk-text-primary);
    font-family: var(--rk-font);
}

.ranking-modal-stat-val--points {
    color: var(--rk-primary);
    font-size: 1.3rem;
}

.ranking-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.ranking-modal-btn {
    flex: 1;
    padding: 12px 18px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: var(--rk-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--rk-font);
}

.ranking-modal-btn--primary {
    background-color: var(--rk-primary);
    border: 1px solid var(--rk-primary);
    color: #ffffff;
}

.ranking-modal-btn--primary:hover {
    background-color: var(--rk-primary-hover);
    color: #ffffff;
}

.ranking-modal-btn--secondary {
    background-color: transparent;
    border: 1px solid var(--rk-border);
    color: var(--rk-text-primary);
}

.ranking-modal-btn--secondary:hover {
    border-color: var(--rk-text-primary);
}

/* Empty State */
.ranking-empty {
    text-align: center;
    padding: 60px 20px;
    background-color: var(--rk-surface);
    border: 1px solid var(--rk-border);
    border-radius: 10px;
}

.ranking-empty i {
    font-size: 3rem;
    color: var(--rk-text-muted);
    margin-bottom: 16px;
}

.ranking-empty h3 {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0 0 8px;
    color: var(--rk-text-primary);
    font-family: var(--rk-font);
}

.ranking-empty p {
    color: var(--rk-text-muted);
    font-size: 0.9rem;
    margin: 0;
}

/* ==========================================================================
   RESPONSIVE QUERIES
   ========================================================================== */
@media (max-width: 1023px) {
    .ranking-sidebar-col {
        margin-top: 10px;
    }
}

@media (max-width: 768px) {
    .ranking-hero {
        padding-top: calc(var(--navbar-total-height, 100px) + 25px);
        padding-bottom: 40px;
        padding-left: 16px;
        padding-right: 16px;
    }

    .ranking-branches {
        flex-direction: column;
    }

    .ranking-table-card {
        display: none;
    }

    .ranking-mobile-cards {
        display: flex;
    }

    .ranking-filters-card {
        flex-direction: column;
        align-items: stretch;
    }

    .ranking-actions-group {
        justify-content: space-between;
    }

    .ranking-actions-group select {
        flex: 1;
    }

    .ranking-cat-pill {
        flex: 1 1 calc(50% - 8px);
        text-align: center;
        font-size: 0.78rem;
        padding: 8px 10px;
    }
}
