/* ============================================
   RANKINGS MODULE - ELEGANT DESIGN
   Estilo elegante inspirado en Balduneta MU
   ============================================ */

/* Variables específicas para rankings */
:root {
    --ranking-cyan: #00d4ff;
    --ranking-cyan-dark: #0099cc;
    --ranking-cyan-light: #5ce1ff;
}

/* Contenedor principal del ranking */
.rankings-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    overflow: visible;
}

/* Header estilo missions.css */
.page-title {
    margin-bottom: 2rem;
    padding: 0;
}

.rankings-header-wrapper {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: rgba(10, 10, 15, 0.6);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.rankings-icon-container {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    border-radius: 50%;
    font-size: 1.5rem;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
}

.rankings-title-content {
    flex: 1;
}

.rankings-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #e0e0e0;
    margin: 0 0 0.5rem 0;
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.rankings-subtitle {
    font-size: 1rem;
    color: #9e9e9e;
    margin: 0;
}

/* Menú de navegación de rankings */
.rankings-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--ranking-bg-card);
    border-radius: 1rem;
    backdrop-filter: blur(10px);
    border: 1px solid var(--ranking-border);
}

.rankings-menu a {
    padding: 0.75rem 1.5rem;
    background: rgba(0, 212, 255, 0.1);
    color: #00d4ff;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.rankings-menu a:hover {
    background: rgba(0, 212, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.rankings-menu a.active {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: #ffffff;
    border-color: transparent;
}

/* Wrapper para scroll horizontal de la tabla - Desktop (sin scroll) */
.table-scroll-wrapper {
    width: 100%;
    overflow-x: visible;
    overflow-y: visible;
    margin-bottom: 1rem;
}

/* Tabla de rankings - Estilo elegante Balduneta */
table.rankings-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: rgba(10, 10, 15, 0.6);
    border: 1px solid #00d4ff !important;
    border-radius: 0.75rem !important;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3), 0 0 40px rgba(0, 212, 255, 0.15);
    overflow: hidden;
    table-layout: auto;
}

/* Header de la tabla */
table.rankings-table thead {
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(0, 212, 255, 0.2);
}

table.rankings-table thead th {
    padding: 1rem 1rem;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #00d4ff;
    text-align: center;
    border: none;
}

table.rankings-table thead th:first-child {
    text-align: center;
}

table.rankings-table thead th:nth-child(2) {
    text-align: center;
}

table.rankings-table thead th:nth-child(3) {
    text-align: left;
}

table.rankings-table thead th:nth-child(4),
table.rankings-table thead th:nth-child(5),
table.rankings-table thead th:nth-child(6),
table.rankings-table thead th:nth-child(7) {
    text-align: center;
}

/* Filas del cuerpo - Patrón moderno estilo Balduneta */
table.rankings-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    transition: background 0.2s ease;
    background: transparent;
}

/* Patrón alternado muy sutil */
table.rankings-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

table.rankings-table tbody tr:hover {
    background: rgba(0, 212, 255, 0.05);
}

table.rankings-table tbody tr:last-child {
    border-bottom: none;
}

/* Celdas del cuerpo */
table.rankings-table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border: none;
    color: #e0e0e0;
    font-size: 0.9rem;
}

table.rankings-table tbody td:first-child {
    text-align: center;
    font-weight: 700;
    color: #00d4ff;
    font-size: 1.1rem;
}

table.rankings-table tbody td:nth-child(2) {
    text-align: center;
}

table.rankings-table tbody td:nth-child(3) {
    text-align: left;
    font-weight: 600;
    color: #ffffff;
}

table.rankings-table tbody td:nth-child(4),
table.rankings-table tbody td:nth-child(5),
table.rankings-table tbody td:nth-child(6),
table.rankings-table tbody td:nth-child(7) {
    text-align: center !important;
    font-weight: 500;
    color: #9e9e9e;
}

