/* ==========================================================================
   WP Voting System - Frontend Styles
   Mobile-First Responsive Design
   ========================================================================== */

/* Reset and Base Styles */
.wp-voting-system-wrapper {
    margin: 0;
    padding: 0;
    width: 100%;
}

.wp-voting-system-wrapper * {
    box-sizing: border-box;
}

.wp-voting-container {
    margin: 0;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    width: 100%;
    box-sizing: border-box;
}

/* Header Styles */
.wp-voting-header {
    text-align: center;
    margin: 10px 0 20px 0;
    color: white;
}

.wp-voting-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: white;
    text-shadow: none;
}

.wp-voting-header p {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0;
}

/* Button Styles */
.wp-voting-btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    min-height: 44px; /* Touch-friendly */
    position: relative;
    overflow: hidden;
}

.wp-voting-btn-primary {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.wp-voting-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.wp-voting-btn-secondary {
    background: linear-gradient(45deg, #ff6b6b, #ee5a52);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.wp-voting-btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

/* User Type Selection */
.wp-voting-user-types {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 0;
    padding: 0;
}

.wp-voting-user-type-card {
    background: white;
    border-radius: 15px;
    padding: 12px;
    margin: 0;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: visible;
    width: 180px;
    height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.wp-voting-user-type-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.wp-voting-user-type-card:hover::before {
    left: 100%;
}

.user-type-icon {
    font-size: 2.2rem;
    margin-bottom: 5px;
}

.wp-voting-user-type-card h3 {
    font-size: 1rem;
    color: #333;
    margin-bottom: 4px;
}

.user-type-description {
    color: #666;
    font-size: 0.7rem;
    margin-bottom: 6px;
    line-height: 1.2;
}

.user-type-multiplier {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
    padding: 4px 6px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.75rem;
}

.multiplier-value {
    font-weight: 700;
    color: #4CAF50;
    font-size: 1rem;
}

.wp-voting-user-type-card .wp-voting-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
    margin-top: 0;
    width: 100%;
    max-width: 80px;
}

.user-type-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    justify-content: center;
}

.user-type-bottom {
    margin-top: auto;
}

/* Voting Form */
.wp-voting-teams {
    display: grid;
    gap: 15px;
    margin: 0;
    padding: 0;
}

.wp-voting-team-card {
    background: white;
    border-radius: 15px;
    padding: 15px;
    margin: 0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.wp-voting-team-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.team-info h3 {
    color: #333;
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.team-info p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.team-voting label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

/* Score Grid Buttons */
.score-grid-container {
    margin: 0;
    padding: 0;
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 4px;
    margin: 0;
    padding: 0;
    width: 100%;
}

.score-btn {
    aspect-ratio: 1.3/1;
    border: 1px solid;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
    background: white;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    padding: 0;
    margin: 0;
}

.score-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.score-btn:active {
    transform: scale(0.98);
}

/* Score 1-5: Viền đỏ */
.score-btn.red {
    border-color: #ff4757;
    color: #ff4757;
}

.score-btn.red:hover {
    border-color: #ff3742;
    color: #ff3742;
}

/* Score 6-8: Viền cam/vàng */
.score-btn.yellow {
    border-color: #ffa502;
    color: #ffa502;
}

.score-btn.yellow:hover {
    border-color: #ff9500;
    color: #ff9500;
}

/* Score 9-10: Viền xanh */
.score-btn.green {
    border-color: #2ed573;
    color: #2ed573;
}

.score-btn.green:hover {
    border-color: #27c46b;
    color: #27c46b;
}

/* Selected state */
.score-btn.selected.red {
    background: #ff4757;
    color: white;
    border-color: #ff4757;
}

.score-btn.selected.yellow {
    background: #ffa502;
    color: white;
    border-color: #ffa502;
}

.score-btn.selected.green {
    background: #2ed573;
    color: white;
    border-color: #2ed573;
}

.selected-score-display {
    text-align: center;
    margin-top: 10px;
    display: none;
}

.selected-score-display.show {
    display: block;
}

.score-number-large {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 10px;
    line-height: 1;
}

.score-number-large.red {
    color: #ff4757;
}

.score-number-large.yellow {
    color: #ffa502;
}

.score-number-large.green {
    color: #2ed573;
}

.score-description {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.color-legend {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
}

.color-item {
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 12px;
    color: white;
    text-align: center;
    flex: 1;
}

.color-item.red {
    background: #ff4757;
}

.color-item.yellow {
    background: #ffa502;
}

.color-item.green {
    background: #2ed573;
}

/* Form Actions */
.wp-voting-form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0 0 0;
    padding: 0;
}

/* Results Display */
.wp-voting-results {
    margin-bottom: 30px;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: white;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 3D Podium */
.wp-voting-podium-container {
    perspective: 1000px;
    padding: 20px 0 70px 0; /* Increased bottom padding to accommodate labels */
}

.podium-3d {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 30px;
    transform-style: preserve-3d;
}

.podium-position {
    position: relative;
    transition: all 0.5s ease;
    cursor: pointer;
}

.podium-position:hover {
    transform: scale(1.05) rotateY(5deg);
}

.podium-column {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px 10px 0 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}

.podium-position.first .podium-column {
    width: 120px;
    height: 200px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
}

.podium-position.second .podium-column {
    width: 100px;
    height: 160px;
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
}

.podium-position.third .podium-column {
    width: 100px;
    height: 120px;
    background: linear-gradient(135deg, #cd7f32 0%, #daa520 100%);
}

.podium-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px 10px;
    background: rgba(255,255,255,0.9);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 10px 10px 0 0;
}

.team-info {
    text-align: center;
}

.team-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.team-info h3 {
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 8px;
    font-weight: 700;
}

.score-box {
    background: linear-gradient(45deg, #8b5cf6, #a855f7);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.podium-label {
    position: absolute;
    bottom: -45px;
    left: 0;
    right: 0;
    padding: 6px 0;
    border-radius: 0;
    font-weight: 800;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border: 2px solid white;
    transition: all 0.3s ease;
    text-align: center;
    width: 100%;
}

/* Specific styling for each position */
.podium-position.first .podium-label {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffc107 100%);
    color: #8b4513;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.5);
    animation: goldGlow 2s ease-in-out infinite alternate;
}

.podium-position.second .podium-label {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 50%, #b8b8b8 100%);
    color: #2c3e50;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
}

.podium-position.third .podium-label {
    background: linear-gradient(135deg, #cd7f32 0%, #daa520 50%, #b8860b 100%);
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Hover effects */
.podium-position:hover .podium-label {
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    transform: scale(1.02);
}

/* Gold glow animation for 1st place */
@keyframes goldGlow {
    0% {
        box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4), 0 0 20px rgba(255, 215, 0, 0.2);
    }
    100% {
        box-shadow: 0 4px 15px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.4);
    }
}

/* Subtle animations for 2nd and 3rd place */
.podium-position.second .podium-label {
    animation: silverShine 3s ease-in-out infinite alternate;
}

.podium-position.third .podium-label {
    animation: bronzeGlow 4s ease-in-out infinite alternate;
}

@keyframes silverShine {
    0% {
        box-shadow: 0 4px 15px rgba(192, 192, 192, 0.3);
    }
    100% {
        box-shadow: 0 4px 15px rgba(192, 192, 192, 0.6), 0 0 15px rgba(192, 192, 192, 0.3);
    }
}

@keyframes bronzeGlow {
    0% {
        box-shadow: 0 4px 15px rgba(205, 127, 50, 0.3);
    }
    100% {
        box-shadow: 0 4px 15px rgba(205, 127, 50, 0.6), 0 0 15px rgba(205, 127, 50, 0.3);
    }
}

/* Remaining Teams */
.remaining-teams {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.remaining-teams h3 {
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.teams-list {
    display: grid;
    gap: 10px;
}

.team-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.team-card:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.team-rank {
    background: linear-gradient(45deg, #6c757d, #495057);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.team-name {
    flex: 1;
    font-weight: 600;
    color: #333;
}

.team-score {
    font-weight: 700;
    color: #8b5cf6;
    font-size: 1.1rem;
}

/* Results Actions */
.wp-voting-results-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Responsive Design */
@media (max-width: 575px) {
    /* Smaller podium labels on mobile */
    .podium-label {
        bottom: -35px;
        padding: 4px 0;
        font-size: 0.7rem;
        letter-spacing: 0.5px;
        border-radius: 0;
    }
    
    .wp-voting-podium-container {
        padding: 20px 0 60px 0; /* Increased bottom padding to accommodate labels */
    }
}

@media (min-width: 576px) {
    .wp-voting-container {
        padding: 10px;
    }
    
    .wp-voting-user-types {
        gap: 18px;
        margin-top: 20px;
    }
    
    .wp-voting-user-type-card {
        width: 160px;
        height: 180px;
    }
    
    .wp-voting-teams {
        gap: 18px;
        margin-bottom: 25px;
    }
    
    .wp-voting-team-card {
        padding: 18px;
    }
    
    .wp-voting-header {
        margin: 15px 0 25px 0;
    }
    
    .color-legend {
        gap: 15px;
    }
    
    .score-grid {
        grid-template-columns: repeat(5, 1fr);
        grid-template-rows: repeat(2, 1fr);
        gap: 10px;
        max-width: 100%;
        width: 100%;
    }
    
    .score-btn {
        min-height: 45px;
        font-size: 2rem;
        aspect-ratio: 1/1;
        border: 2px solid;
        border-radius: 8px;
        padding: 0;
        margin: 0;
    }
    
    .score-number-large {
        font-size: 4rem;
    }
}

@media (min-width: 480px) and (max-width: 767px) {
    .score-grid {
        gap: 6px;
        padding: 0;
    }
    
    .score-btn {
        min-height: 40px;
        font-size: 1rem;
        aspect-ratio: 1.4/1;
        border: 2px solid;
        border-radius: 8px;
        padding: 0;
        margin: 0;
    }
    
    .score-number-large {
        font-size: 3.5rem;
    }
}

@media (min-width: 768px) {
    .wp-voting-container {
        padding: 15px;
    }
    
    .wp-voting-header h2 {
        font-size: 2.2rem;
    }
    
    .wp-voting-header p {
        font-size: 1.1rem;
    }
    
    .wp-voting-teams {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 15px;
        margin-bottom: 30px;
    }
    
    .wp-voting-team-card {
        margin: 0;
        padding: 15px;
    }
    
    .wp-voting-user-types {
        gap: 25px;
        margin-top: 30px;
    }
    
    .wp-voting-user-type-card {
        width: 200px;
        height: 220px;
    }
    
    .wp-voting-header {
        margin: 20px 0 30px 0;
    }
    
    .score-grid {
        grid-template-columns: repeat(5, 1fr);
        grid-template-rows: repeat(2, 1fr);
        gap: 10px;
        max-width: 100%;
        width: 100%;
    }
    
    .podium-3d {
        gap: 20px;
    }
    
    .podium-position.first .podium-column {
        width: 150px;
        height: 240px;
    }
    
    .podium-position.second .podium-column {
        width: 130px;
        height: 200px;
    }
    
    .podium-position.third .podium-column {
        width: 130px;
        height: 160px;
    }
    
    /* Larger podium labels on desktop */
    .podium-label {
        bottom: -50px;
        padding: 8px 0;
        font-size: 0.9rem;
        letter-spacing: 1px;
        border-radius: 0;
    }
    
    .wp-voting-podium-container {
        padding: 20px 0 80px 0; /* Increased bottom padding to accommodate labels */
    }
    
    .teams-list {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

@media (min-width: 1024px) {
    .wp-voting-container {
        padding: 20px;
    }
    
    .wp-voting-teams {
        gap: 20px;
        margin-bottom: 30px;
    }
    
    .wp-voting-team-card {
        padding: 18px;
    }
    
    .wp-voting-user-types {
        gap: 30px;
        margin-top: 40px;
    }
    
    .wp-voting-user-type-card {
        width: 220px;
        height: 240px;
    }
    
    .wp-voting-header {
        margin: 30px 0 40px 0;
    }
    
    .wp-voting-form-actions,
    .wp-voting-results-actions {
        gap: 20px;
        margin-top: 40px;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

.bounce-in {
    animation: bounceIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Loading States */
.wp-voting-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.wp-voting-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Success/Error Messages */
.wp-voting-message {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 600;
    text-align: center;
}

.wp-voting-message.success {
    background: linear-gradient(45deg, #2ed573, #26d0ce);
    color: white;
}

.wp-voting-message.error {
    background: linear-gradient(45deg, #ff4757, #ff3742);
    color: white;
}

/* ============================================
   LIVE ANIMATION STYLES
   ============================================ */

/* Position change highlight */
.position-changed {
    animation: positionChangeFlash 2s ease-in-out;
}

@keyframes positionChangeFlash {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }
    25% {
        transform: scale(1.05);
        box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
    }
    75% {
        transform: scale(1.03);
        box-shadow: 0 7px 22px rgba(255, 215, 0, 0.3);
    }
}

/* Score update highlight */
.score-updated {
    animation: scoreUpdatePulse 1s ease-in-out;
}

@keyframes scoreUpdatePulse {
    0% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(139, 92, 246, 0.2);
        transform: scale(1.1);
    }
    100% {
        background-color: transparent;
        transform: scale(1);
    }
}

/* Team card position change animation */
.team-card.position-changed {
    animation: teamCardHighlight 2s ease-in-out;
}

@keyframes teamCardHighlight {
    0%, 100% {
        background: #f8f9fa;
        transform: translateX(0);
    }
    25% {
        background: rgba(255, 215, 0, 0.1);
        transform: translateX(10px);
    }
    50% {
        background: rgba(255, 215, 0, 0.2);
        transform: translateX(5px);
    }
    75% {
        background: rgba(255, 215, 0, 0.1);
        transform: translateX(8px);
    }
}

/* Podium position smooth transitions */
.podium-position {
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced score number transitions */
.score-number {
    transition: all 0.3s ease;
    display: inline-block;
}

/* Team rank smooth transitions */
.team-rank {
    transition: all 0.5s ease;
}

/* Enhanced hover effects for animated elements */
.position-changed:hover {
    transform: scale(1.08) !important;
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.5) !important;
}

/* Smooth list updates */
.teams-list {
    transition: all 0.3s ease;
}

.team-card {
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}



/* Enhanced podium animations for position changes */
.podium-position.first {
    animation-delay: 0s;
}

.podium-position.second {
    animation-delay: 0.1s;
}

.podium-position.third {
    animation-delay: 0.2s;
}

/* Score counting animation enhancement */
.score-box {
    transition: all 0.3s ease;
}

.score-box.updating {
    background: linear-gradient(45deg, #28a745, #20c997);
    transform: scale(1.05);
}

/* Position swap animation với hiệu ứng chạy rõ ràng */
@keyframes positionSwapRun {
    0% {
        transform: translateX(0) translateY(0) scale(1);
        opacity: 1;
    }
    25% {
        transform: translateX(-30px) translateY(-10px) scale(1.1);
        opacity: 0.8;
    }
    50% {
        transform: translateX(0) translateY(-20px) scale(1.15);
        opacity: 1;
    }
    75% {
        transform: translateX(30px) translateY(-10px) scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: translateX(0) translateY(0) scale(1);
        opacity: 1;
    }
}

.swapping-position {
    animation: positionSwapRun 1.2s ease-in-out;
    z-index: 10;
}

/* ENHANCED: Rõ ràng hơn - Teams thực sự di chuyển đến vị trí mới */
@keyframes moveToFirst {
    0% {
        transform: translateX(0) scale(1);
        z-index: 1;
    }
    50% {
        transform: translateX(-150px) scale(1.2);
        z-index: 20;
    }
    100% {
        transform: translateX(0) scale(1);
        z-index: 1;
    }
}

@keyframes moveToSecond {
    0% {
        transform: translateX(0) scale(1);
        z-index: 1;
    }
    50% {
        transform: translateX(-75px) scale(1.15);
        z-index: 20;
    }
    100% {
        transform: translateX(0) scale(1);
        z-index: 1;
    }
}

@keyframes moveToThird {
    0% {
        transform: translateX(0) scale(1);
        z-index: 1;
    }
    50% {
        transform: translateX(75px) scale(1.15);
        z-index: 20;
    }
    100% {
        transform: translateX(0) scale(1);
        z-index: 1;
    }
}

@keyframes moveFromFirst {
    0% {
        transform: translateX(0) scale(1);
        z-index: 1;
    }
    50% {
        transform: translateX(150px) scale(0.9);
        z-index: 20;
    }
    100% {
        transform: translateX(0) scale(1);
        z-index: 1;
    }
}

@keyframes moveFromSecond {
    0% {
        transform: translateX(0) scale(1);
        z-index: 1;
    }
    50% {
        transform: translateX(75px) scale(0.95);
        z-index: 20;
    }
    100% {
        transform: translateX(0) scale(1);
        z-index: 1;
    }
}

@keyframes moveFromThird {
    0% {
        transform: translateX(0) scale(1);
        z-index: 1;
    }
    50% {
        transform: translateX(-75px) scale(1.05);
        z-index: 20;
    }
    100% {
        transform: translateX(0) scale(1);
        z-index: 1;
    }
}

/* Classes cho di chuyển rõ ràng đến từng vị trí */
.moving-to-first {
    animation: moveToFirst 1.5s ease-in-out;
}

.moving-to-second {
    animation: moveToSecond 1.5s ease-in-out;
}

.moving-to-third {
    animation: moveToThird 1.5s ease-in-out;
}

.moving-from-first {
    animation: moveFromFirst 1.5s ease-in-out;
}

.moving-from-second {
    animation: moveFromSecond 1.5s ease-in-out;
}

.moving-from-third {
    animation: moveFromThird 1.5s ease-in-out;
}

/* Hiệu ứng chạy cho podium positions */
@keyframes podiumRunLeft {
    0% {
        transform: translateX(0) scale(1);
    }
    50% {
        transform: translateX(-100px) scale(1.1);
    }
    100% {
        transform: translateX(0) scale(1);
    }
}

@keyframes podiumRunRight {
    0% {
        transform: translateX(0) scale(1);
    }
    50% {
        transform: translateX(100px) scale(1.1);
    }
    100% {
        transform: translateX(0) scale(1);
    }
}

@keyframes podiumRunCenter {
    0% {
        transform: translateX(0) scale(1);
    }
    25% {
        transform: translateX(-50px) scale(1.05);
    }
    75% {
        transform: translateX(50px) scale(1.05);
    }
    100% {
        transform: translateX(0) scale(1);
    }
}

/* Classes cho các hướng chạy khác nhau */
.running-left {
    animation: podiumRunLeft 1s ease-in-out;
    z-index: 15;
}

.running-right {
    animation: podiumRunRight 1s ease-in-out;
    z-index: 15;
}

.running-center {
    animation: podiumRunCenter 1.2s ease-in-out;
    z-index: 15;
}

/* Hiệu ứng trail (vệt sáng) khi chạy */
.running-trail::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 215, 0, 0.3) 25%, 
        rgba(255, 215, 0, 0.6) 50%, 
        rgba(255, 215, 0, 0.3) 75%, 
        transparent 100%);
    border-radius: inherit;
    animation: trailMove 1s ease-in-out;
    pointer-events: none;
}

@keyframes trailMove {
    0% {
        opacity: 0;
        transform: translateX(-100%);
    }
    50% {
        opacity: 1;
        transform: translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Team card running animations */
@keyframes teamCardRunUp {
    0% {
        transform: translateY(0) translateX(0);
    }
    50% {
        transform: translateY(-20px) translateX(-15px);
    }
    100% {
        transform: translateY(0) translateX(0);
    }
}

@keyframes teamCardRunDown {
    0% {
        transform: translateY(0) translateX(0);
    }
    50% {
        transform: translateY(20px) translateX(15px);
    }
    100% {
        transform: translateY(0) translateX(0);
    }
}

.team-card.running-up {
    animation: teamCardRunUp 0.8s ease-in-out;
}

.team-card.running-down {
    animation: teamCardRunDown 0.8s ease-in-out;
}

/* Hiệu ứng "vượt qua" cho teams */
@keyframes overtaking {
    0% {
        transform: translateX(0) scale(1);
        z-index: 1;
    }
    25% {
        transform: translateX(-40px) scale(1.1);
        z-index: 20;
    }
    50% {
        transform: translateX(0) scale(1.15);
        z-index: 20;
    }
    75% {
        transform: translateX(40px) scale(1.1);
        z-index: 20;
    }
    100% {
        transform: translateX(0) scale(1);
        z-index: 1;
    }
}

.overtaking {
    animation: overtaking 1.5s ease-in-out;
}

/* Dust effect khi chạy */
@keyframes dustCloud {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
    100% {
        opacity: 0;
        transform: scale(1.5);
    }
}

.dust-effect::before {
    content: '💨';
    position: absolute;
    bottom: -10px;
    right: -10px;
    font-size: 1.2rem;
    animation: dustCloud 0.8s ease-out;
    pointer-events: none;
}

/* PODIUM RECONSTRUCTION EFFECTS */
@keyframes podiumFadeOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8);
    }
}

@keyframes podiumFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.podium-reconstructing .podium-position {
    animation: podiumFadeOut 0.5s ease-in-out;
}

.podium-rebuilding .podium-position {
    animation: podiumFadeIn 0.8s ease-out;
}

/* Enhanced position swapping với clear direction */
@keyframes swapLeftToRight {
    0% {
        transform: translateX(0) scale(1);
    }
    25% {
        transform: translateX(-50px) scale(1.1);
    }
    50% {
        transform: translateX(100px) scale(1.2);
    }
    75% {
        transform: translateX(150px) scale(1.1);
    }
    100% {
        transform: translateX(0) scale(1);
    }
}

@keyframes swapRightToLeft {
    0% {
        transform: translateX(0) scale(1);
    }
    25% {
        transform: translateX(50px) scale(1.1);
    }
    50% {
        transform: translateX(-100px) scale(1.2);
    }
    75% {
        transform: translateX(-150px) scale(1.1);
    }
    100% {
        transform: translateX(0) scale(1);
    }
}

@keyframes swapCenterOut {
    0% {
        transform: translateX(0) scale(1);
    }
    25% {
        transform: translateX(-25px) scale(1.05);
    }
    50% {
        transform: translateX(200px) scale(1.15);
    }
    75% {
        transform: translateX(100px) scale(1.1);
    }
    100% {
        transform: translateX(0) scale(1);
    }
}

@keyframes swapOutToCenter {
    0% {
        transform: translateX(0) scale(1);
    }
    25% {
        transform: translateX(100px) scale(1.05);
    }
    50% {
        transform: translateX(-200px) scale(1.15);
    }
    75% {
        transform: translateX(-100px) scale(1.1);
    }
    100% {
        transform: translateX(0) scale(1);
    }
}

.swap-left-to-right {
    animation: swapLeftToRight 2s ease-in-out;
    z-index: 25;
}

.swap-right-to-left {
    animation: swapRightToLeft 2s ease-in-out;
    z-index: 25;
}

.swap-center-out {
    animation: swapCenterOut 2s ease-in-out;
    z-index: 25;
}

.swap-out-to-center {
    animation: swapOutToCenter 2s ease-in-out;
    z-index: 25;
}

/* Team name and score update effects */
@keyframes nameChange {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.name-changing {
    animation: nameChange 1s ease-in-out;
}

/* Position indicator effects */
@keyframes positionBadgeUpdate {
    0% {
        background: #ffd700;
        transform: scale(1);
    }
    50% {
        background: #ff6b6b;
        transform: scale(1.3);
    }
    100% {
        background: #ffd700;
        transform: scale(1);
    }
}

.position-badge-updating {
    animation: positionBadgeUpdate 1.5s ease-in-out;
}

/* Responsive animations */
@media (max-width: 768px) {
    .position-changed {
        animation-duration: 1.5s;
    }
    
    @keyframes positionChangeFlash {
        0%, 100% {
            transform: scale(1);
        }
        50% {
            transform: scale(1.03);
        }
    }
    
    .team-card.position-changed {
        animation-duration: 1.5s;
    }
    
    @keyframes teamCardHighlight {
        0%, 100% {
            transform: translateX(0);
        }
        50% {
            transform: translateX(5px);
        }
    }
    
    /* Mobile running animations - nhẹ hơn */
    @keyframes podiumRunLeft {
        0% {
            transform: translateX(0) scale(1);
        }
        50% {
            transform: translateX(-30px) scale(1.05);
        }
        100% {
            transform: translateX(0) scale(1);
        }
    }
    
    @keyframes podiumRunRight {
        0% {
            transform: translateX(0) scale(1);
        }
        50% {
            transform: translateX(30px) scale(1.05);
        }
        100% {
            transform: translateX(0) scale(1);
        }
    }
    
    @keyframes podiumRunCenter {
        0% {
            transform: translateX(0) scale(1);
        }
        25% {
            transform: translateX(-20px) scale(1.02);
        }
        75% {
            transform: translateX(20px) scale(1.02);
        }
        100% {
            transform: translateX(0) scale(1);
        }
    }
    
    /* Mobile team card running - nhỏ hơn */
    @keyframes teamCardRunUp {
        0% {
            transform: translateY(0) translateX(0);
        }
        50% {
            transform: translateY(-10px) translateX(-8px);
        }
        100% {
            transform: translateY(0) translateX(0);
        }
    }
    
    @keyframes teamCardRunDown {
        0% {
            transform: translateY(0) translateX(0);
        }
        50% {
            transform: translateY(10px) translateX(8px);
        }
        100% {
            transform: translateY(0) translateX(0);
        }
    }
    
    /* Mobile overtaking - giảm intensity */
    @keyframes overtaking {
        0% {
            transform: translateX(0) scale(1);
        }
        25% {
            transform: translateX(-15px) scale(1.05);
        }
        50% {
            transform: translateX(0) scale(1.08);
        }
        75% {
            transform: translateX(15px) scale(1.05);
        }
        100% {
            transform: translateX(0) scale(1);
        }
    }
    
    /* Mobile dust effect - nhỏ hơn */
    .dust-effect::before {
        font-size: 0.9rem;
        bottom: -5px;
        right: -5px;
    }
}

/* =========================
   SIMPLE ANIMATIONS - CHỈ FLASH ĐƠN GIẢN
   ========================= */

/* Content update flash - ĐƠN GIẢN */
.content-updated {
    animation: simple-flash 0.8s ease-out;
}

@keyframes simple-flash {
    0% { 
        background-color: rgba(78, 205, 196, 0.2);
        transform: scale(1);
    }
    50% { 
        background-color: rgba(69, 183, 209, 0.3);
        transform: scale(1.01);
    }
    100% { 
        background-color: transparent;
        transform: scale(1);
    }
}

/* ============================================
   VERIFICATION MODAL STYLES (New - Safe)
   ============================================ */

.wp-voting-verification-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
}

.wp-voting-verification-modal.show {
    display: block;
}

.verification-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    z-index: 10000;
}

.verification-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
    margin: 0;
    box-sizing: border-box;
    z-index: 10001;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.verification-header {
    padding: 20px 25px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.verification-header h3 {
    margin: 0;
    color: white;
    font-size: 1.4em;
    font-weight: 600;
}

.verification-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.verification-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.verification-body {
    padding: 25px;
    text-align: center;
}

.verification-body p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 25px;
    font-size: 1.1em;
    line-height: 1.4;
}

.verification-inputs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 25px 0;
    flex-wrap: nowrap;
    width: 100%;
    box-sizing: border-box;
}

.verification-input {
    width: 50px;
    height: 60px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff !important;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    transition: all 0.3s ease;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
    flex-grow: 0;
    box-sizing: border-box;
    appearance: textfield;
    -moz-appearance: textfield;
    -webkit-text-fill-color: #ffffff !important;
}

/* Hide number input spinners */
.verification-input::-webkit-outer-spin-button,
.verification-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

/* Firefox */
.verification-input[type=number] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.verification-input:focus {
    outline: none;
    border-color: #ffd700;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    transform: scale(1.05);
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

.verification-input:valid {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.2);
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

.verification-info {
    margin: 20px 0;
}

.attempts-remaining {
    color: #ffd700;
    font-weight: 600;
    font-size: 1em;
    display: inline-block;
    padding: 8px 16px;
    background: rgba(255, 215, 0, 0.2);
    border-radius: 20px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.verification-hint {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
    margin: 15px 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border-left: 4px solid #ffd700;
}

.verification-message {
    margin: 15px 0;
    min-height: 20px;
}

.verification-message .message {
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 500;
    animation: messageSlideIn 0.3s ease-out;
}

.verification-message .message.success {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.verification-message .message.error {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.verification-footer {
    padding: 20px 25px 25px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.verification-footer button {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-verify {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.btn-verify:hover:not(:disabled) {
    background: linear-gradient(45deg, #45a049, #4CAF50);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.btn-verify:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Lockout message styles */
.lockout-message {
    text-align: center;
    padding: 20px 0;
}

.lockout-icon {
    font-size: 48px;
    margin-bottom: 15px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.lockout-message h4 {
    color: white;
    margin: 15px 0;
    font-size: 1.3em;
}

.lockout-message p {
    color: rgba(255, 255, 255, 0.9);
    margin: 15px 0 25px;
    line-height: 1.5;
}

.btn-back {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Mobile responsive for verification modal */
@media (max-width: 480px) {
    .verification-content {
        width: 95%;
        max-width: 350px;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        margin: 0;
        box-sizing: border-box;
    }
    
    .verification-inputs {
        gap: 6px;
        justify-content: center;
        align-items: center;
        flex-wrap: nowrap;
        width: 100%;
        max-width: 300px;
        margin: 20px auto;
        padding: 0 10px;
        box-sizing: border-box;
    }
    
    .verification-input {
        width: 50px;
        height: 55px;
        font-size: 20px;
        flex-shrink: 0;
        flex-grow: 0;
        min-width: 45px;
        max-width: 55px;
        color: #ffffff !important;
        -webkit-text-fill-color: #ffffff !important;
    }
    
    .verification-footer {
        flex-direction: column;
        gap: 10px;
        justify-content: center;
        align-items: center;
    }
    
    .verification-footer button {
        width: 100%;
        max-width: 280px;
    }
    
    .verification-header h3 {
        font-size: 1.2em;
    }
    
    /* Fix for virtual keyboard on mobile */
    .wp-voting-verification-modal {
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile */
    }
    
    .verification-content {
        max-height: 85vh;
        max-height: 85dvh;
        overflow-y: auto;
    }
}

/* Extra small mobile (≤360px) */
@media (max-width: 360px) {
    .verification-content {
        width: 98%;
        max-width: 320px;
    }
    
    .verification-inputs {
        gap: 4px;
        max-width: 250px;
        padding: 0 5px;
    }
    
    .verification-input {
        width: 42px;
        height: 50px;
        font-size: 18px;
        min-width: 40px;
        max-width: 45px;
        color: #ffffff !important;
        -webkit-text-fill-color: #ffffff !important;
    }
    
    .verification-body {
        padding: 15px 10px;
    }
    
    .verification-header h3 {
        font-size: 1.1em;
    }
}

/* Tablet responsive for verification modal */
@media (min-width: 481px) and (max-width: 768px) {
    .verification-content {
        width: 85%;
        max-width: 380px;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        margin: 0;
        box-sizing: border-box;
    }
    
    .verification-inputs {
        gap: 10px;
        justify-content: center;
        align-items: center;
    }
    
    .verification-input {
        width: 48px;
        height: 58px;
        font-size: 22px;
        color: #ffffff !important;
        -webkit-text-fill-color: #ffffff !important;
    }
    
    .verification-footer {
        flex-direction: row;
        gap: 15px;
        justify-content: center;
        align-items: center;
    }
    
    .verification-footer button {
        min-width: 140px;
        max-width: none;
    }
}

/* Force inputs to show on ALL screen sizes - CRITICAL FIX */
.verification-inputs input[type="number"].verification-input {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: auto !important;
    height: auto !important;
    position: static !important;
    float: none !important;
    clear: none !important;
    margin: 0 !important;
    transform: none !important;
    clip: none !important;
    clip-path: none !important;
    overflow: visible !important;
}

/* Desktop responsive for verification modal - CRITICAL FIX */
@media (min-width: 769px) {
    .verification-content {
        width: 80%;
        max-width: 500px;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        margin: 0;
        padding: 35px;
        border-radius: 20px;
        box-sizing: border-box;
    }
    
    .verification-inputs {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 15px !important;
        margin: 30px 0 !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
        max-width: none !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }
    
    .verification-input {
        width: 60px !important;
        height: 70px !important;
        font-size: 28px !important;
        border-radius: 15px !important;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        min-width: 60px !important;
        max-width: 60px !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: #ffffff !important;
        -webkit-text-fill-color: #ffffff !important;
        position: relative !important;
        z-index: 1 !important;
    }
    
    /* Force show all inputs on desktop */
    .verification-inputs .verification-input:nth-child(1),
    .verification-inputs .verification-input:nth-child(2),
    .verification-inputs .verification-input:nth-child(3),
    .verification-inputs .verification-input:nth-child(4) {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: static !important;
        float: none !important;
        clear: none !important;
    }
    
    .verification-footer {
        flex-direction: row;
        gap: 20px;
        justify-content: center;
        align-items: center;
        padding: 25px 0 0;
    }
    
    .verification-footer button {
        min-width: 150px;
        max-width: none;
        padding: 14px 30px;
        font-size: 1.1em;
    }
    
    .verification-header h3 {
        font-size: 1.6em;
        margin-bottom: 10px;
    }
    
    .verification-body {
        padding: 25px 0;
        text-align: center;
    }
    
    .verification-body p {
        font-size: 1.2em;
        margin-bottom: 20px;
    }
} 