/* ==========================================
   LEVEL SYSTEM STYLES - UNIFIED VERSION
   All tooltip styles consolidated here
   ========================================== */

/* DISABLE old tooltip systems - use JS-based tooltips only */
.level-badge .level-tooltip {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

#global-tooltip-portal {
    display: none !important;
    visibility: hidden !important;
}

/* Level badge in message */
.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: help;
    position: relative;
    transition: all 0.3s ease;
    z-index: 1;
    color: white;
    white-space: nowrap;
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.level-badge:hover {
    transform: scale(1.08);
    z-index: 10000;
}

/* 🎨 LEVEL BADGES - Huyền Diệu & Rực Rỡ! */

/* Level 1 - Tập sự (Grey - Simple) */
.level-badge-tier-1 {
    background: #95a5a6;
    box-shadow: 0 0 5px rgba(149, 165, 166, 0.2);
}

.level-badge-tier-1:hover {
    background: #7f8c8d;
    box-shadow: 0 2px 8px rgba(127, 140, 141, 0.4);
}

/* Level 2 - Khách quen (Blue Ocean - Subtle shine) */
.level-badge-tier-2 {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.level-badge-tier-2:hover {
    background: linear-gradient(135deg, #2980b9 0%, #2471a3 100%);
    box-shadow: 0 2px 12px rgba(52, 152, 219, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Level 3 - Cày thủ (Green Energy - Pulsing) */
.level-badge-tier-3 {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    box-shadow: 0 0 12px rgba(46, 204, 113, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: green-pulse 2s ease-in-out infinite;
}

.level-badge-tier-3:hover {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    box-shadow: 0 2px 15px rgba(46, 204, 113, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Level 4 - Thần ngủ gật (Purple Dream - Mystical) */
.level-badge-tier-4 {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    box-shadow: 0 0 15px rgba(155, 89, 182, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.25);
    animation: purple-glow 2.5s ease-in-out infinite;
}

.level-badge-tier-4:hover {
    background: linear-gradient(135deg, #8e44ad 0%, #7d3c98 100%);
    box-shadow: 0 2px 18px rgba(155, 89, 182, 0.7),
                inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* Level 5 - Best Slot 5 (Red Fire - Intense) */
.level-badge-tier-5 {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    box-shadow: 0 0 18px rgba(231, 76, 60, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.25);
    animation: red-fire 2s ease-in-out infinite;
}

.level-badge-tier-5:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    box-shadow: 0 2px 22px rgba(231, 76, 60, 0.8),
                inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* Level 6 - Admin nhí (Orange Blaze - Hot!) */
.level-badge-tier-6 {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow: 0 0 20px rgba(243, 156, 18, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: orange-blaze 2s ease-in-out infinite;
}

.level-badge-tier-6:hover {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    box-shadow: 0 3px 25px rgba(243, 156, 18, 0.8),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Level 7 - Quán trưởng (Fire Storm - Epic!) */
.level-badge-tier-7 {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 70%, #ca6f1e 100%);
    box-shadow: 0 0 25px rgba(230, 126, 34, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: fire-storm 1.8s ease-in-out infinite;
    border: 1px solid rgba(255, 165, 0, 0.3);
}

.level-badge-tier-7:hover {
    background: linear-gradient(135deg, #d35400 0%, #ba4a00 70%, #af601a 100%);
    box-shadow: 0 3px 30px rgba(230, 126, 34, 0.9),
                inset 0 2px 0 rgba(255, 255, 255, 0.4);
}

/* Level 8 - Huyền thoại (Legendary Gold - DIVINE!) */
.level-badge-tier-8 {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
    background-size: 200% 200%;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.7),
                0 0 15px rgba(255, 165, 0, 0.5),
                inset 0 2px 0 rgba(255, 255, 255, 0.4);
    animation: golden-divine 3s ease-in-out infinite, shimmer-gold 4s linear infinite;
    border: 1px solid rgba(255, 255, 255, 0.4);
    font-weight: 900;
    letter-spacing: 0.5px;
}

.level-badge-tier-8:hover {
    background: linear-gradient(135deg, #FFC700 0%, #FF9500 50%, #FF7700 100%);
    background-size: 200% 200%;
    box-shadow: 0 3px 40px rgba(255, 215, 0, 1),
                0 0 25px rgba(255, 165, 0, 0.8),
                inset 0 2px 0 rgba(255, 255, 255, 0.5);
    transform: scale(1.12);
}

/* 🌟 ANIMATIONS - Huyền Diệu Effects */

@keyframes green-pulse {
    0%, 100% { 
        box-shadow: 0 0 12px rgba(46, 204, 113, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    50% { 
        box-shadow: 0 0 18px rgba(46, 204, 113, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    }
}

@keyframes purple-glow {
    0%, 100% { 
        box-shadow: 0 0 15px rgba(155, 89, 182, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    }
    50% { 
        box-shadow: 0 0 22px rgba(155, 89, 182, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

@keyframes red-fire {
    0%, 100% { 
        box-shadow: 0 0 18px rgba(231, 76, 60, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    }
    50% { 
        box-shadow: 0 0 28px rgba(231, 76, 60, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

@keyframes orange-blaze {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(243, 156, 18, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    50% { 
        box-shadow: 0 0 30px rgba(243, 156, 18, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    }
}

@keyframes fire-storm {
    0%, 100% { 
        box-shadow: 0 0 25px rgba(230, 126, 34, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    50% { 
        box-shadow: 0 0 35px rgba(230, 126, 34, 0.9), 0 0 15px rgba(255, 140, 0, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.4);
    }
}

@keyframes golden-divine {
    0%, 100% { 
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.7), 0 0 15px rgba(255, 165, 0, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.4);
    }
    50% { 
        box-shadow: 0 0 45px rgba(255, 215, 0, 1), 0 0 25px rgba(255, 165, 0, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.5);
    }
}

@keyframes shimmer-gold {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* NOTE: All tooltip styles removed - now using tooltip-simple-fix.js
   for JavaScript-based tooltips with inline styles */

/* XP Progress bar */
.xp-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.xp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FFD700, #FFA500);
    border-radius: 3px;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Like/Dislike buttons */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    position: absolute;
    right: 10px;
    bottom: 10px;
    max-width: 120px;
}

.reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reaction-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.reaction-btn.liked {
    background: rgba(46, 213, 115, 0.2);
    border-color: #2ed573;
    color: #2ed573;
}

.reaction-btn.disliked {
    background: rgba(255, 71, 87, 0.2);
    border-color: #ff4757;
    color: #ff4757;
}

.reaction-btn .emoji {
    font-size: 1rem;
}

.reaction-btn .count {
    font-weight: 600;
}

/* ==========================================
   LEADERBOARD - Thần Gió Phòng Net
   ========================================== */

#leaderboard-widget {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 400px; /* Tăng từ 320px lên 400px */
    max-height: 90vh; /* Limit to 90% of viewport height */
    background: linear-gradient(135deg, rgba(20, 20, 30, 0.98) 0%, rgba(30, 30, 45, 0.98) 100%);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 900;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}

.leaderboard-title-section {
    text-align: center;
    flex: 1;
}

.leaderboard-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.leaderboard-header .subtitle {
    font-size: 0.75rem;
    color: rgba(255, 215, 0, 0.6);
    margin-top: 5px;
    font-style: italic;
}

.leaderboard-header .header-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.leaderboard-header .header-buttons button {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #FFD700;
    font-size: 1rem;
}

.leaderboard-header .header-buttons button:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: #FFD700;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.leaderboard-header .header-buttons button:active {
    transform: scale(0.95);
}

.leaderboard-header .refresh-btn i.fa-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1; /* Take remaining space */
    padding-right: 5px;
    max-height: calc(90vh - 140px); /* Subtract header height */
}

.leaderboard-list::-webkit-scrollbar {
    width: 6px;
}

.leaderboard-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.leaderboard-list::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-radius: 10px;
}

.leaderboard-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #FFA500, #FF8C00);
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.2);
}

.leaderboard-item.top-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 165, 0, 0.1));
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.leaderboard-item.top-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(169, 169, 169, 0.1));
    border-color: #C0C0C0;
}

.leaderboard-item.top-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(184, 115, 51, 0.1));
    border-color: #CD7F32;
}

.leaderboard-item.current-user {
    border: 2px solid #667eea;
    box-shadow: 0 0 25px rgba(102, 126, 234, 0.4);
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 25px rgba(102, 126, 234, 0.4); }
    50% { box-shadow: 0 0 35px rgba(102, 126, 234, 0.6); }
}

.leaderboard-rank {
    font-size: 1.2rem;
    font-weight: 800;
    min-width: 35px;
    text-align: center;
}

.leaderboard-rank.gold { color: #FFD700; text-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
.leaderboard-rank.silver { color: #C0C0C0; text-shadow: 0 0 10px rgba(192, 192, 192, 0.5); }
.leaderboard-rank.bronze { color: #CD7F32; text-shadow: 0 0 10px rgba(205, 127, 50, 0.5); }

.leaderboard-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.leaderboard-info {
    flex: 1;
    min-width: 0;
}

.leaderboard-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-level {
    font-size: 0.75rem;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

/* XP display removed - now showing level badge with tooltip instead */

.leaderboard-separator {
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.3), transparent);
    margin: 15px 0;
    position: relative;
}

.leaderboard-separator::before {
    content: '⚡';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: #1e1e2e;
    padding: 0 10px;
    font-size: 1rem;
}

/* Toggle button */
.leaderboard-toggle {
    position: fixed;
    left: 20px;
    top: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
    z-index: 901;
    transition: all 0.3s ease;
}

.leaderboard-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.6);
}

#leaderboard-widget.hidden {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    #leaderboard-widget {
        left: 10px;
        width: calc(100vw - 20px);
        max-width: 400px; /* Tăng từ 320px lên 400px */
        max-height: 80vh; /* Smaller on mobile */
        padding: 15px;
    }
    
    .leaderboard-list {
        max-height: calc(80vh - 120px);
    }
    
    .leaderboard-toggle {
        left: 10px;
        top: 10px;
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    .leaderboard-header h2 {
        font-size: 1.2rem;
    }
    
    .leaderboard-item {
        padding: 10px;
        gap: 10px;
    }
}

@media (max-height: 600px) {
    /* Very short screens */
    #leaderboard-widget {
        max-height: 85vh;
        top: 50px;
        transform: translateY(0);
    }
    
    .leaderboard-list {
        max-height: calc(85vh - 100px);
    }
}