/* Fix alignment for score column in guilds ranking (5th column) */
table.rankings-table tbody td:nth-child(5) {
    text-align: center !important;
}

table.rankings-table thead th:nth-child(5) {
    text-align: center !important;
}

table.rankings-table tbody td:nth-child(4) span,
table.rankings-table tbody td:nth-child(5) span,
table.rankings-table tbody td:nth-child(6) span,
table.rankings-table tbody td:nth-child(7) span {
    display: block;
    text-align: center;
    width: 100%;
}

/* Avatar del personaje - Minimalista */
table.rankings-table .character-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.3);
}

table.rankings-table .character-avatar:hover {
    border-color: rgba(0, 212, 255, 0.5);
}

table.rankings-table .character-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Badge de ranking - Minimalista */
table.rankings-table .rank-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.9);
    color: #ff8c00;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 140, 0, 0.6);
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Badges para TOP 3 - Colores sutiles */
table.rankings-table tbody tr:nth-child(1) .rank-badge {
    color: #FFD700;
    border-color: rgba(255, 215, 0, 0.5);
}

table.rankings-table tbody tr:nth-child(2) .rank-badge {
    color: #C0C0C0;
    border-color: rgba(192, 192, 192, 0.5);
}

table.rankings-table tbody tr:nth-child(3) .rank-badge {
    color: #CD7F32;
    border-color: rgba(205, 127, 50, 0.5);
}

/* Indicador de online */
table.rankings-table .online-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #00ff00;
    margin-left: 0.5rem;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
    animation: pulse 2s ease-in-out infinite;
    vertical-align: middle;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
    }
    50% {
        opacity: 0.6;
        box-shadow: 0 0 5px rgba(0, 255, 0, 0.4);
    }
}

/* Link del perfil del jugador */
table.rankings-table .player-profile-link {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: inline-block;
    background: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

table.rankings-table .player-profile-link:hover {
    color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.6);
    transform: translateX(4px);
    background: none !important;
}

/* Guild logo y nombre */
table.rankings-table .guild-logo {
    vertical-align: middle;
    display: inline-block;
    margin-right: 0.5rem;
}

/* Timestamp de actualización */
.rankings-update-time {
    text-align: center;
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(0, 212, 255, 0.05);
    border-radius: 0.5rem;
    color: #9e9e9e;
    font-size: 0.85rem;
    border: 1px solid rgba(0, 212, 255, 0.1);
}

/* Guilds Ranking Specific Styles */
#rankings tbody td:nth-child(1) {
    width: 60px;
    text-align: center;
}

#rankings tbody td:nth-child(2) {
    width: 80px;
    text-align: center;
}

#rankings tbody td:nth-child(3) {
    width: 25%;
    text-align: left;
}

#rankings tbody td:nth-child(4) {
    width: 25%;
    text-align: center;
}

#rankings tbody td:nth-child(5) {
    width: 120px;
    text-align: center !important;
}

#rankings thead th:nth-child(1) {
    width: 60px;
}

#rankings thead th:nth-child(2) {
    width: 80px;
}

#rankings thead th:nth-child(3) {
    width: 25%;
}

#rankings thead th:nth-child(4) {
    width: 25%;
}

#rankings thead th:nth-child(5) {
    width: 120px;
    text-align: center !important;
}

/* Level Ranking - Green color for resets numbers (5th column) */
table.rankings-table tbody tr td:nth-child(5) {
    color: #22c55e !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
}

