        /* Enhanced Animations and Visual Effects */
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translate3d(0, 20px, 0);
            }
            to {
                opacity: 1;
                transform: translate3d(0, 0, 0);
            }
        }
        
        @keyframes slideInLeft {
            from {
                opacity: 0;
                transform: translate3d(-30px, 0, 0);
            }
            to {
                opacity: 1;
                transform: translate3d(0, 0, 0);
            }
        }
        
        @keyframes slideInRight {
            from {
                opacity: 0;
                transform: translate3d(30px, 0, 0);
            }
            to {
                opacity: 1;
                transform: translate3d(0, 0, 0);
            }
        }
        
        .leaderboard-page {
            min-height: 80vh;
            /* تم توحيد هيدر الصفحة عبر includes/page_header.php (ستايل الـ Hero)
               لذلك نزيل الهامش/المسافة العلوية الإضافية التي كانت تُنزل الصفحة للأسفل */
            padding: 0 0 3rem;
            animation: fadeInUp 0.5s ease-out;
        }
        
        #leaderboardContent {
            transition: opacity 0.3s ease, transform 0.3s ease;
        }

        /* تم توحيد عنوان الصفحة عبر includes/page_header.php */
        .pagination-container.main-pagination {
              display: flex;
              gap: 0.5rem;
              flex-wrap: wrap;
              justify-content: center;
              margin: 1rem 0 2rem 0;
              background: rgba(var(--bg-card-rgb), 0.6);
              padding: 0.6rem;
              border-radius: 14px;
              border: 1px solid var(--border-color);
              backdrop-filter: blur(10px);
              width: fit-content;
              margin-inline: auto;
          }

         .pagination-btn {
             padding: 0.6rem 1.1rem;
             background: transparent;
             border: none;
             border-radius: 10px;
             color: var(--text-secondary);
             cursor: pointer;
             font-weight: 600;
             transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
             min-width: 44px;
             text-align: center;
             font-family: inherit;
             font-size: 0.95rem;
             display: flex;
             align-items: center;
             justify-content: center;
         }
 
         .pagination-btn:hover:not(:disabled):not(.active) {
             background: var(--bg-hover);
             color: var(--text-primary);
             transform: translateY(-2px);
         }
 
         .pagination-btn.active {
             background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
             color: white;
             box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.4);
             transform: scale(1.05);
         }
 
         .pagination-btn:disabled {
             opacity: 0.3;
             cursor: not-allowed;
             filter: grayscale(1);
         }

        @media (max-width: 768px) {
            .leaderboard-meta {
                flex-direction: column;
                align-items: stretch;
            }
            
            .pagination-container {
                justify-content: center;
            }
        }
        .leaderboard-controls {
            display: flex;
            justify-content: center;
            gap: 1rem;
            margin-bottom: 2rem;
            flex-wrap: wrap;
            align-items: center;
            animation: fadeInUp 0.4s ease-out 0.2s both;
        }
        
        .control-group {
            background: var(--bg-card);
            padding: 0.5rem;
            border-radius: 12px;
            border: 1px solid var(--border-color);
            display: flex;
            gap: 0.5rem;
            background: rgba(var(--bg-card-rgb), 0.9);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }
        
        .control-group:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
        }
        
        .control-btn {
            background: transparent;
            border: none;
            color: var(--text-secondary);
            padding: 0.6rem 1.2rem;
            border-radius: 8px;
            cursor: pointer;
            font-family: inherit;
            font-weight: 600;
            transition: all 0.2s ease;
            position: relative;
            overflow: hidden;
        }
        
        .control-btn.active {
            background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
            color: white;
            box-shadow: 0 4px 10px rgba(var(--primary-rgb), 0.3);
        }
        
        .search-group {
            display: flex;
            align-items: center;
            background: rgba(var(--bg-card-rgb), 0.9);
            border: 1px solid var(--border-color);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
            padding: 0.5rem;
            border-radius: 12px;
            gap: 0.5rem;
        }
        
        
        .search-input {
            background: transparent;
            border: none;
            color: var(--text-primary);
            padding: 0.6rem 1.2rem;
            border-radius: 8px;
            width: 220px;
            font-size: 1rem;
            font-family: inherit;
            outline: none;
            box-shadow: none;
        }
        .search-input::placeholder {
            color: var(--text-secondary);
            opacity: 0.8;
            font-family: inherit;
            font-weight: 600;
        }
        @media (max-width: 768px) {
            .search-input {
                width: 180px;
            }
        }
        
        .control-btn:hover:not(.active) {
            background: var(--bg-hover);
            color: var(--text-primary);
        }
        
        .podium {
            display: flex;
            justify-content: center;
            align-items: flex-end;
            gap: 1.5rem;
            margin-bottom: 3rem;
            height: 380px;
            padding-bottom: 1rem;
            position: relative;
        }
        
        .podium-place {
            display: flex;
            flex-direction: column;
            align-items: center;
            position: relative;
            opacity: 0;
            transition: transform 0.3s ease;
            will-change: transform;
        }
        
        .podium-place:nth-child(1) { 
            order: 2; 
            z-index: 3; 
            animation: fadeInUp 0.6s ease-out 0.2s both;
        }
        .podium-place:nth-child(2) { 
            order: 1; 
            z-index: 2; 
            animation: slideInLeft 0.6s ease-out 0.3s both;
        }
        .podium-place:nth-child(3) { 
            order: 3; 
            z-index: 1; 
            animation: slideInRight 0.6s ease-out 0.4s both;
        }
        
        .podium-place:hover {
            transform: translateY(-5px);
            z-index: 4;
        }
        
        .podium-avatar-container {
            position: relative;
            margin-bottom: 1rem;
        }
        
        .podium-avatar {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            border: 4px solid var(--border-color);
            object-fit: cover;
            background: var(--bg-dark);
            transition: transform 0.3s ease;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        }
        
        .podium-place:nth-child(1) .podium-avatar {
            width: 110px;
            height: 110px;
            border-color: #ffd700;
            box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
        }
        
        .podium-place:nth-child(2) .podium-avatar {
            border-color: #c0c0c0;
            box-shadow: 0 0 15px rgba(192, 192, 192, 0.3);
        }
        
        .podium-place:nth-child(3) .podium-avatar {
            border-color: #cd7f32;
            box-shadow: 0 0 10px rgba(205, 127, 50, 0.3);
        }
        
        .podium-place:hover .podium-avatar {
            transform: scale(1.05);
        }
        
        .crown-icon {
            position: absolute;
            top: -30px;
            left: 50%;
            transform: translateX(-50%);
            font-size: 2rem;
            filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
            animation: bounce 2s infinite ease-in-out;
        }
        
        @keyframes bounce {
            0%, 100% { transform: translateX(-50%) translateY(0); }
            50% { transform: translateX(-50%) translateY(-5px); }
        }
        
        .podium-base {
            width: 100px;
            background: var(--bg-card);
            border: 2px solid var(--border-color);
            border-bottom: none;
            border-radius: 12px 12px 0 0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2rem;
            font-weight: 800;
            color: var(--text-secondary);
            position: relative;
            transition: transform 0.3s ease;
            background: rgba(var(--bg-card-rgb), 0.95);
        }
        
        .podium-place:nth-child(1) .podium-base {
            height: 150px;
            width: 130px;
            background: linear-gradient(to bottom, rgba(255, 215, 0, 0.1), rgba(var(--bg-card-rgb), 0.95));
            border-color: #ffd700;
            color: #ffd700;
        }
        
        .podium-place:nth-child(2) .podium-base {
            height: 110px;
            background: linear-gradient(to bottom, rgba(192, 192, 192, 0.1), rgba(var(--bg-card-rgb), 0.95));
            border-color: #c0c0c0;
            color: #c0c0c0;
        }
        
        .podium-place:nth-child(3) .podium-base {
            height: 80px;
            background: linear-gradient(to bottom, rgba(205, 127, 50, 0.1), rgba(var(--bg-card-rgb), 0.95));
            border-color: #cd7f32;
            color: #cd7f32;
        }
        
        .podium-name {
            margin-bottom: 0.5rem;
            font-weight: 700;
            text-align: center;
            max-width: 130px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            font-size: 1rem;
            animation: fadeInUp 0.4s ease-out 0.2s both;
        }
        
        .podium-score {
            font-size: 0.9rem;
            color: var(--primary-light);
            font-weight: 600;
            animation: fadeInUp 0.4s ease-out 0.3s both;
        }
        
        .leaderboard-list {
            max-width: 1000px;
            margin: 0 auto;
            animation: fadeInUp 0.6s ease-out 0.5s both;
            display: flex;
            flex-direction: column;
            gap: 1rem;
            background: transparent;
            border: none;
            box-shadow: none;
            overflow: visible;
        }
        
        .list-item {
            display: flex;
            align-items: center;
            padding: 1.1rem 1.6rem;
            transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
            position: relative;
            opacity: 0;
            animation: slideInLeft 0.4s ease-out forwards;
            will-change: transform, opacity;
            border-radius: 16px;
            background: rgba(var(--bg-card-rgb), 0.95);
            border: 1px solid var(--border-color);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
            min-height: 88px;
            justify-content: space-between;
            gap: 1rem;
            flex-direction: row;
            direction: ltr;
        }
        
                
        .list-item:hover {
            background: var(--bg-hover);
            transform: translateX(5px);
            box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
        }
        
        .list-item.top-1 {
            border: 2px solid #ffd700;
            box-shadow: 0 8px 20px rgba(255, 215, 0, 0.25);
            background: linear-gradient(180deg, rgba(255, 215, 0, 0.10), rgba(var(--bg-card-rgb), 0.95));
        }
        .list-item.top-2 {
            border: 2px solid #cd7f32; /* Bronze */
            box-shadow: 0 8px 20px rgba(205, 127, 50, 0.25);
            background: linear-gradient(180deg, rgba(205, 127, 50, 0.10), rgba(var(--bg-card-rgb), 0.95));
        }
        .list-item.top-3 {
            border: 2px solid #b87333; /* Copper */
            box-shadow: 0 8px 20px rgba(184, 115, 51, 0.25);
            background: linear-gradient(180deg, rgba(184, 115, 51, 0.10), rgba(var(--bg-card-rgb), 0.95));
        }
        
        .info-bar {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            margin-inline-start: auto;
            font-size: 0.85rem;
            color: var(--text-secondary);
        }
        .trend {
            display: inline-flex;
            align-items: center;
            gap: 0.25rem;
            font-weight: 800;
            margin-inline-end: 0.4rem;
        }
        .trend.up { color: #22c55e; }      /* green */
        .trend.down { color: #ef4444; }    /* red */
        .stat-up { color: #22c55e; }
        .stat-down { color: #ef4444; }
        .list-item.selected {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.35) inset;
        }
        .streamer-name a {
            color: inherit;
            text-decoration: none;
            font-weight: 700;
        }
        .list-item:hover .streamer-name a {
            color: var(--primary-light);
        }
        .compare-panel {
            max-width: 1000px;
            margin: 0 auto 1rem auto;
            display: none;
            gap: 1rem;
        }
        .compare-card {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.8rem 1rem;
            border-radius: 12px;
            background: rgba(var(--bg-card-rgb), 0.95);
            border: 1px solid var(--border-color);
        }
        .info-rank {
            display: inline-block;
            font-weight: 800;
            color: var(--primary-light);
            margin-inline-start: 0.5rem;
        }
        .mobile-rank {
            display: none;
            margin-inline-start: 0.35rem;
            font-weight: 800;
            color: var(--primary-light);
        }
        
        
        
        .rank {
            width: 40px;
            font-size: 1.2rem;
            font-weight: 800;
            color: var(--text-secondary);
            text-align: center;
        }
        
        .list-item:hover .rank {
            color: var(--primary-color);
        }
        
        .streamer-info {
            display: flex;
            align-items: center;
            gap: 1.2rem;
            flex: 1;
            margin-right: 1rem;
        }
        
        .list-avatar {
            width: 45px;
            height: 45px;
            border-radius: 50%;
            object-fit: cover;
            border: 2px solid transparent;
            transition: border-color 0.2s ease;
            cursor: pointer;
        }
        .list-avatar-wrapper {
            position: relative;
            width: 45px;
            height: 45px;
            flex-shrink: 0;
        }
        .avatar-rank-inline {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-weight: 800;
            color: var(--primary-light);
            font-size: 0.9rem;
            order: -1;
            height: 26px;
            padding: 0 10px;
            border-radius: 13px;
            background: var(--bg-hover);
            border: 1px solid var(--border-color);
            margin-inline-start: 0;
            margin-inline-end: 0.5rem;
        }
        
        .list-item:hover .list-avatar {
            border-color: var(--primary-color);
        }
        
        .streamer-name {
            font-weight: 700;
            color: var(--text-primary);
            font-size: 1.1rem;
            text-align: left;
        }
        
        .list-item:hover .streamer-name {
            color: var(--primary-light);
        }
        
        .streamer-platform {
            font-size: 0.8rem;
            color: var(--text-secondary);
            display: flex;
            align-items: center;
            gap: 0.3rem;
            justify-content: flex-start;
        }
        
        .score-container {
            text-align: right;
        }
        
        .score-value {
            font-size: 1.2rem;
            font-weight: 800;
            color: var(--primary-light);
        }
        .score-value.stat-up { color: #22c55e !important; }
        .score-value.stat-down { color: #ef4444 !important; }
        
        .list-item:hover .score-value {
            color: var(--primary-color);
        }
        
        .score-label {
            font-size: 0.75rem;
            color: var(--text-secondary);
        }
        
        @media (max-width: 768px) {
            .list-item {
                padding: 0.8rem 1rem;
                min-height: 76px;
            }
            .list-avatar {
                width: 40px;
                height: 40px;
            }
            .info-rank {
                display: none;
            }
            .mobile-rank {
                display: inline-block;
            }
        }
        .loading-state {
            text-align: center;
            padding: 3rem;
            color: var(--text-secondary);
        }
        
        .spinner {
            width: 40px;
            height: 40px;
            border: 3px solid var(--border-color);
            border-top: 3px solid var(--primary-color);
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
            margin: 0 auto 1rem;
        }
        
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        /* Enhanced Responsive Design */
        @media (max-width: 768px) {
            .podium {
                gap: 0.5rem;
                height: 320px;
            }
            
            .podium-place:nth-child(1) .podium-avatar {
                width: 80px;
                height: 80px;
            }
            
            .podium-place .podium-avatar {
                width: 60px;
                height: 60px;
            }
            
            .podium-place:nth-child(1) .podium-base {
                width: 100px;
                height: 120px;
            }
            
            .podium-base {
                width: 80px;
                height: 90px;
            }
            
            .leaderboard-header h1 {
                font-size: 2rem;
            }
            
            .leaderboard-controls {
                gap: 0.8rem;
            }
            
            .control-btn {
                padding: 0.5rem 1rem;
                font-size: 0.85rem;
            }
            
            .list-item {
                padding: 0.8rem 1rem;
            }
            
            .list-avatar {
                width: 40px;
                height: 40px;
            }
        }
        
        /* Dark mode support for RGB values */
        :root {
            --primary-rgb: 168, 85, 255;
            --bg-card-rgb: 30, 30, 40;
        }

        /* Tabs Styling */
        .tabs-container {
            display: flex;
            justify-content: center;
            gap: 1rem;
            margin-bottom: 2.5rem;
            animation: fadeInUp 0.4s ease-out both;
        }

        .tab-btn {
            background: rgba(var(--bg-card-rgb), 0.8);
            border: 1px solid var(--border-color);
            color: var(--text-secondary);
            padding: 0.8rem 2rem;
            border-radius: 14px;
            cursor: pointer;
            font-family: inherit;
            font-weight: 700;
            font-size: 1.1rem;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            backdrop-filter: blur(10px);
        }

        .tab-btn:hover {
            background: var(--bg-hover);
            color: var(--text-primary);
            transform: translateY(-2px);
        }

        .tab-btn.active {
            background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
            color: white;
            border-color: transparent;
            box-shadow: 0 8px 20px rgba(var(--primary-rgb), 0.3);
        }

        .tab-content {
            display: none;
            animation: fadeInUp 0.5s ease-out;
        }

        .tab-content.active {
            display: block;
        }

        /* Voting Styles */
        .voting-header {
            text-align: center;
            margin-bottom: 3rem;
        }

        .voting-header h2 {
            font-size: 2.2rem;
            margin-bottom: 0.5rem;
            color: #fff;
        }

        .voting-header p {
            color: var(--text-secondary);
            font-size: 1.1rem;
        }

        .voting-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 1.5rem;
            max-width: 1200px;
            margin: 0 auto;
        }

        .vote-card {
            background: rgba(var(--bg-card-rgb), 0.9);
            border: 1px solid var(--border-color);
            border-radius: 20px;
            padding: 1.5rem;
            text-align: center;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 1rem;
        }

        .vote-card:hover {
            transform: translateY(-8px);
            border-color: var(--primary-color);
            box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
        }

        .vote-card img {
            width: 90px;
            height: 90px;
            border-radius: 50%;
            border: 3px solid var(--border-color);
            transition: border-color 0.3s ease;
        }

        .vote-card:hover img {
            border-color: var(--primary-color);
        }

        .vote-card h3 {
            font-size: 1.3rem;
            margin: 0;
            color: #fff;
        }

        .vote-btn {
            background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
            color: white;
            border: none;
            padding: 0.7rem 2rem;
            border-radius: 12px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.3s ease;
            width: 100%;
            margin-top: 0.5rem;
        }

        .vote-btn:hover:not(:disabled) {
            filter: brightness(1.1);
            transform: scale(1.02);
            box-shadow: 0 5px 15px rgba(var(--primary-rgb), 0.4);
        }

        .vote-btn:disabled {
            background: var(--bg-hover);
            color: var(--text-secondary);
            cursor: not-allowed;
            opacity: 0.7;
        }

        /* Results Display */
        .vote-results {
            width: 100%;
            margin-top: 1rem;
        }

        .progress-container {
            width: 100%;
            height: 10px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 5px;
            overflow: hidden;
            margin: 0.5rem 0;
        }

        .progress-bar {
            height: 100%;
            background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
            border-radius: 5px;
            transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .vote-info {
            display: flex;
            justify-content: space-between;
            font-size: 0.9rem;
            font-weight: 600;
            color: var(--text-secondary);
        }

        .voted-badge {
            position: absolute;
            top: 10px;
            right: 10px;
            background: #22c55e;
            color: white;
            font-size: 0.7rem;
            padding: 0.3rem 0.6rem;
            border-radius: 20px;
            font-weight: 800;
            box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
        }

        @media (max-width: 768px) {
            .tab-btn {
                padding: 0.6rem 1.2rem;
                font-size: 0.95rem;
            }
            .voting-header h2 {
                font-size: 1.6rem;
            }
        }
