/* Star Rating Base Styles */
.rating {
    margin: 20px 0;
    --star-color: #ddd;
    --star-active: #ffd700;
    --star-size: 32px;
}

.rating__stars {
    display: inline-flex;
    flex-direction: row-reverse;
    gap: 8px;
}

.rating__input {
    position: absolute;
    visibility: hidden;
}

.rating__label {
    cursor: pointer;
    color: var(--star-color);
    font-size: var(--star-size);
    position: relative;
    transition: all 0.2s ease-in-out;
}

.rating__label:before {
    content: "★";
    position: relative;
    transition: transform 0.2s ease-in-out, color 0.2s ease-in-out;
}

/* Hover Effects */
.rating__label:hover {
    transform: scale(1.2);
    color: var(--star-active);
}

.rating__label:hover:before {
    animation: star-bounce 0.3s ease-in-out;
}

.rating__label:hover ~ .rating__label {
    color: var(--star-active);
    transform: scale(1.1);
}

/* Click Effects */
.rating__input:checked + .rating__label {
    animation: star-selected 0.5s ease-in-out;
    color: var(--star-active);
}

.rating__input:checked + .rating__label:before {
    animation: star-explode 0.5s ease-in-out;
}

.rating__input:checked ~ .rating__label {
    color: var(--star-active);
}

/* Rating Display Animation */
.rating__display {
    margin-top: 15px;
    font-size: 16px;
    color: #666;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease-in-out;
}

.rating__display.show {
    opacity: 1;
    transform: translateY(0);
}

/* Animations */
@keyframes star-bounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes star-selected {
    0% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(0.9); }
    75% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes star-explode {
    0% { opacity: 1; }
    30% { opacity: 0.5; transform: scale(1.4); }
    50% { opacity: 1; transform: scale(1); }
    70% { opacity: 0.8; transform: rotate(15deg); }
    100% { opacity: 1; transform: rotate(0); }
}

/* Sparkle Effect */
.rating__label:after {
    content: '✦';
    position: absolute;
    opacity: 0;
    color: var(--star-active);
    font-size: calc(var(--star-size) * 0.4);
}

.rating__input:checked + .rating__label:after {
    animation: sparkle 0.7s ease-in-out;
}

@keyframes sparkle {
    0% { 
        opacity: 0;
        transform: translate(10px, -10px) scale(0);
    }
    50% { 
        opacity: 1;
        transform: translate(15px, -15px) scale(1);
    }
    100% { 
        opacity: 0;
        transform: translate(20px, -20px) scale(0);
    }
}