/* Estilos para la ruleta de selección de temas */

/* Contenedor de la ruleta */
.wheel-container {
    position: relative;
    width: 400px;
    height: 400px;
    margin: 2rem auto;
    perspective: 1000px; /* Añade perspectiva para efecto 3D */
    transform-style: preserve-3d;
}

/* Ruleta */
.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 0 0 10px var(--primary-dark),
        0 0 20px rgba(0, 0, 0, 0.3),
        0 0 60px rgba(255, 255, 255, 0.4);
    transition: transform 5s cubic-bezier(0.17, 0.67, 0.12, 0.99);
    transform: rotate(0deg);
    transform-style: preserve-3d;
    animation: float 6s ease-in-out infinite;
    backface-visibility: hidden;
}

/* Efecto de flotación para la ruleta */
@keyframes float {
    0% {
        transform: translateY(0) rotate(0deg) rotateX(0deg);
    }
    50% {
        transform: translateY(-15px) rotate(1deg) rotateX(2deg);
    }
    100% {
        transform: translateY(0) rotate(0deg) rotateX(0deg);
    }
}

/* Efecto de brillo en la ruleta */
.wheel::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.8) 0%, transparent 30%);
    opacity: 0.3;
    animation: rotate-light 10s linear infinite;
    pointer-events: none;
    z-index: 2;
}

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

/* Secciones de la ruleta */
.wheel-section {
    position: absolute;
    width: 50%;
    height: 50%;
    transform-origin: bottom right;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--light-text);
    font-weight: 700;
    font-size: 1.2rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    padding-left: 30px;
    box-sizing: border-box;
    overflow: hidden;
    transform: rotate(0deg) skew(30deg);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.2);
}

/* Efecto hover en las secciones */
.wheel-section:hover {
    filter: brightness(1.2);
    box-shadow: inset 0 0 25px rgba(255, 255, 255, 0.3);
}

/* Colores para cada sección */
.wheel-section.naturaleza {
    background: var(--nature-green);
    transform: rotate(0deg) skew(30deg);
}

.wheel-section.matematicas {
    background: var(--primary-color);
    transform: rotate(60deg) skew(30deg);
}

.wheel-section.geografia {
    background: var(--earth-brown);
    transform: rotate(120deg) skew(30deg);
}

.wheel-section.ingles {
    background: var(--water-blue);
    transform: rotate(180deg) skew(30deg);
}

.wheel-section.historia {
    background: var(--secondary-color);
    transform: rotate(240deg) skew(30deg);
}

.wheel-section.arte {
    background: var(--accent-color);
    transform: rotate(300deg) skew(30deg);
}

/* Puntero de la ruleta */
.wheel-pointer {
    position: absolute;
    top: 0;
    left: 50%;
    width: 30px;
    height: 50px;
    background-color: var(--sunset-red);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    transform: translateX(-50%);
    z-index: 10;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.5));
    animation: pointer-bounce 1s ease-in-out infinite;
}

/* Efecto de rebote para el puntero */
@keyframes pointer-bounce {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(-5px);
    }
}

/* Brillo en el puntero */
.wheel-pointer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0%, transparent 50%);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

/* Círculo central */
.wheel::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, var(--light-text) 0%, #e0e0e0 70%, #c0c0c0 100%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 
        0 0 10px rgba(0, 0, 0, 0.3),
        inset 0 0 15px rgba(0, 0, 0, 0.1),
        inset 0 0 5px rgba(255, 255, 255, 0.5);
    z-index: 5;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

/* Logo en el centro de la ruleta */
.wheel-center-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    background-image: url('https://www.franciscanesvilassardemar.org/wp-content/uploads/2019/02/logo-vilassardemar.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    transform: translate(-50%, -50%);
    z-index: 6;
    border-radius: 50%;
    animation: spin-reverse 10s linear infinite;
}

@keyframes spin-reverse {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(-360deg);
    }
}

/* Animación de giro */
.wheel.spinning {
    animation: spin-wheel 5s cubic-bezier(0.17, 0.67, 0.12, 0.99) forwards;
    box-shadow: 
        0 0 0 10px var(--primary-dark),
        0 0 30px rgba(0, 0, 0, 0.5),
        0 0 80px rgba(255, 255, 255, 0.6);
}

@keyframes spin-wheel {
    0% { 
        transform: rotate(0deg) rotateX(0deg); 
    }
    10% { 
        transform: rotate(var(--spin-deg, 1800deg) * 0.2) rotateX(5deg); 
    }
    20% { 
        transform: rotate(var(--spin-deg, 1800deg) * 0.4) rotateX(2deg); 
    }
    40% { 
        transform: rotate(var(--spin-deg, 1800deg) * 0.6) rotateX(3deg); 
    }
    70% { 
        transform: rotate(var(--spin-deg, 1800deg) * 0.8) rotateX(1deg); 
    }
    90% { 
        transform: rotate(var(--spin-deg, 1800deg) * 0.95) rotateX(2deg); 
    }
    100% { 
        transform: rotate(var(--spin-deg, 1800deg)) rotateX(0deg); 
    }
}

