/* ============================================================
   TrophyRecords.css - Pangya NewGen Trophy Records Page
   ============================================================ */

/* ==================== Hero Section ==================== */
.trophyrecords-hero {
    padding: 60px 20px 90px;
    text-align: center;
}

.trophyrecords-hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 10px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.trophyrecords-hero h1 i {
    margin-right: 10px;
    color: #fbbf24;
}

.trophyrecords-hero p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

/* ==================== Container ==================== */
.tr-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px 20px;
    margin-top: -60px;
    position: relative;
    z-index: 10;
}

.tr-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

/* ==================== Header ==================== */
.tr-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;
}

.tr-header-left {
    display: flex;
    align-items: center;
}

.tr-header-center {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.tr-header-right {
    display: flex;
    align-items: center;
}

.tr-btn-home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #f59e0b;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    height: 40px;
    font-family: inherit;
    transition: background 0.2s ease;
}

.tr-btn-home:hover {
    background: #d97706;
    text-decoration: none;
    color: #fff;
}

.tr-search-group {
    display: flex;
    align-items: center;
}

.tr-search-container {
    position: relative;
}

.tr-search-container input {
    width: 240px;
    padding: 10px 16px 10px 40px;
    background: #fff;
    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;
}

.tr-search-container input:focus {
    border-color: #f59e0b;
}

.tr-search-container input::placeholder {
    color: #94a3b8;
}

.tr-search-container .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 13px;
    pointer-events: none;
}

.tr-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;
}

.tr-search-btn:hover {
    background: #d97706;
    border-color: #d97706;
}

.tr-update-text {
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
}

/* ==================== Info Tip ==================== */
.tr-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;
}

.tr-info-tip i {
    color: #f59e0b;
}

/* ==================== Pagination ==================== */
.tr-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 12px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.tr-pagination.bottom {
    border-bottom: none;
    border-top: 1px solid #e2e8f0;
}

.tr-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    background: #fff;
    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;
}

.tr-page-btn:hover:not(.disabled):not(.active) {
    background: #f1f5f9;
    text-decoration: none;
    color: #1e293b;
}

.tr-page-btn.active {
    background: #1e293b;
    border-color: #1e293b;
    color: #fff;
}

.tr-page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.tr-page-dots {
    color: #94a3b8;
    padding: 0 4px;
}

/* ==================== Table ==================== */
.tr-table-wrap {
    overflow-x: auto;
}

.tr-table-wrap::-webkit-scrollbar {
    height: 8px;
}

.tr-table-wrap::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.tr-table-wrap::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.tr-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

/* ==================== Table Header ==================== */
.tr-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;
    cursor: pointer;
    transition: background 0.2s;
}

.tr-table th:last-child {
    border-right: none;
}

.tr-table th:hover {
    background: #f1f5f9;
}

.tr-table th.sorted {
    background: #e2e8f0;
}

.tr-table th.sortable {
    position: relative;
}

.tr-table th.sortable.sorted {
    padding-bottom: 18px;
}

.tr-sort-arrow {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    color: #f59e0b;
    font-size: 10px;
}

/* Tier Header */
.tr-tier-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 4px;
}

.tr-tier-label {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 2px;
    white-space: nowrap;
}

.tr-tier-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.tr-tier-badge.pro {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
}

