/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7, #dda0dd);
    background-size: 1200% 1200%;
    animation: rainbow 10s ease infinite;
    color: white;
    text-align: center;
    padding: 30px 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

@keyframes rainbow {
    0% { background-position: 0% 50% }
    50% { background-position: 100% 50% }
    100% { background-position: 0% 50% }
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding: 30px;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Input Section */
.input-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    border: 3px dashed #dee2e6;
}

.input-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #495057;
    font-size: 1.1em;
}

textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 16px;
    resize: vertical;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #4ecdc4;
    box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.1);
}

.counter {
    text-align: right;
    margin-top: 5px;
    color: #6c757d;
    font-size: 0.9em;
}

/* File Upload */
.file-upload {
    position: relative;
    margin-bottom: 10px;
}

.file-upload input[type="file"] {
    display: none;
}

.upload-btn {
    display: inline-block;
    padding: 12px 25px;
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-align: center;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.file-name {
    margin-left: 15px;
    color: #6c757d;
}

/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 15px;
    flex-wrap: wrap;
}

.control-group {
    flex: 1;
}

select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 16px;
    background: white;
}

.button-group {
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

.btn-spin {
    background: linear-gradient(135deg, #ffd93d, #ff9a3d);
    color: #333;
    font-size: 1.2em;
    padding: 15px 40px;
}

.btn-spin:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 157, 61, 0.4);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Wheel Section */
.wheel-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.wheel-container {
    position: relative;
    width: 500px;
    height: 500px;
    max-width: 100%;
}

#wheelCanvas {
    width: 100%;
    height: 100%;
    transition: transform 4s cubic-bezier(0.2, 0.8, 0.3, 1);
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.wheel-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 40px;
    color: #ff6b6b;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.spin-controls {
    text-align: center;
}

.current-stats {
    margin-top: 15px;
    font-size: 1.1em;
    color: #495057;
    font-weight: bold;
}

/* Results Section */
.results-section {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .results-section {
        grid-template-columns: 1fr;
    }
}

.winners-box, .history-box {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    border: 2px solid #e9ecef;
}

.winners-box h3, .history-box h3 {
    color: #495057;
    margin-bottom: 15px;
    text-align: center;
}

.winner-display {
    min-height: 100px;
    background: white;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    font-size: 1.5em;
    font-weight: bold;
    color: #ff6b6b;
    border: 3px dashed #4ecdc4;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.winner-history {
    min-height: 150px;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

.winner-item {
    padding: 10px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    border-radius: 8px;
    border-left: 4px solid #4ecdc4;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
    flex-direction: column;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid #4ecdc4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Celebration Animation */
@keyframes celebrate {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.celebrating {
    animation: celebrate 0.5s ease infinite;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .wheel-container {
        width: 400px;
        height: 400px;
    }
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 15px;
    }
    
    .main-content {
        padding: 20px;
        gap: 20px;
    }
    
    .wheel-container {
        width: 300px;
        height: 300px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .button-group {
        width: 100%;
    }
    
    .btn {
        flex: 1;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .wheel-container {
        width: 250px;
        height: 250px;
    }
    
    header {
        padding: 20px 15px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .input-section, .winners-box, .history-box {
        padding: 15px;
    }
}

/* Scrollbar Styling */
.winner-history::-webkit-scrollbar {
    width: 8px;
}

.winner-history::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.winner-history::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    border-radius: 4px;
}

.winner-history::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #45b7d1, #3a9cb4);
}