/* Base styles */
body {
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Button hover effect */
.btn-hover {
    position: relative;
    overflow: hidden;
}

.btn-hover::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease-out, height 0.6s ease-out;
}

.btn-hover:hover::after {
    width: 300px;
    height: 300px;
}

/* Spinner container */
.spinner-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Spinner animation */
.spinner {
    width: 80px;
    height: 80px;
    border: 3px solid #f3f4f6;
    border-top-color: #3b82f6;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.spinning .spinner {
    opacity: 1;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Progress bar */
.progress-bar {
    width: 200px;
    height: 4px;
    background: #f3f4f6;
    border-radius: 2px;
    margin-top: 1rem;
    overflow: hidden;
}

.progress {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    transition: width 0.3s ease-out;
}

.spinning .progress {
    animation: progress 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes progress {
    0% { width: 0; }
    100% { width: 100%; }
}

/* Loading text */
.loading-text {
    margin-top: 1rem;
    color: #6b7280;
    font-size: 0.875rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.spinning .loading-text {
    opacity: 1;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Group card styles */
.group-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1rem;
    transition: all 0.2s ease;
}

.group-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Modal animation */
#winner-modal {
    opacity: 0;
    transition: opacity 0.3s ease;
}

#winner-modal.show {
    opacity: 1;
}

#winner-modal .modal-content {
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

#winner-modal.show .modal-content {
    transform: scale(1);
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }
    
    .shuffle-container {
        height: 60vh;
    }
    
    .group-card {
        padding: 0.75rem;
    }
}

/* Classic Spinner Animation */
.classic-spinner {
    position: relative;
    width: 64px;
    height: 64px;
}

.classic-spinner .circle {
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
}

.classic-spinner .circle:before {
    content: '';
    display: block;
    margin: 0 auto;
    width: 15%;
    height: 15%;
    background-color: #3b82f6;
    border-radius: 100%;
    animation: classic-spinner 1.2s infinite ease-in-out both;
}

.classic-spinner .circle:nth-child(1) { transform: rotate(0deg); }
.classic-spinner .circle:nth-child(2) { transform: rotate(90deg); }
.classic-spinner .circle:nth-child(3) { transform: rotate(180deg); }
.classic-spinner .circle:nth-child(4) { transform: rotate(270deg); }

.classic-spinner .circle:nth-child(1):before { animation-delay: -1.2s; }
.classic-spinner .circle:nth-child(2):before { animation-delay: -1.1s; }
.classic-spinner .circle:nth-child(3):before { animation-delay: -1.0s; }
.classic-spinner .circle:nth-child(4):before { animation-delay: -0.9s; }

@keyframes classic-spinner {
    0%, 80%, 100% { 
        transform: scale(0);
    } 
    40% { 
        transform: scale(1.0);
    }
}

.city-scape {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 600px;
    height: 100px;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 20px,
        #333 20px,
        #333 40px
    );
}

.buildings {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 600px;
    height: 100px;
    display: flex;
    align-items: flex-end;
}

.building {
    width: 20px;
    margin-right: 20px;
    background: #555;
}

.building:nth-child(1) { height: 80px; }
.building:nth-child(2) { height: 60px; }
.building:nth-child(3) { height: 90px; }
.building:nth-child(4) { height: 50px; }
.building:nth-child(5) { height: 70px; }

.spinning .city-scape {
    animation: scroll-city 3s linear infinite;
}

@keyframes scroll-city {
    0% { transform: translateX(0); }
    100% { transform: translateX(-300px); }
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    margin-top: 20px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: #3b82f6;
    width: 0;
}

.spinning .progress {
    animation: progress 3s linear forwards;
}

/* Enhanced Firework Animation */
.firework {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: firework 1.2s ease-out forwards;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.firework:nth-child(3n) { background: #ff0; }
.firework:nth-child(3n+1) { background: #f06; }
.firework:nth-child(3n+2) { background: #0ff; }

@keyframes firework {
    0% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
    50% {
        transform: scale(2) translateY(-20px);
        opacity: 0.8;
    }
    100% {
        transform: scale(3) translateY(-40px);
        opacity: 0;
    }
}

.firework-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.winner-animation {
    animation: winner-pop 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
}

@keyframes winner-pop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Main Container Styles */
.shuffle-container {
    perspective: 1000px;
}

/* Spinner Animation */
.spinner {
    width: 60px;
    height: 60px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    margin: 0 auto;
    opacity: 0.2;
    transition: opacity 0.3s ease;
}

.spinning .spinner {
    animation: spin 0.8s linear infinite;
    opacity: 1;
}

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

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 3px;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
    margin-top: 1.5rem;
    opacity: 0.5;
    transform: scaleX(0.98);
    transition: all 0.3s ease;
}

.spinning .progress-bar {
    opacity: 1;
    transform: scaleX(1);
}

.progress {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    transform-origin: left;
    transition: width 0.3s ease;
}

.spinning .progress {
    animation: progress 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes progress {
    0% { width: 0; }
    100% { width: 100%; }
}

/* Loading Text Animation */
.spinning .loading-text {
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Winner Animation */
.winner-animation {
    animation: pop 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
}

@keyframes pop {
    0% { 
        transform: scale(0.8); 
        opacity: 0;
        filter: blur(4px);
    }
    50% { 
        transform: scale(1.1);
        filter: blur(0);
    }
    100% { 
        transform: scale(1); 
        opacity: 1;
        filter: blur(0);
    }
}

/* Firework Animation */
.firework-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.firework {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    animation: firework 0.8s ease-out forwards;
    filter: blur(0.5px);
}

.firework:nth-child(3n) { 
    background: #fbbf24;
    box-shadow: 0 0 8px #fbbf24;
}
.firework:nth-child(3n+1) { 
    background: #3b82f6;
    box-shadow: 0 0 8px #3b82f6;
}
.firework:nth-child(3n+2) { 
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
}

@keyframes firework {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* Button Hover Effects */
.btn-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-hover:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-hover:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}