/* Efecto de desenfoque durante el giro */
.wheel.spinning .wheel-section {
    animation: blur-sections 5s ease-in-out;
}

@keyframes blur-sections {
    0% { filter: blur(0); }
    20% { filter: blur(2px); }
    80% { filter: blur(3px); }
    100% { filter: blur(0); }
}

/* Botón para girar la ruleta */
#spin-button {
    margin-top: 2rem;
    font-size: 1.3rem;
    padding: 1rem 2rem;
    background: linear-gradient(to right, var(--secondary-color), var(--secondary-dark));
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    transform-style: preserve-3d;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2), 0 0 15px rgba(255, 255, 255, 0.1);
}

#spin-button:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 255, 255, 0.2);
}

#spin-button:active {
    transform: translateY(2px) scale(0.98);
}

/* Efecto de brillo en el botón */
#spin-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.8) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    transform: rotate(30deg);
    pointer-events: none;
}

#spin-button:hover::before {
    opacity: 0.2;
    animation: shine 1.5s ease-in-out infinite;
}

@keyframes shine {
    0% {
        opacity: 0.1;
        transform: rotate(30deg) translateX(-100%);
    }
    30% {
        opacity: 0.3;
    }
    100% {
        opacity: 0.1;
        transform: rotate(30deg) translateX(100%);
    }
}

/* Botón de categoría aleatoria */
.random-category {
    margin: 1.5rem 0;
}

.btn-accent {
    background: linear-gradient(to right, var(--accent-color), var(--accent-dark));
    color: var(--light-text);
    border: 2px solid transparent;
}

.btn-accent:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 
        0 10px 20px rgba(0, 0, 0, 0.1),
        0 0 15px rgba(140, 198, 63, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Animación de celebración cuando se selecciona una categoría */
.wheel-celebration {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    perspective: 1000px;
}

.wheel-celebration.active {
    opacity: 1;
    animation: celebration 2s ease-out forwards;
}

@keyframes celebration {
    0% {
        background: radial-gradient(circle at center, rgba(255, 255, 255, 0.8) 0%, transparent 0%);
        opacity: 0.8;
    }
    50% {
        background: radial-gradient(circle at center, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
        opacity: 0.6;
    }
    100% {
        background: radial-gradient(circle at center, rgba(255, 255, 255, 0) 0%, transparent 100%);
        opacity: 0;
    }
}

/* Estrellas para la celebración */
.star {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: transparent;
    opacity: 0;
    transform-style: preserve-3d;
}

.star::before {
    content: '★';
    position: absolute;
    font-size: 20px;
    color: gold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.star.active {
    opacity: 1;
    animation: star-fall 3s ease-in-out forwards;
}

@keyframes star-fall {
    0% {
        transform: translateY(-100px) rotate(0deg) rotateX(0deg) rotateY(0deg) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
        transform: translateY(-80px) rotate(45deg) rotateX(45deg) rotateY(45deg) scale(1.2);
    }
    80% {
        opacity: 1;
        transform: translateY(300px) rotate(360deg) rotateX(360deg) rotateY(360deg) scale(0.8);
    }
    100% {
        transform: translateY(500px) rotate(720deg) rotateX(720deg) rotateY(720deg) scale(0);
        opacity: 0;
    }
}

/* Confeti para la celebración */
.confetti {
    position: absolute;
    width: 15px;
    height: 15px;
    opacity: 0;
    transform-style: preserve-3d;
}

.confetti.active {
    opacity: 1;
    animation: confetti-fall 3s ease-in-out forwards;
}

/* Formas variadas para el confeti */
.confetti.square {
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
}

.confetti.circle {
    border-radius: 50%;
}

.confetti.triangle {
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.confetti.zigzag {
    clip-path: polygon(0% 0%, 100% 0%, 50% 33%, 100% 66%, 0% 66%, 50% 33%);
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100px) rotate(0deg) rotateX(0deg) rotateY(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    25% {
        transform: translateY(0) rotate(90deg) rotateX(90deg) rotateY(45deg);
    }
    50% {
        transform: translateY(200px) rotate(180deg) rotateX(180deg) rotateY(90deg);
    }
    75% {
        transform: translateY(350px) rotate(270deg) rotateX(270deg) rotateY(135deg);
        opacity: 1;
    }
    100% {
        transform: translateY(500px) rotate(360deg) rotateX(360deg) rotateY(180deg);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .wheel-container {
        width: 300px;
        height: 300px;
    }
    
    .wheel-section {
        font-size: 1rem;
        padding-left: 20px;
    }
}

@media (max-width: 480px) {
    .wheel-container {
        width: 250px;
        height: 250px;
    }
    
    .wheel-section {
        font-size: 0.8rem;
        padding-left: 15px;
    }
}
