/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Defago Noto', Arial, sans-serif;
}

:root {
    --primary-color: #1e3a8a; /* Dark blue */
    --secondary-color: #dc2626; /* Red */
    --primary-light: #3b82f6; /* Lighter blue */
    --secondary-light: #ef4444; /* Lighter red */
    --text-color: #1e293b;
    --bg-color: #f1f5f9;
    --success-color: #22c55e;
    --success-light: rgba(34, 197, 94, 0.2);
    --error-color: #ef4444;
    --error-light: rgba(239, 68, 68, 0.2);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden; /* Prevent scrolling */
    height: 100vh;
}

.container {
    max-width: 80%; /* Changed to 80% as requested */
    height: calc(100vh - 20px); /* Adjusted height to account for bottom margin */
    margin: 0 auto;
    padding: 20px 20px 0 20px; /* Removed bottom padding since we now have margin */
    display: flex;
    flex-direction: column;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary-color);
}

h2 {
    margin: 15px 0;
    color: var(--primary-color);
}

h3 {
    margin: 12px 0;
    color: var(--primary-color);
}

/* Results Section */
.results-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin-bottom: 80px; /* Added bottom margin to prevent overlap with floating buttons */
}

#winners-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    overflow: hidden;
    flex: 1;
    height: 100%;
}

.winner-category {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.winner-category-header {
    background-color: var(--primary-color);
    color: white;
    padding: 10px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.winner-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    padding: 10px;
    overflow-y: auto;
    position: relative; /* For randomization status overlay */
    flex: 1;
    scrollbar-width: thin;
}

.randomizing-status {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.randomizing-text {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--secondary-color);
    margin-bottom: 15px;
    text-align: center;
}

.randomizing-dots {
    display: flex;
    gap: 6px;
}

.randomizing-dot {
    width: 10px;
    height: 10px;
    background-color: var(--primary-color);
    border-radius: 50%;
    animation: dotPulse 1.4s infinite ease-in-out;
}

.randomizing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.randomizing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotPulse {
    0%, 100% { transform: scale(0.7); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
}

.winner-list::-webkit-scrollbar {
    width: 6px;
}

.winner-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.winner-list::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
}

.winner-item {
    display: flex;
    flex-direction: column;
    padding: 8px;
    background-color: #f9f9f9;
    border-radius: 4px;
    transition: all 0.3s;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.winner-item:hover {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.winner-info {
    display: flex;
    flex-direction: column;
}

.winner-phone {
    font-weight: bold;
    margin-bottom: 4px;
}

.winner-name {
    font-size: 0.9em;
    color: #555;
}

.winner-status {
    font-size: 0.8em;
    margin-top: 5px;
    font-style: italic;
    text-align: right;
}

.winner-item.confirmed {
    background-color: var(--success-light);
    border-left: 3px solid var(--success-color);
}

.winner-item.pushed {
    background-color: var(--error-light);
    border-left: 3px solid var(--error-color);
}

/* Winner Celebration Animation */
.winner-item.new {
    animation: celebrate 1.2s ease-out;
}

@keyframes celebrate {
    0% { 
        transform: scale(0.5);
        opacity: 0;
        box-shadow: 0 0 0 rgba(220, 38, 38, 0);
    }
    25% { 
        transform: scale(1.1);
        opacity: 1;
        box-shadow: 0 0 20px rgba(220, 38, 38, 0.4);
    }
    50% {
        transform: scale(0.95);
    }
    75% {
        transform: scale(1.05);
        box-shadow: 0 0 10px rgba(220, 38, 38, 0.2);
    }
    100% { 
        transform: scale(1);
        box-shadow: none;
    }
}

/* Confetti Animation */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

/* Floating Action Buttons */
.floating-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.floating-button:hover {
    background-color: var(--primary-light);
    transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
}

.gear-icon {
    font-size: 24px;
}

.floating-draw-button {
    position: fixed;
    bottom: 30px;
    left: 30px;
    padding: 15px 25px;
    border-radius: 30px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 900;
    font-weight: bold;
    transition: all 0.3s;
}

.floating-draw-button:hover:not(:disabled) {
    background-color: var(--secondary-light);
    transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
}

.floating-draw-button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.config-modal {
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    text-align: left;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.close-button {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover {
    color: var(--secondary-color);
}

.loading-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.loading-wheel {
    border: 6px solid #f3f3f3;
    border-top: 6px solid var(--primary-color);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

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

/* Upload Section */
.upload-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.file-upload {
    margin: 15px 0;
}

.file-upload input[type="file"] {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

.file-upload label {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.file-upload label:hover {
    background-color: var(--primary-light);
}

#file-status, #total-users {
    margin-top: 10px;
    font-size: 14px;
}

/* Configuration Section */
.config-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.winner-type-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.winner-type-controls input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    flex: 1;
}

.winner-type-controls button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.winner-type-controls button:hover {
    background-color: var(--primary-light);
}

.winner-types-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.winner-type-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f9f9f9;
    padding: 10px 15px;
    border-radius: 4px;
    border-left: 4px solid var(--primary-color);
}

.winner-type-item button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.winner-type-item button:hover {
    background-color: var(--secondary-light);
}

/* Download Button */
.download-section, .reset-section {
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.download-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.download-button:hover:not(:disabled) {
    background-color: var(--primary-light);
}

.download-button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.reset-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.reset-button:hover {
    background-color: var(--secondary-light);
}

/* Animation for winner items */
@keyframes winnerAppear {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    60% {
        opacity: 1;
        transform: translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Animation */
.winner-list.loading {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px;
}

.loading-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 4px solid var(--primary-color);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

/* Confetti styles */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #f00;
    opacity: 0;
}

/* Global confetti */
.global-confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background-color: #f00;
    opacity: 0;
    z-index: 1050;
}

/* Placeholder message */
.placeholder-message {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #777;
    text-align: center;
    padding: 20px;
}

.placeholder-message p {
    margin: 5px 0;
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 15px;
    color: var(--primary-light);
}

/* Confirmation Modal */
.confirmation-modal {
    width: 450px;
    padding: 20px;
    text-align: center;
}

.confirmation-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.confirm-button {
    background-color: var(--success-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 15px;
    cursor: pointer;
}

.push-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 15px;
    cursor: pointer;
}

.cancel-button {
    background-color: #95a5a6;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 15px;
    cursor: pointer;
}

/* Countdown Timer */
.countdown-modal {
    text-align: center;
    min-width: 300px;
}

.countdown-number {
    font-size: 100px;
    font-weight: bold;
    color: var(--primary-color);
    margin: 20px 0;
}

.countdown-text {
    font-size: 24px;
    margin-bottom: 20px;
}