/* CSS cho bảng xếp hạng với phạm vi giới hạn */
.vaothi-ranking-wrapper {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Container styles */
.vaothi-ranking-wrapper .ranking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 25px;
    border-bottom: 3px solid #f0f0f0;
}

.vaothi-ranking-wrapper .class-form {
    min-width: 220px;
}

/* Title */
.vaothi-ranking-wrapper .ranking-title {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    letter-spacing: -0.5px;
}

/* Class selector */
.vaothi-ranking-wrapper .class-selector {
    width: 100%;
    padding: 12px 40px 12px 18px;
    font-size: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 30px;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    font-weight: 500;
}

.vaothi-ranking-wrapper .class-selector:hover {
    border-color: #4CAF50;
}

.vaothi-ranking-wrapper .class-selector:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Tabs */
.vaothi-ranking-wrapper .ranking-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
}

.vaothi-ranking-wrapper .ranking-tab {
    padding: 12px 24px;
    background-color: #f8f9fa;
    color: #495057;
    border-radius: 25px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 14px;
    border: 2px solid transparent;
    letter-spacing: 0.3px;
}

.vaothi-ranking-wrapper .ranking-tab:hover {
    background-color: #e9ecef;
    transform: translateY(-2px);
}

.vaothi-ranking-wrapper .ranking-tab.active {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border-color: #4CAF50;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

/* Table container */
.vaothi-ranking-wrapper .ranking-table-container {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
    background: white;
}

/* Table styles */
.vaothi-ranking-wrapper .ranking-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.vaothi-ranking-wrapper .ranking-table thead {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

/* Điều chỉnh căn chỉnh tiêu đề */
.vaothi-ranking-wrapper .ranking-table th {
    padding: 18px 20px;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
}

.vaothi-ranking-wrapper .ranking-table th.rank-column {
    text-align: center;
    width: 100px;
}

.vaothi-ranking-wrapper .ranking-table th.student-column {
    text-align: left;
    padding-left: 30px;
}

.vaothi-ranking-wrapper .ranking-table th.score-column {
    text-align: center;
    width: 150px;
}

/* Các ô dữ liệu */
.vaothi-ranking-wrapper .ranking-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.vaothi-ranking-wrapper .ranking-table tr:last-child td {
    border-bottom: none;
}

/* No data message */
.vaothi-ranking-wrapper .no-data-row td {
    text-align: center;
    padding: 50px 20px;
    color: #6c757d;
    font-size: 15px;
    font-style: italic;
}

/* Row highlighting with better colors - FIXED */
.vaothi-ranking-wrapper .top-1-row td {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.03) 100%);
}

.vaothi-ranking-wrapper .top-1-row td:first-child {
    border-left: 6px solid #FFD700;
}

.vaothi-ranking-wrapper .top-2-row td {
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.15) 0%, rgba(192, 192, 192, 0.03) 100%);
}

.vaothi-ranking-wrapper .top-2-row td:first-child {
    border-left: 6px solid #C0C0C0;
}

.vaothi-ranking-wrapper .top-3-row td {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.15) 0%, rgba(205, 127, 50, 0.03) 100%);
}

.vaothi-ranking-wrapper .top-3-row td:first-child {
    border-left: 6px solid #CD7F32;
}

.vaothi-ranking-wrapper .ranking-item {
    transition: all 0.3s ease;
}

.vaothi-ranking-wrapper .ranking-item:hover {
    background-color: #f8f9fa;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Rank number styles - Enhanced */
.vaothi-ranking-wrapper .rank-cell {
    text-align: center;
    vertical-align: middle;
}

.vaothi-ranking-wrapper .rank-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    color: white;
    font-weight: 700;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    transition: all 0.3s ease;
}

.vaothi-ranking-wrapper .ranking-item:hover .rank-number {
    transform: scale(1.1);
}

/* Gold Medal - Huy chương vàng */
.vaothi-ranking-wrapper .gold {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #fff;
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
    animation: pulse-gold 2s ease-in-out infinite;
}

.vaothi-ranking-wrapper .gold::before {
    content: '👑';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 20px;
    animation: rotate-crown 3s linear infinite;
}

@keyframes pulse-gold {
    0%, 100% { box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 8px 30px rgba(255, 215, 0, 0.6); }
}

@keyframes rotate-crown {
    0%, 100% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
}

