/* css/ranking.css - PHIÊN BẢN HOÀN THIỆN CUỐI CÙNG */

/* Panel & Tabs (Giữ nguyên) */
.ranking-panel-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(12, 12, 12, 0.85); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 15px; box-sizing: border-box; backdrop-filter: blur(5px); opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0s 0.3s; }
.ranking-panel-overlay:not(.hidden) { opacity: 1; visibility: visible; }
.ranking-panel-content { position: relative; width: 100%; max-width: 500px; height: 90%; max-height: 750px; background-color: #1a1a1d; border-radius: 8px; border: 1px solid #4a4a52; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); color: #e0e0e0; overflow: hidden; display: flex; flex-direction: column; transform: scale(0.95); opacity: 0; transition: transform 0.3s ease, opacity 0.2s ease; }
.ranking-panel-overlay:not(.hidden) .ranking-panel-content { transform: scale(1); opacity: 1; }
.ranking-close-btn { position: absolute; top: 10px; right: 15px; background: none; border: none; color: #aaa; font-size: 2.5em; cursor: pointer; z-index: 20; }
.ranking-main-title { text-align: center; font-family: 'Cinzel', serif; font-size: 1.8em; color: #E48F45; margin: 20px 0; text-shadow: 0 0 8px rgba(228, 143, 69, 0.5); flex-shrink: 0; }
.ranking-tabs-nav { display: flex; justify-content: center; padding: 0 20px; border-bottom: 2px solid #3a3a40; flex-shrink: 0; }
.ranking-tab-link { padding: 10px 20px; background: transparent; border: none; color: #888; font-size: 1em; font-weight: 600; cursor: pointer; position: relative; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.3s ease; }
.ranking-tab-link:hover { color: #fff; }
.ranking-tab-link.active { color: #E48F45; border-bottom-color: #E48F45; }
.ranking-content-wrapper { flex-grow: 1; overflow: hidden; padding: 15px; }
.ranking-tab-content { height: 100%; overflow-y: auto; padding-right: 10px; }
.ranking-tab-content.active { display: block; }
.ranking-header { display: none; }

/* === BỐ CỤC DANH SÁCH XẾP HẠNG MỚI === */
.ranking-list { display: flex; flex-direction: column; gap: 15px; }

.ranking-entry {
    position: relative; /* QUAN TRỌNG: Để định vị danh hiệu */
    background: #25282e;
    border: 1px solid #4a4a52;
    border-radius: 6px;
    display: flex;
    align-items: stretch;
    gap: 10px;
    padding: 10px;
    overflow: hidden; /* Giấu phần thừa của danh hiệu */
}

/* DANH HIỆU GÓC TRÁI */
.rank-title-banner {
    position: absolute;
    top: -1px;
    left: -1px;
    padding: 4px 12px;
    font-size: 0.85em;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 1px #000;
    border-radius: 6px 0 6px 0; /* Bo góc chéo */
    border-right: 1px solid rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(0,0,0,0.2);
}

.rank-number-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
}
.rank-number {
    font-size: 2.2em;
    font-weight: bold;
    color: #777;
}

.entry-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

/* Khối thông tin người chơi */
.player-block {
    display: flex;
    align-items: center;
    gap: 12px;
}
.player-avatar-mini {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #6c757d;
    flex-shrink: 0;
}
.player-name-group {
    display: flex;
    flex-direction: column;
}
.player-name {
    font-weight: 600;
    font-size: 1.1em;
    color: #fff;
}
.level-subtext { /* Cấp độ dưới tên */
    font-size: 0.9em;
    color: #ccc;
    font-weight: 500;
}

/* Khối chỉ số Tu Vi */
.stats-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    border-radius: 5px;
    background-color: #2c3e50;
    border: 1px solid #3498db;
    text-align: center;
}
.stats-block .realm-name { font-weight: bold; color: #fff; }
.stats-block .power-value { font-size: 0.9em; color: #85e0ff; }

/* Khối chỉ số Đại Gia (giữ nguyên) */
.stats-block-dai-gia { display: flex; gap: 8px; }
.stats-block-dai-gia > div { flex-grow: 1; flex-basis: 0; padding: 8px; border-radius: 5px; text-align: center; font-weight: bold; }
.stats-block-dai-gia .tien-ngoc { background-color: #5a4d1d; border: 1px solid #ffde7a; color: #ffde7a; }
.stats-block-dai-gia .linh-thach { background-color: #2c3e50; border: 1px solid #3498db; color: #85e0ff; }
.stats-block-dai-gia i { margin-right: 5px; }


/* === MÀU SẮC TOP HẠNG === */
.rank-1 { border-color: #ffd700; }
.rank-1 .rank-number { color: #ffd700; }
.rank-1 .player-name { color: #ffd700; }
.rank-1 .player-avatar-mini { border-color: #ffd700; }
.rank-1 .rank-title-banner { background: linear-gradient(135deg, #a57c00, #d4af37); }

.rank-2 { border-color: #c0c0c0; }
.rank-2 .rank-number { color: #c0c0c0; }
.rank-2 .player-name { color: #c0c0c0; }
.rank-2 .player-avatar-mini { border-color: #c0c0c0; }
.rank-2 .rank-title-banner { background: linear-gradient(135deg, #5e6b73, #a8b4bd); }

.rank-3 { border-color: #cd7f32; }
.rank-3 .rank-number { color: #cd7f32; }
.rank-3 .player-name { color: #cd7f32; }
.rank-3 .player-avatar-mini { border-color: #cd7f32; }
.rank-3 .rank-title-banner { background: linear-gradient(135deg, #6d3d1e, #b87333); }

/* Thêm vào cuối file css/ranking.css */

.personal-ranking-display {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #111; /* Màu nền tối hơn để nổi bật */
    border-top: 2px solid #E48F45; /* Đường viền màu cam */
    padding: 8px 15px;
    box-sizing: border-box;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.personal-ranking-display.hidden {
    display: none;
}

.personal-ranking-display .ranking-entry {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

.personal-ranking-display .loading-personal-rank {
    width: 100%;
    text-align: center;
    font-style: italic;
    color: #888;
}


.ranking-tab-content {
    display: none;
}

.ranking-tab-content.active {
    display: block;
}

/* Thêm vào cuối file css/ranking.css */

.personal-badge {
    position: absolute;
    top: -1px;
    right: -1px; /* <-- Định vị ở góc trên bên phải */
    
    /* Các thuộc tính style tương tự như .rank-title-banner */
    padding: 4px 12px;
    font-size: 0.85em;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 1px #000;
    
    /* Bo góc chéo cho phù hợp với vị trí mới */
    border-radius: 0 6px 0 6px; 
    
    /* Dùng màu xanh dương để dễ phân biệt */
    background: linear-gradient(135deg, #1f68a1, #3498db); 
    
    border-left: 1px solid rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(0,0,0,0.2);
    z-index: 5; 
}
