/* ============================================================
   WorldRecords.css - Pangya NewGen World Records Page
   ============================================================ */

/* ==================== Hero Section ==================== */
.worldrecords-hero {
    padding: 80px 20px 100px;
    text-align: center;
}

.worldrecords-hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 10px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.worldrecords-hero h1 i {
    margin-right: 10px;
}

.worldrecords-hero p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

/* ==================== Reset & Base ==================== */
.wr-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px 20px;
    margin-top: -60px;
    position: relative;
    z-index: 10;
}

.wr-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

/* ==================== Header ==================== */
.wr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 12px;
}

.wr-header-left {
    display: flex;
    align-items: center;
}

.wr-header-center {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.wr-btn-home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #f59e0b;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    height: 40px;
    font-family: inherit;
    transition: background 0.2s ease;
}

.wr-btn-home:hover {
    background: #d97706;
    text-decoration: none;
    color: #ffffff;
}

.wr-search-group {
    display: flex;
    align-items: center;
}

.wr-search-container {
    position: relative;
}

.wr-search-container input {
    width: 240px;
    padding: 10px 16px 10px 40px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: #1e293b;
    font-size: 13px;
    font-family: inherit;
    height: 40px;
    outline: none;
    transition: border-color 0.2s ease;
}

.wr-search-container input:focus {
    border-color: #f59e0b;
}

.wr-search-container input::placeholder {
    color: #94a3b8;
}

.wr-search-container .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 13px;
    pointer-events: none;
}

.wr-search-btn {
    padding: 10px 20px;
    background: #f59e0b;
    border: 2px solid #f59e0b;
    border-radius: 0 8px 8px 0;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    height: 40px;
    transition: all 0.2s ease;
}

.wr-search-btn:hover {
    background: #d97706;
    border-color: #d97706;
}

.wr-header-right {
    display: flex;
    align-items: center;
}

.wr-update-text {
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
}

/* ==================== Info Tip ==================== */
.wr-info-tip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    color: #92400e;
    font-size: 13px;
}

.wr-info-tip i {
    color: #f59e0b;
}

/* ==================== Pagination ==================== */
.wr-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 12px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.wr-pagination.bottom {
    border-bottom: none;
    border-top: 1px solid #e2e8f0;
}

.wr-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    background: #ffffff;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wr-page-btn:hover:not(.disabled):not(.active) {
    background: #f1f5f9;
    text-decoration: none;
    color: #1e293b;
}

.wr-page-btn.active {
    background: #1e293b;
    border-color: #1e293b;
    color: #fff;
}

.wr-page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.wr-page-dots {
    color: #94a3b8;
    padding: 0 4px;
}

/* ==================== Table ==================== */
.wr-table-wrap {
    overflow-x: auto;
}

.wr-table-wrap::-webkit-scrollbar {
    height: 8px;
}

.wr-table-wrap::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.wr-table-wrap::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.wr-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

/* ==================== Table Header ==================== */
.wr-table th {
    padding: 8px 6px;
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    white-space: nowrap;
    vertical-align: middle !important;
    text-align: center !important;
}

.wr-table th:last-child {
    border-right: none;
}

.wr-table th.sortable {
    cursor: pointer;
    transition: background 0.2s ease;
}

.wr-table th.sortable:hover {
    background: #f1f5f9;
}

.wr-table th.sorted {
    background: #e2e8f0;
}

.wr-sort-arrow {
    color: #f59e0b;
    font-size: 10px;
    margin-left: 4px;
}

/* Map Header */
.wr-map-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 2px;
}

.wr-map-icon img {
    width: 60px;
    height: auto;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    transition: all 0.2s ease;
}

.wr-table th.sortable:hover .wr-map-icon img {
    border-color: #fbbf24;
    transform: scale(1.05);
}

.wr-map-icon span {
    font-size: 10px;
    color: #475569;
    text-transform: none;
    letter-spacing: 0;
}

/* ==================== Table Body ==================== */
.wr-table td {
    padding: 6px 6px;
    text-align: center !important;
    vertical-align: middle !important;
    font-size: 13px;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    white-space: nowrap;
    background: #ffffff;
}

.wr-table td:last-child {
    border-right: none;
}

/* Player column - LEFT align (td only) */
.wr-table td.col-sticky-3 {
    text-align: left !important;
}

/* Level image */
.wr-table td.col-sticky-2 img {
    width: 40px;
    height: auto;
    max-width: unset;
}

/* Row colors */
.wr-table tbody tr:nth-child(even) td {
    background: #f8fafc;
}

.wr-table tbody tr:hover td {
    background: #f1f5f9 !important;
}

/* Top 3 */
.wr-table tbody tr.rank-1 td {
    background: #fef9c3 !important;
}

.wr-table tbody tr.rank-2 td {
    background: #f1f5f9 !important;
}

.wr-table tbody tr.rank-3 td {
    background: #ffedd5 !important;
}

/* ==================== Sticky Columns ==================== */
/* Only Rank and Player are sticky */
.col-sticky-1,
.col-sticky-3 {
    position: sticky;
    z-index: 2;
    text-align: center;
    vertical-align: middle;
}

.col-sticky-1 {
    left: 0;
    min-width: 50px;
}