/* Responsive */
@media (max-width: 1024px) {
    .rankings-container {
        padding: 1.5rem;
    }
    
    table.rankings-table thead th,
    table.rankings-table tbody td {
        padding: 1rem 1rem;
        font-size: 0.9rem;
    }
    
    .page-title span {
        font-size: 2.5rem;
    }
    
    .page-title span::before {
        left: -50px;
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .rankings-container {
        padding: 0.5rem;
        overflow: visible;
    }
    
    /* Header simplificado en móvil */
    .rankings-header-wrapper {
        padding: 0.75rem;
        background: transparent;
        border: none;
        box-shadow: none;
    }
    
    .rankings-icon-container {
        display: none;
    }
    
    .rankings-title-content {
        width: 100%;
        text-align: center;
    }
    
    .rankings-title {
        font-size: 1.5rem;
        margin: 0;
    }
    
    .rankings-subtitle {
        display: none;
    }
    
    .rankings-menu {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .rankings-menu a {
        text-align: center;
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
        width: 100%;
    }
    
    .page-title span {
        font-size: 2rem;
        letter-spacing: 1px;
    }
    
    .page-title span::before {
        position: relative;
        left: 0;
        display: block;
        margin-bottom: 0.5rem;
    }
    
    /* Wrapper interno para scroll de tabla */
    table.rankings-table {
        display: block;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        font-size: 0.75rem;
        width: 100%;
        max-width: 100%;
    }
    
    table.rankings-table::-webkit-scrollbar {
        height: 10px;
    }
    
    table.rankings-table::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.3);
        border-radius: 5px;
    }
    
    table.rankings-table::-webkit-scrollbar-thumb {
        background: rgba(0, 212, 255, 0.6);
        border-radius: 5px;
    }
    
    table.rankings-table::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 212, 255, 0.8);
    }
    
    table.rankings-table thead,
    table.rankings-table tbody {
        display: table;
        width: 100%;
    }
    
    table.rankings-table thead {
        width: 100%;
    }
    
    table.rankings-table tbody {
        display: block;
        width: 100%;
    }
    
    table.rankings-table tbody tr {
        display: table;
        width: 100%;
        table-layout: fixed;
        min-width: 650px;
    }
    
    table.rankings-table thead tr {
        display: table;
        width: 100%;
        table-layout: fixed;
        min-width: 650px;
    }
    
    table.rankings-table thead th,
    table.rankings-table tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.75rem;
    }
    
    table.rankings-table .character-avatar {
        width: 40px;
        height: 40px;
    }
    
    table.rankings-table .rank-badge {
        width: 22px;
        height: 22px;
        font-size: 0.75rem;
        font-weight: 700;
        top: -5px;
        right: -5px;
    }
}

@media (max-width: 480px) {
    .rankings-container {
        padding: 0.5rem;
        overflow: visible;
    }
    
    .rankings-menu {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.4rem;
        padding: 0.5rem;
    }
    
    .rankings-menu a {
        padding: 0.5rem 0.5rem;
        font-size: 0.75rem;
        width: 100%;
    }
    
    .page-title span {
        font-size: 1.5rem;
    }
    
    table.rankings-table {
        display: block;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        font-size: 0.7rem;
        width: 100%;
        max-width: 100%;
    }
    
    table.rankings-table::-webkit-scrollbar {
        height: 10px;
    }
    
    table.rankings-table::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.3);
        border-radius: 5px;
    }
    
    table.rankings-table::-webkit-scrollbar-thumb {
        background: rgba(0, 212, 255, 0.6);
        border-radius: 5px;
    }
    
    table.rankings-table thead,
    table.rankings-table tbody {
        display: table;
        width: 100%;
    }
    
    table.rankings-table thead {
        width: 100%;
    }
    
    table.rankings-table tbody {
        display: block;
        width: 100%;
    }
    
    table.rankings-table tbody tr {
        display: table;
        width: 100%;
        table-layout: fixed;
        min-width: 900px;
    }
    
    table.rankings-table thead tr {
        display: table;
        width: 100%;
        table-layout: fixed;
        min-width: 900px;
    }
    
    table.rankings-table thead th,
    table.rankings-table tbody td {
        padding: 0.6rem 0.4rem;
        font-size: 0.7rem;
    }
    
    table.rankings-table .character-avatar {
        width: 36px;
        height: 36px;
    }
    
    table.rankings-table .rank-badge {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
        font-weight: 700;
        top: -5px;
        right: -5px;
    }
}