/* Silver Medal - Huy chương bạc */
.vaothi-ranking-wrapper .silver {
    background: linear-gradient(135deg, #E8E8E8 0%, #A8A8A8 100%);
    color: #333;
    box-shadow: 0 6px 20px rgba(192, 192, 192, 0.4);
}

/* Bronze Medal - Huy chương đồng */
.vaothi-ranking-wrapper .bronze {
    background: linear-gradient(135deg, #CD7F32 0%, #B87333 100%);
    color: #fff;
    box-shadow: 0 6px 20px rgba(205, 127, 50, 0.4);
}

/* Default rank */
.vaothi-ranking-wrapper .default-rank {
    background: linear-gradient(135deg, #9e9e9e 0%, #757575 100%);
    font-size: 16px;
}

.vaothi-ranking-wrapper .rank-icon {
    position: relative;
    z-index: 1;
}

/* Student info */
.vaothi-ranking-wrapper .student-cell {
    vertical-align: middle;
    text-align: left;
    padding-left: 30px;
}

.vaothi-ranking-wrapper .student-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.vaothi-ranking-wrapper .student-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vaothi-ranking-wrapper .student-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 15px;
    line-height: 1.4;
}

.vaothi-ranking-wrapper .student-email {
    font-size: 13px;
    color: #6c757d;
}

/* Avatar styles - Enhanced */
.vaothi-ranking-wrapper .avatar, 
.vaothi-ranking-wrapper .default-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 3px solid #fff;
    transition: all 0.3s ease;
}

.vaothi-ranking-wrapper .ranking-item:hover .avatar,
.vaothi-ranking-wrapper .ranking-item:hover .default-avatar {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.vaothi-ranking-wrapper .default-avatar {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: white;
}

/* Top 3 special avatars */
.vaothi-ranking-wrapper .top-1-row .avatar,
.vaothi-ranking-wrapper .top-1-row .default-avatar {
    border-color: #FFD700;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.vaothi-ranking-wrapper .top-2-row .avatar,
.vaothi-ranking-wrapper .top-2-row .default-avatar {
    border-color: #C0C0C0;
    box-shadow: 0 4px 12px rgba(192, 192, 192, 0.4);
}

.vaothi-ranking-wrapper .top-3-row .avatar,
.vaothi-ranking-wrapper .top-3-row .default-avatar {
    border-color: #CD7F32;
    box-shadow: 0 4px 12px rgba(205, 127, 50, 0.4);
}

/* Score styles - Enhanced */
.vaothi-ranking-wrapper .score-cell {
    text-align: center;
    vertical-align: middle;
    font-weight: 700;
    color: #4CAF50;
    font-size: 20px;
    position: relative;
}

.vaothi-ranking-wrapper .score-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: linear-gradient(135deg, #f0f9f0, #e8f5e9);
    border-radius: 20px;
    min-width: 80px;
}

/* Top 3 scores with medals */
.vaothi-ranking-wrapper .top-1-row .score-value {
    background: linear-gradient(135deg, #fff9e6, #ffe8b3);
    color: #FF8C00;
}

.vaothi-ranking-wrapper .top-2-row .score-value {
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    color: #555;
}

.vaothi-ranking-wrapper .top-3-row .score-value {
    background: linear-gradient(135deg, #fff5e6, #ffe4cc);
    color: #B87333;
}

/* Medal badges with animation */
.vaothi-ranking-wrapper .score-badge {
    display: inline-block;
    margin-left: 10px;
    font-size: 24px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.vaothi-ranking-wrapper .top-1-row .score-badge::after {
    content: "🥇";
}

.vaothi-ranking-wrapper .top-2-row .score-badge::after {
    content: "🥈";
}

.vaothi-ranking-wrapper .top-3-row .score-badge::after {
    content: "🥉";
}

/* Responsive styles */
@media (max-width: 768px) {
    .vaothi-ranking-wrapper .ranking-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
        text-align: center;
    }
    
    .vaothi-ranking-wrapper .ranking-title {
        font-size: 22px;
        margin-bottom: 10px;
    }
    
    .vaothi-ranking-wrapper .class-form {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .vaothi-ranking-wrapper .ranking-tabs {
        overflow-x: auto;
        padding-bottom: 10px;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
    }
    
    .vaothi-ranking-wrapper .ranking-tab {
        white-space: nowrap;
        flex: 0 0 auto;
        padding: 10px 18px;
        font-size: 13px;
    }
    
    .vaothi-ranking-wrapper .ranking-table th,
    .vaothi-ranking-wrapper .ranking-table td {
        padding: 12px 10px;
    }
    
    .vaothi-ranking-wrapper .student-cell {
        padding-left: 15px;
    }
    
    .vaothi-ranking-wrapper .student-info {
        gap: 10px;
    }
    
    .vaothi-ranking-wrapper .student-name {
        font-size: 14px;
    }
    
    .vaothi-ranking-wrapper .student-email {
        font-size: 12px;
    }
    
    .vaothi-ranking-wrapper .avatar, 
    .vaothi-ranking-wrapper .default-avatar {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .vaothi-ranking-wrapper .rank-number {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .vaothi-ranking-wrapper .gold::before {
        font-size: 16px;
        top: -6px;
        right: -6px;
    }
    
    .vaothi-ranking-wrapper .score-cell {
        font-size: 16px;
    }
    
    .vaothi-ranking-wrapper .score-value {
        padding: 6px 12px;
        min-width: 60px;
        font-size: 16px;
    }
    
    .vaothi-ranking-wrapper .score-badge {
        font-size: 20px;
        margin-left: 6px;
    }
    
    .vaothi-ranking-wrapper .top-1-row td:first-child,
    .vaothi-ranking-wrapper .top-2-row td:first-child,
    .vaothi-ranking-wrapper .top-3-row td:first-child {
        border-left-width: 4px;
    }
}

@media (max-width: 480px) {
    .vaothi-ranking-wrapper .ranking-title {
        font-size: 18px;
    }
    
    .vaothi-ranking-wrapper .ranking-table th,
    .vaothi-ranking-wrapper .ranking-table td {
        padding: 10px 6px;
        font-size: 13px;
    }
    
    .vaothi-ranking-wrapper .student-name {
        font-size: 13px;
    }
    
    .vaothi-ranking-wrapper .student-email {
        font-size: 11px;
        display: none;
    }
    
    .vaothi-ranking-wrapper .avatar, 
    .vaothi-ranking-wrapper .default-avatar {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .vaothi-ranking-wrapper .rank-number {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .vaothi-ranking-wrapper .score-cell {
        font-size: 15px;
    }
    
    .vaothi-ranking-wrapper .score-value {
        padding: 5px 10px;
        font-size: 15px;
    }
    
    .vaothi-ranking-wrapper .score-badge {
        font-size: 18px;
    }
    
    .vaothi-ranking-wrapper .top-1-row td:first-child,
    .vaothi-ranking-wrapper .top-2-row td:first-child,
    .vaothi-ranking-wrapper .top-3-row td:first-child {
        border-left-width: 3px;
    }
}