.col-sticky-3 {
    left: 90px;
    /* Start after Rank(50) + Lv(40), JS will adjust dynamically */
    min-width: 160px;
    text-align: left;
    border-right: 2px solid #cbd5e1 !important;
    box-shadow: 4px 0 8px rgba(0, 0, 0, 0.06);
    transition: left 0.05s ease-out;
}

/* Lv and Total are NOT sticky - will scroll away */
.col-sticky-2,
.col-sticky-4 {
    text-align: center;
    vertical-align: middle;
}

.col-sticky-2 {
    min-width: 40px;
}

.col-sticky-4 {
    min-width: 70px;
}

/* Header sticky - higher z-index */
.wr-table thead th.col-sticky-1,
.wr-table thead th.col-sticky-3 {
    z-index: 3;
    background: #f8fafc !important;
}

.wr-table thead th.col-sticky-4.sorted {
    background: #e2e8f0 !important;
}

/* ==================== Rank Badge ==================== */
.wr-rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 12px;
    background: #f1f5f9;
    color: #64748b;
}

.rank-1 .wr-rank-badge {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #78350f;
    box-shadow: 0 2px 6px rgba(251, 191, 36, 0.4);
}

.rank-2 .wr-rank-badge {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    color: #334155;
}

.rank-3 .wr-rank-badge {
    background: linear-gradient(135deg, #fdba74 0%, #fb923c 100%);
    color: #7c2d12;
}

/* ==================== Player Cell ==================== */
.wr-player-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wr-guild-emblem {
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 2px;
    background: #f8fafc;
}

.wr-guild-emblem img {
    display: block;
}

.wr-player-info {
    display: flex;
    flex-direction: column;
}

.wr-player-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 13px;
}

.wr-club-name {
    font-size: 10px;
    color: #64748b;
}

/* ==================== Scores ==================== */
.wr-total-score {
    display: inline-block;
    padding: 4px 10px;
    background: #e2e8f0;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
    color: #1e293b;
}

.wr-map-score {
    font-weight: 600;
    color: #475569;
}

.wr-map-score.empty {
    color: #d1d5db;
}

/* World Record */
.wr-world-record {
    position: relative;
    display: inline-block;
    padding: 3px 8px;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fca5a5;
    border-radius: 6px;
    color: #dc2626;
    font-weight: 700;
    animation: wr-glow-record 2s ease-in-out infinite;
}

.wr-world-record::before {
    content: '👑';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 14px;
    animation: wr-bounce-crown 1s ease-in-out infinite;
}

@keyframes wr-glow-record {

    0%,
    100% {
        box-shadow: 0 0 4px rgba(220, 38, 38, 0.15);
    }

    50% {
        box-shadow: 0 0 12px rgba(220, 38, 38, 0.3);
    }
}

@keyframes wr-bounce-crown {

    0%,
    100% {
        transform: translateY(0) rotate(-10deg);
    }

    50% {
        transform: translateY(-2px) rotate(10deg);
    }
}

/* ==================== Footer ==================== */
.wr-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 12px;
}

.wr-footer-stats {
    display: flex;
    gap: 20px;
    color: #64748b;
    font-size: 12px;
}

.wr-footer-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.wr-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #64748b;
}

.wr-legend-item .sample {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fca5a5;
    color: #dc2626;
}

/* ==================== Empty State ==================== */
.wr-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

/* ==================== Responsive ==================== */
@media (max-width: 1024px) {
    .wr-header {
        flex-direction: column;
        align-items: stretch;
    }

    .wr-header-left,
    .wr-header-center,
    .wr-header-right {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .worldrecords-hero {
        padding: 60px 20px 80px;
    }

    .worldrecords-hero h1 {
        font-size: 1.8rem;
    }

    .worldrecords-hero p {
        font-size: 1rem;
    }

    .wr-container {
        padding: 0 10px 10px;
        margin-top: -50px;
    }

    .wr-header-center {
        flex-direction: column;
        width: 100%;
    }

    .wr-btn-home {
        width: 100%;
        justify-content: center;
    }

    .wr-search-group {
        width: 100%;
    }

    .wr-search-container {
        flex: 1;
    }

    .wr-search-container input {
        width: 100%;
    }

    .col-sticky-1 {
        min-width: 40px;
    }

    .col-sticky-2 {
        left: 40px;
        min-width: 35px;
    }

    .col-sticky-3 {
        left: 75px;
        min-width: 120px;
    }

    .col-sticky-4 {
        left: 195px;
        min-width: 60px;
    }

    .wr-map-icon img {
        width: 40px;
        height: 40px;
    }

    .wr-map-icon span {
        font-size: 9px;
    }

    .wr-footer {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .col-sticky-1 {
        min-width: 36px;
    }

    .col-sticky-2 {
        left: 36px;
        min-width: 30px;
    }

    .col-sticky-3 {
        left: 66px;
        min-width: 100px;
    }

    .col-sticky-4 {
        left: 166px;
        min-width: 55px;
    }

    .wr-rank-badge {
        width: 26px;
        height: 26px;
        font-size: 10px;
    }

    .wr-guild-emblem {
        width: 24px;
        height: 24px;
    }

    .wr-player-name {
        font-size: 11px;
    }

    .wr-club-name {
        font-size: 9px;
    }

    .wr-total-score {
        padding: 2px 6px;
        font-size: 11px;
    }

    .wr-map-icon img {
        width: 36px;
        height: 36px;
    }
}