/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    background-color: #1a1a1a;
    color: #e0e0e0;
}

/* Header styles */
header {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0.8rem 2rem;
    background-color: #2d2d2d;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.5s ease;
}

/* Add this new style for the winning color transition */
header.winner-section {
    background-color: var(--winner-color, #2d2d2d);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* Adjust text color for better contrast */
header.winner-section h1,
header.winner-section p,
header.winner-section .winner-display {
    color: var(--winner-text-color, #ffffff);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.logo {
    max-width: 120px;
    height: auto;
    position: absolute;
    left: 2rem;
}

header .header-text {
    flex: 1;
    text-align: center;
}

header h1 {
    color: #ffffff;
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    header .header-text {
        text-align: center;
    }
    
    header h1 {
        font-size: 1.4rem;
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: row;
        padding: 0.5rem 1rem;
        align-items: center;
        height: 50px;
        justify-content: flex-start;
        overflow: hidden;
    }
    
    .logo {
        margin: 0;
        max-height: 40px;
        width: auto;
        position: relative;
        left: 0;
        transition: all 0.5s ease;
    }

    header.has-winner .logo {
        transform: translateX(calc(100vw - 100% - 2rem));
    }

    header .header-text {
        display: none;
    }

    .winner-display {
        display: none;
        opacity: 0;
    }
}

h1 {
    color: #ffffff;
    margin-bottom: 1rem;
}

/* Main content */
main {
    max-width: 1600px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 300px 1fr 400px;
    gap: 2rem;
}

.ad-space {
    min-height: 600px;
    background-color: #2d2d2d;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-space-small {
    width: 350px;
    height: 350px;
    background-color: #2d2d2d;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem auto;
}

@media (max-width: 768px) {
    .ad-space-small {
        width: 100%;
        max-width: 350px;
    }
}

.container {
    display: flex;
    flex-direction: row;
    align-items: center;  /* Center vertically */
    justify-content: center;  /* Center horizontally */
    gap: 2rem;
    height: 100%;  /* Take full height of the grid cell */
}

.wheel-container {
    flex: 0 0 500px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;  /* Add space below the wheel */
    margin-top: -8rem;    /* Move wheel closer to header */
}

#wheelCanvas {
    max-width: 100%;
    height: auto;
    display: block;  /* Remove any extra space below the canvas */
    margin: 0 auto;  /* Center horizontally */
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.5));
}

.controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
}

/* Remove duplicate styles and keep only these button styles */
.control-button {
    padding: 8px 16px;
    font-size: 0.9rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #4CAF50;
    color: white;
}

#shuffleNames {
    background-color: #2196F3;
    width: fit-content;
}

/* Update media queries */
@media (max-width: 1400px) {
    main {
        grid-template-columns: 1fr 400px;
    }
    .ad-space {
        display: none;
    }
}

@media (max-width: 1024px) {
    main {
        grid-template-columns: 1fr;
    }
    .container {
        flex-direction: column;
        align-items: center;
    }
    .wheel-container {
        flex: none;
        width: 100%;
        max-width: 500px;
        margin-top: -0rem;
    }
    .controls {
        width: 100%;
        max-width: 500px;
    }
}

.wheel-pointer {
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-right: 25px solid #e0e0e0;
    border-left: none;
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.3));
    z-index: 10;
}

@media (max-width: 768px) {
    .wheel-pointer {
        right: -5px;  /* Keep the same overlap as desktop */
        border-right: 20px solid #e0e0e0;  /* Slightly smaller for mobile */
    }
}

#wheelCanvas {
    max-width: 100%;
    height: auto;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.5));
}

/* Responsive adjustments */
@media (max-width: 1400px) {
    main {
        grid-template-columns: 1fr 400px;
    }
    .ad-space {
        display: none;
    }
}

@media (max-width: 1024px) {
    main {
        grid-template-columns: 1fr;
    }
    
    .container, .inputs {
        position: static;
    }
    
    .inputs {
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
    }
}

#wheelCanvas {
    max-width: 100%;
    height: auto;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.5));
}

/* Button styles */
button {
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #4a90e2;
    color: white;
}

button:hover {
    background-color: #357abd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

#spinButton {
    font-size: 1.2rem;
    padding: 1rem 2rem;
    background-color: #2ecc71;
}

#spinButton:hover {
    background-color: #27ae60;
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

/* Input area */
.controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.control-button {
    padding: 10px 20px;
    font-size: 1rem;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.control-button:hover {
    background-color: #45a049;
}

#shuffleNames {
    background-color: #2196F3;
}