.tr-tier-badge.amateur {
    background: linear-gradient(135deg, #059669, #047857);
    color: #fff;
}

.tr-tier-name {
    font-size: 10px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 700;
    color: inherit;
}

.tr-tier-icon {
    width: 30px;
    height: auto;
    image-rendering: pixelated;
    display: block;
}

.tr-tier-icon-wrap {
    width: 30px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ==================== Tier Column Backgrounds ==================== */
/* Pro (purple pastel gradient dark->light) */
.tier-pro-7 { background: #c4b5fd !important; }
.tier-pro-6 { background: #d4c8fe !important; }
.tier-pro-5 { background: #ddd6fe !important; }
.tier-pro-4 { background: #e5deff !important; }
.tier-pro-3 { background: #ede9fe !important; }
.tier-pro-2 { background: #f1eefe !important; }
.tier-pro-1 { background: #f5f3ff !important; }

/* Amateur (green pastel gradient dark->light) */
.tier-am-a { background: #a7f3d0 !important; }
.tier-am-b { background: #b8f5db !important; }
.tier-am-c { background: #c8f7e5 !important; }
.tier-am-d { background: #d6f9ed !important; }
.tier-am-e { background: #e4fbf3 !important; }
.tier-am-f { background: #ecfdf5 !important; }

/* Tier header text colors */
.tr-table th[class*="tier-pro"] .tr-tier-name { color: #6d28d9; }
.tr-table th[class*="tier-am"] .tr-tier-name { color: #047857; }

/* Body cells - very subtle tint matching header */
td.cell-pro-7 { background: rgba(196, 181, 253, 0.25) !important; }
td.cell-pro-6 { background: rgba(196, 181, 253, 0.20) !important; }
td.cell-pro-5 { background: rgba(196, 181, 253, 0.16) !important; }
td.cell-pro-4 { background: rgba(196, 181, 253, 0.12) !important; }
td.cell-pro-3 { background: rgba(196, 181, 253, 0.09) !important; }
td.cell-pro-2 { background: rgba(196, 181, 253, 0.06) !important; }
td.cell-pro-1 { background: rgba(196, 181, 253, 0.03) !important; }

td.cell-am-a { background: rgba(16, 185, 129, 0.12) !important; }
td.cell-am-b { background: rgba(16, 185, 129, 0.10) !important; }
td.cell-am-c { background: rgba(16, 185, 129, 0.08) !important; }
td.cell-am-d { background: rgba(16, 185, 129, 0.06) !important; }
td.cell-am-e { background: rgba(16, 185, 129, 0.04) !important; }
td.cell-am-f { background: rgba(16, 185, 129, 0.02) !important; }

/* Hover overrides */
.tr-table tbody tr:hover td[class*="cell-"] { background: #f1f5f9 !important; }
.tr-table tbody tr.rank-1 td[class*="cell-"] { background: #fef9c3 !important; }
.tr-table tbody tr.rank-2 td[class*="cell-"] { background: #f1f5f9 !important; }
.tr-table tbody tr.rank-3 td[class*="cell-"] { background: #ffedd5 !important; }

/* ==================== Table Body ==================== */
.tr-table td {
    padding: 6px 6px;
    text-align: center !important;
    vertical-align: middle;
    font-size: 13px;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    white-space: nowrap;
    background: #fff;
}

.tr-table td:last-child { border-right: none; }
.tr-table td.col-player { text-align: left !important; }
.tr-table tbody tr:nth-child(even) td { background: #f8fafc; }
.tr-table tbody tr:hover td { background: #f1f5f9 !important; }

/* Top 3 */
.tr-table tbody tr.rank-1 td { background: #fef9c3 !important; }
.tr-table tbody tr.rank-2 td { background: #f1f5f9 !important; }
.tr-table tbody tr.rank-3 td { background: #ffedd5 !important; }

/* ==================== Sticky Columns ==================== */
.col-rank,
.col-player {
    position: sticky;
    z-index: 2;
}

.col-rank {
    left: 0;
    min-width: 50px;
}

.col-lv {
    min-width: 40px;
}

.col-player {
    left: 50px;
    min-width: 160px;
    border-right: 2px solid #cbd5e1 !important;
    box-shadow: 4px 0 8px rgba(0, 0, 0, 0.06);
}

.col-pts { min-width: 70px; }
.col-medal { min-width: 50px; }

.tr-table thead th.col-rank,
.tr-table thead th.col-player {
    z-index: 3;
    background: #f8fafc !important;
}

/* ==================== Rank Badge ==================== */
.tr-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 .tr-rank-badge {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #78350f;
    box-shadow: 0 2px 6px rgba(251, 191, 36, 0.4);
}

.rank-2 .tr-rank-badge {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    color: #334155;
}

.rank-3 .tr-rank-badge {
    background: linear-gradient(135deg, #fdba74, #fb923c);
    color: #7c2d12;
}

/* ==================== Player Cell ==================== */
.tr-player-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tr-guild-emblem {
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 2px;
    background: #f8fafc;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tr-guild-emblem img {
    display: block;
}

.tr-player-info {
    display: flex;
    flex-direction: column;
}

.tr-player-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 13px;
}

.tr-club-name {
    font-size: 10px;
    color: #64748b;
}

/* ==================== Points ==================== */
.tr-total-points {
    display: inline-block;
    padding: 4px 10px;
    background: #e2e8f0;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
    color: #1e293b;
}

/* ==================== Medal Counts ==================== */
.tr-medal-gold { color: #d97706; font-weight: 700; }
.tr-medal-silver { color: #64748b; font-weight: 700; }
.tr-medal-bronze { color: #b45309; font-weight: 700; }
.col-medal-icon { image-rendering: pixelated; }

/* ==================== Tier Cell - Mini Medals ==================== */
.tr-tier-cell {
    display: flex;
    gap: 4px;
    justify-content: center;
    align-items: center;
    font-size: 11px;
}

.tr-tier-cell .mini-medal {
    display: inline-flex;
    align-items: baseline;
    gap: 1px;
}

.tr-tier-cell .mini-medal .m-icon { vertical-align: middle; }
.tr-tier-cell .mini-medal .m-count { vertical-align: middle; line-height: 1; }
.tr-tier-cell .m-gold { color: #d97706; }
.tr-tier-cell .m-silver { color: #9ca3af; }
.tr-tier-cell .m-bronze { color: #b45309; }
.tr-tier-cell .m-icon { width: 13px; height: auto; vertical-align: middle; margin-right: 1px; }
.tr-tier-cell .m-count { font-weight: 600; font-size: 13px; }
.tr-empty-tier { color: #d1d5db; }

/* ==================== Top Record in Tier ==================== */
.tr-tier-record {
    position: relative;
    display: inline-flex;
    gap: 4px;
    justify-content: center;
    align-items: center;
    padding: 2px 6px;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fca5a5;
    border-radius: 6px;
    animation: tr-glow 2s ease-in-out infinite;
}

.tr-tier-record .m-icon { width: 13px; height: auto; }
.tr-tier-record .m-count { font-weight: 600; font-size: 13px; }

.tr-tier-record::before {
    content: '🏆';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 16px;
    animation: tr-bounce 1s ease-in-out infinite;
}

@keyframes tr-glow {
    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 tr-bounce {
    0%, 100% { transform: translateY(0) rotate(-10deg); }
    50% { transform: translateY(-2px) rotate(10deg); }
}

/* Summary separator */
.col-summary-border {
    border-right: 2px solid #cbd5e1 !important;
}

/* Level image */
.lv-img {
    width: 40px;
    height: auto;
}

/* ==================== Footer ==================== */
.tr-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;
}

.tr-footer-stats {
    display: flex;
    gap: 20px;
    color: #64748b;
    font-size: 12px;
}

.tr-footer-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Legend */
.tr-legend {
    display: flex;
    gap: 16px;
    align-items: center;
}

.tr-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #64748b;
}

.tr-legend-item .sample-record {
    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 ==================== */
.tr-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

/* ==================== Responsive ==================== */
@media (max-width: 1024px) {
    .tr-header {
        flex-direction: column;
        align-items: stretch;
    }

    .tr-header-left,
    .tr-header-center,
    .tr-header-right {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .trophyrecords-hero {
        padding: 50px 20px 70px;
    }

    .trophyrecords-hero h1 {
        font-size: 1.8rem;
    }

    .trophyrecords-hero p {
        font-size: 1rem;
    }

    .tr-container {
        padding: 0 10px 10px;
        margin-top: -50px;
    }

    .tr-header-center {
        flex-direction: column;
        width: 100%;
    }

    .tr-btn-home {
        width: 100%;
        justify-content: center;
    }

    .tr-search-group {
        width: 100%;
    }

    .tr-search-container {
        flex: 1;
    }

    .tr-search-container input {
        width: 100%;
    }

    .col-rank {
        min-width: 40px;
    }

    .col-player {
        left: 40px;
        min-width: 120px;
    }

    .tr-footer {
        flex-direction: column;
        text-align: center;
    }
}
