/* ========================================
   8. Ranking Page Styles - Retro Identity
   ======================================== */

.retro-ranking-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 80vh;
    padding: 100px 20px 60px;
    position: relative;
    z-index: 10;
}

.retro-ranking-container {
    width: 100%;
    max-width: 1280px; /* Wider for better table display */
    margin: 0; /* Margin handled by wrapper padding */
    /* Glassmorphism background matching auth box */
    background: rgba(24, 7, 7, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(240, 103, 6, 0.3); /* Retro orange border */
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
}

/* Header Section */
.retro-ranking-header {
    padding: 32px 40px;
    background: linear-gradient(180deg, rgba(240, 103, 6, 0.1) 0%, rgba(24, 7, 7, 0) 100%);
    border-bottom: 1px solid rgba(240, 103, 6, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.retro-ranking-title {
    font-family: 'Raritas', sans-serif;
    font-size: 36px;
    color: #fff0d4;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 10px rgba(240, 103, 6, 0.3);
    line-height: 1.2;
}

.retro-ranking-description {
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    color: rgba(255, 240, 212, 0.6);
    margin-top: 4px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* Search Bar */
.retro-ranking-search {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 4px;
    width: 100%;
    max-width: 300px;
    transition: all 0.3s ease;
}

.retro-ranking-search:focus-within {
    border-color: #f06706;
    box-shadow: 0 0 10px rgba(240, 103, 6, 0.2);
}

.retro-search-input {
    background: transparent;
    border: none;
    color: #fff;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    padding: 8px 12px;
    width: 100%;
    outline: none;
}

.retro-search-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.retro-search-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    padding: 8px;
    cursor: pointer;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.retro-search-btn:hover {
    color: #f06706;
}

/* Tabs styled with Retro identity */
.retro-ranking-tabs {
    display: flex;
    gap: 2px;
    padding: 0 40px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.retro-tab-btn {
    padding: 20px 32px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: rgba(255, 240, 212, 0.5);
    font-family: 'Raritas', sans-serif;
    font-size: 16px;
    font-weight: 400;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    letter-spacing: 1px;
}

.retro-tab-btn:hover {
    color: #fff0d4;
    background: rgba(255, 255, 255, 0.02);
}

.retro-tab-btn.active {
    color: #f06706;
    border-bottom-color: #f06706;
    background: linear-gradient(180deg, rgba(240, 103, 6, 0.05) 0%, rgba(240, 103, 6, 0.0) 100%);
    text-shadow: 0 0 10px rgba(240, 103, 6, 0.4);
}

/* Table Content */
.retro-ranking-content {
    padding: 0;
    min-height: 500px;
    flex: 1;
}

.retro-tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.retro-tab-content.active {
    display: block;
}

/* Table Styles */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.retro-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.retro-table th {
    text-align: left;
    padding: 20px 32px;
    background: rgba(0, 0, 0, 0.2);
    color: rgba(255, 240, 212, 0.4);
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.retro-table td {
    padding: 18px 32px;
    color: #e0e0e0; /* Slightly off-white for better readability */
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.2s;
    vertical-align: middle;
}

.retro-table tr:last-child td {
    border-bottom: none;
}

.retro-table tr:hover td {
    background: rgba(240, 103, 6, 0.05);
    color: #fff;
}

/* Rank Styling */
.rank-cell {
    font-family: 'Raritas', sans-serif;
    font-size: 22px;
    font-weight: 400;
    width: 60px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5); /* Default rank color */
}

.rank-1 { 
    color: #ffd700; 
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    font-size: 26px;
}
.rank-2 { 
    color: #e0e0e0; 
    text-shadow: 0 0 15px rgba(224, 224, 224, 0.4);
    font-size: 26px;
}
.rank-3 { 
    color: #cd7f32; 
    text-shadow: 0 0 15px rgba(205, 127, 50, 0.4);
    font-size: 26px;
}

/* Name Cell */
.name-cell {
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.5px;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    box-shadow: 0 0 8px currentColor;
}

/* Mobile Adjustments */
@media (max-width: 991px) {
    .retro-ranking-container {
        margin: 20px 10px; /* Reduced margin */
        width: 100%;
        border-radius: 12px;
        border-width: 1px;
    }
    
    .retro-ranking-wrapper {
        padding: 80px 10px 40px; /* Reduce side padding for more width */
    }

    .retro-ranking-header {
        padding: 20px 16px;
        flex-direction: column;
        align-items: stretch; /* Full width for search */
    }
    
    .retro-ranking-search {
        max-width: 100%;
        margin-top: 12px;
    }

    .retro-ranking-tabs {
        padding: 0 8px;
        gap: 0; /* Remove gap to fit more tabs */
    }

    .retro-tab-btn {
        padding: 14px 16px;
        font-size: 13px;
        flex: 1; /* Distribute space */
        text-align: center;
    }

    .retro-table th, 
    .retro-table td {
        padding: 12px 10px; /* Significantly reduced padding */
        font-size: 13px;
    }
    
    /* Make table scrollable but sticky first column */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
    }
    
    .retro-table th:first-child,
    .retro-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 2;
        background: rgba(24, 7, 7, 0.95); /* Opaque background to hide scroll */
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    }
    
    /* Hide less critical columns on mobile for specific tabs */
    
    /* Players Tab: Hide Class(3), Level(4), Clan(5) */
    #players .retro-table th:nth-child(3), #players .retro-table td:nth-child(3),
    #players .retro-table th:nth-child(4), #players .retro-table td:nth-child(4),
    #players .retro-table th:nth-child(5), #players .retro-table td:nth-child(5) {
        display: none;
    }
    
    /* Guilds Tab: Hide Leader(3), Level(4), Members(5) */
    #guilds .retro-table th:nth-child(3), #guilds .retro-table td:nth-child(3),
    #guilds .retro-table th:nth-child(4), #guilds .retro-table td:nth-child(4),
    #guilds .retro-table th:nth-child(5), #guilds .retro-table td:nth-child(5) {
        display: none;
    }
    
    /* Traders Tab: Hide Transactions(4) */
    #traders .retro-table th:nth-child(4), #traders .retro-table td:nth-child(4) {
        display: none;
    }
    
    /* Thieves Tab: Hide Karma(4) */
    #thieves .retro-table th:nth-child(4), #thieves .retro-table td:nth-child(4) {
        display: none;
    }

    .retro-table th:nth-child(6), .retro-table td:nth-child(6) { /* PvP/PK or Reputation */
        text-align: right;
    }
    
    /* Status column only exists in Players tab */
    #players .retro-table th:last-child, #players .retro-table td:last-child {
        text-align: right;
        width: 1%;
        white-space: nowrap;
    }
    
    .status-badge {
        font-size: 0; /* Hide status text on mobile */
    }
    
    .status-badge .status-dot {
        margin: 0;
        width: 8px;
        height: 8px;
    }

    .rank-cell {
        width: 30px;
        font-size: 14px;
        text-align: center;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    
    .rank-1, .rank-2, .rank-3 {
        font-size: 16px;
    }
    
    .name-cell {
        font-weight: 700;
        color: #fff;
    }
}