#shuffleNames:hover {
    background-color: #1976D2;
}

.inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#nameInput {
    width: 100%;
    height: 150px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 2px solid #404040;
    border-radius: 8px;
    resize: vertical;
    font-size: 1rem;
    background-color: #2d2d2d;
    color: #ffffff;
}

#nameInput::placeholder {
    color: #888888;
}

#nameInput:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    background-color: #2d2d2d;
    margin-top: 2rem;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.2);
}

/* Responsive design */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
    }
    
    #wheelCanvas {
        width: 350px;  /* Increased from 300px */
        height: 350px;  /* Increased from 300px */
        margin-right: -5px;  /* Align with the pointer */
    }

    .wheel-container {
        width: 100%;
        max-width: 350px;  /* Match canvas size */
        margin: 0 auto;
        position: relative;
    }
}

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

.close-button {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 24px;
    cursor: pointer;
    color: #888;
}

.close-button:hover {
    color: #fff;
}

.modal-content {
    position: relative;
    background-color: #2d2d2d;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    animation: modalPop 0.3s ease-out;
    min-width: 300px;
}

@keyframes modalPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal h2 {
    color: #ffffff;
    margin-bottom: 1rem;
    font-size: 2rem;
}

#winnerName {
    font-size: 2.5rem;
    color: #4a90e2;
    margin: 1rem 0;
    word-break: break-word;
}

.remove-button {
    margin-top: 1rem;
    padding: 0.8rem 1.5rem;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.remove-button:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
}

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

#shuffleNames, #sortNames {
    background-color: #2196F3;
    width: fit-content;
}

#sortNames {
    background-color: #9C27B0;
}

#sortNames:hover {
    background-color: #7B1FA2;
}

/* Add these new styles */
.blur-background {
    filter: blur(3px) hue-rotate(45deg);
    pointer-events: none;
    transition: all 0.5s ease;
    animation: colorfulBlur 3s infinite linear;
}

@keyframes colorfulBlur {
    0% { filter: blur(3px) hue-rotate(0deg); }
    50% { filter: blur(4px) hue-rotate(180deg); }
    100% { filter: blur(3px) hue-rotate(360deg); }
}

.wheel-container, .ad-space, .ad-space-small {
    filter: none !important;
    z-index: 2;
    position: relative;
    isolation: isolate;
}

.wheel-container::after {
    content: '';
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(0,0,0,0) 70%);
    z-index: -1;
    animation: glowPulse 2s infinite ease-in-out;
}

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

.winner-display {
    position: absolute;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    color: white;
    font-size: 1.2rem;
}

.winner-display::before {
    content: 'Último ganhador:';
    font-weight: normal;
    opacity: 0.9;
    margin-right: 0.5rem;
}

@media (max-width: 768px) {
    .winner-display {
        position: static;
        justify-content: center;
        text-align: center;
        width: 100%;
        margin-top: 0.5rem;
        opacity: 0;
        transform: none;
        font-size: 1rem;
    }
}

.winner-display.show {
    opacity: 1;
    transform: translateY(0);
    position: relative;
    overflow: hidden;
    padding: 0.5rem 1rem;
}

.header-confetti {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    pointer-events: none;
    animation: headerConfetti 3s linear infinite;
    z-index: -1;
}

@keyframes headerConfetti {
    0% { 
        transform: translateY(-20px) translateX(-10px) rotate(0deg) scale(1);
        opacity: 0.8;
    }
    50% {
        transform: translateY(20px) translateX(10px) rotate(180deg) scale(1.2);
        opacity: 0.6;
    }
    100% { 
        transform: translateY(60px) translateX(30px) rotate(360deg) scale(0.8);
        opacity: 0;
    }
}

/* Add shimmer effect to winner text */
.last-winner {
    position: relative;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    padding: 0 0.5rem;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.winner-display span {
    font-size: 1rem;
    font-weight: bold;
    color: white;
}

/* Add confetti styles */
.modal-confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: modalConfetti 1.5s ease-out forwards;
    pointer-events: none;
}

@keyframes modalConfetti {
    0% { transform: translateY(-50px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100px) rotate(360deg); opacity: 0; }
}

.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: confetti 1s ease-out forwards;
}

.control-button i, .remove-button i {
    margin-right: 8px;
}

button i {
    font-size: 0.9em;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.continue-button, .remove-button {
    padding: 0.8rem 1.5rem;
    min-width: 160px;
    height: 48px;
    font-size: 1rem;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
    align-items: center;
}

.continue-button {
    background-color: #2ecc71;
    color: white;
}

.continue-button:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
}

.remove-button:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
}
