/* Variables */
:root {
    --primary-color: #F48120; /* Cloudflare orange */
    --secondary-color: #0051C3; /* Cloudflare blue */
    --background-color: #f9f9f9;
    --text-color: #333;
    --light-gray: #e0e0e0;
    --medium-gray: #999;
    --dark-gray: #555;
    --success-color: #4caf50;
    --error-color: #f44336;
    --border-radius: 8px;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

button {
    cursor: pointer;
    border: none;
    border-radius: var(--border-radius);
    padding: 8px 16px;
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

button.primary {
    background-color: var(--primary-color);
    color: white;
}

button.primary:hover:not(:disabled) {
    background-color: #e67211;
}

button.secondary {
    background-color: white;
    color: var(--dark-gray);
    border: 1px solid var(--light-gray);
}

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

input, textarea, select {
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
    padding: 8px 12px;
    font-size: 1rem;
    transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(244, 129, 32, 0.2);
}

.hidden {
    display: none !important;
}

/* Header */
header {
    background-color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--box-shadow);
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo {
    height: 30px;
    margin-right: 1rem;
}

/* Main Content */
main {
    flex: 1;
    padding: 2rem 1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .container {
        grid-template-columns: 1fr 1fr;
    }
}

/* Name Input Section */
.name-input-section {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
}

.tab-container {
    margin: 1rem 0;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--light-gray);
    margin-bottom: 1rem;
}

.tab {
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    margin-right: 0.5rem;
    border-bottom: 2px solid transparent;
}

.tab.active {
    border-bottom: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

#nameInput {
    flex: 1;
}

textarea {
    width: 100%;
    min-height: 100px;
    margin-bottom: 1rem;
    resize: vertical;
}

.file-upload {
    margin-bottom: 1rem;
}

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

.file-upload label {
    display: inline-block;
    background-color: var(--secondary-color);
    color: white;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.file-upload label:hover {
    background-color: #004099;
}

#columnSelector {
    margin: 1rem 0;
}

.google-sheets {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

#sheetsUrl {
    flex: 1;
}

.names-container {
    margin-top: 1.5rem;
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
}

.names-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: #f5f5f5;
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}

.names-list {
    list-style-type: none;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.names-list li {
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--light-gray);
}

.names-list li:last-child {
    border-bottom: none;
}

.names-list .remove-name {
    background: transparent;
    color: var(--medium-gray);
    padding: 4px 8px;
    border-radius: 50%;
}

.names-list .remove-name:hover {
    color: var(--error-color);
    background-color: rgba(244, 67, 54, 0.1);
}

/* Wheel Section */
.wheel-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wheel-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
    margin-bottom: 2rem;
}

.wheel-pointer {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 40px;
    background-color: var(--secondary-color);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    z-index: 2;
}

#wheelCanvas {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: var(--box-shadow);
    z-index: 1;
}

.empty-state {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    text-align: center;
    padding: 2rem;
}

#spinBtn {
    font-size: 1.2rem;
    padding: 12px 24px;
}

/* Winner Section */
.winner-section {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    text-align: center;
    margin-top: 1.5rem;
    width: 100%;
    max-width: 500px;
}

.winner-name {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 1rem 0;
    word-break: break-word;
}

.congrats-message {
    margin-bottom: 1.5rem;
    font-style: italic;
}

.winner-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

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

.modal-content {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--box-shadow);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Loading Overlay */
.loading {
    position: fixed;
    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: 2000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--light-gray);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Footer */
footer {
    text-align: center;
    padding: 1rem;
    background-color: white;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

/* Responsive Adjustments */
@media (max-width: 767px) {
    .input-group {
        flex-direction: column;
    }
    
    .google-sheets {
        flex-direction: column;
    }
    
    .wheel-container {
        max-width: 300px;
    }
    
    .winner-actions {
        flex-direction: column;
    }
    
    .winner-actions button {
        width: 100%;
    }
}

/* Accessibility */
:focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

/* Animation for notifications */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Sound button styles */
#soundToggle {
    background: transparent;
    border: 1px solid var(--light-gray);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
}

#soundToggle:hover {
    background-color: var(--light-gray);
}


/* Enhanced wheel zoom effect */
.wheel-container {
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275), width 0.8s ease, max-width 0.8s ease;
    position: relative;
    z-index: 1;
}

.wheel-container.zoomed {
    transform: scale(1.35); /* Increased zoom factor */
    z-index: 10;
}

/* Add a subtle highlight effect during zoom */
.wheel-container::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(244, 129, 32, 0);
    transition: box-shadow 0.8s ease;
    pointer-events: none;
}

.wheel-container.zoomed::after {
    box-shadow: 0 0 30px rgba(244, 129, 32, 0.3);
}

/* Adjust the wheel section during zoom */
.wheel-section {
    position: relative;
    overflow: visible; /* Allow the wheel to expand beyond its container */
}

/* Footer styles with orange links */
footer {
    text-align: center;
    padding: 1rem;
    background-color: white;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    line-height: 1.6;
}

footer a {
    color: var(--primary-color); /* Cloudflare orange */
    text-decoration: none;
    transition: color 0.3s ease, text-decoration 0.3s ease;
    font-weight: 500;
}

footer a:hover {
    color: #e67211; /* Darker orange on hover */
    text-decoration: underline;
}

/* Add these styles to your CSS file */

/* Highlight animation for winner segment */
@keyframes pulse {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.5) drop-shadow(0 0 10px rgba(255, 255, 255, 0.7)); }
    100% { filter: brightness(1); }
}

.winner-highlight {
    animation: pulse 0.5s ease-in-out;
}

/* Transition for wheel when expanding winner segment */
#wheelCanvas {
    transition: transform 0.5s ease-out;
}

/* Add this to your existing zoomed class for the wheel container */
.wheel-container.zoomed {
    transform: scale(1.05);
    transition: transform 0.8s ease-out;
}

/* Winner announcement enhancement */
.winner-section {
    transition: opacity 0.5s ease-in-out;
}

/* Add a nice bounce effect to the winner's name */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-20px);}
    60% {transform: translateY(-10px);}
}

.winner-name {
    animation: bounce 1s ease;
    display: inline-block;
}

/* Add these styles to your CSS file */

/* Highlight animation for winner segment */
@keyframes pulse {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.3) drop-shadow(0 0 8px rgba(255, 255, 255, 0.8)); }
    100% { filter: brightness(1); }
}

.winner-highlight {
    animation: pulse 0.6s ease-in-out;
}

/* Add a nice bounce effect to the winner's name */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-15px);}
    60% {transform: translateY(-7px);}
}

.winner-name {
    animation: bounce 1s ease;
    display: inline-block;
}

/* Enhance the winner section appearance */
.winner-section {
    transition: opacity 0.3s ease-in-out;
}

/* Make sure the wheel transitions smoothly */
#wheelCanvas {
    transition: transform 0.3s ease-out;
}