/**
 * Modernized styles for WooCommerce review star ratings
 * Enhances the product reviews section with improved styling and animations
 */

/* Star Rating Base Styles */
.woocommerce .star-rating,
.woocommerce-page .star-rating {
    overflow: hidden;
    position: relative;
    height: 1.618em;
    line-height: 1.618;
    font-size: 1.1em;
    width: 5.3em;
    font-family: 'star';
    margin: 0 auto 0.5em;
    color: #f8bb00; /* Golden color for stars */
    transition: all 0.3s ease-in-out;
}

/* Add subtle hover effects to star ratings */
.woocommerce .star-rating:hover,
.woocommerce-page .star-rating:hover {
    transform: scale(1.05);
}

/* Style star ratings in product lists */
.woocommerce ul.products li.product .star-rating {
    display: block;
    margin: 0.5em auto;
    font-size: 0.9em;
}

/* Style for product comment form rating stars */
p.stars {
    position: relative;
    font-size: 1.618em;
    margin-bottom: 1em;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

p.stars a {
    position: relative;
    height: 1em;
    width: 1em;
    text-indent: -999em;
    display: inline-block;
    text-decoration: none;
    color: #ddd; /* Default color */
    font-weight: 400;
    margin-right: 0.3em;
    transition: all 0.3s ease;
    cursor: pointer;
}

p.stars a::before {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 1em;
    height: 1em;
    line-height: 1;
    font-family: "FontAwesome";
    content: "\f006"; /* Empty star - FontAwesome */
    text-indent: 0;
    transition: all 0.3s ease;
}

p.stars a:hover ~ a::before {
    content: "\f006"; /* Empty star - FontAwesome */
}

p.stars:hover a::before {
    content: "\f005"; /* Filled star - FontAwesome */
    color: #f8bb00; /* Golden color for stars */
}

p.stars.selected a.active::before {
    content: "\f005"; /* Filled star - FontAwesome */
    color: #f8bb00; /* Golden color for stars */
}

p.stars.selected a.active ~ a::before {
    content: "\f006"; /* Empty star - FontAwesome */
    color: #ddd;
}

p.stars.selected a:not(.active)::before {
    content: "\f005"; /* Filled star - FontAwesome */
    color: #f8bb00; /* Golden color for stars */
}

/* Animated hover effect */
p.stars a:hover {
    transform: scale(1.2);
}

/* Add a nice glow effect on hover */
p.stars:hover a::before {
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.7);
}

/* Style for the "Your Rating" section */
.comment-form-rating {
    margin: 1.5em 0;
    padding: 1em;
    background-color: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #eee;
    position: relative;
}

.comment-form-rating label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: #333;
}

/* Custom tooltip for rating stars */
.star-rating-tooltip {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    white-space: nowrap;
    z-index: 100;
}

.star-rating-tooltip:after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px 5px 0;
    border-style: solid;
    border-color: #333 transparent transparent;
}

p.stars:hover .star-rating-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Hide the default select for ratings */
.comment-form-rating select {
    display: none;
}

/* Modern styling for "X of 5 stars" text in reviews */
.woocommerce .woocommerce-product-rating .star-rating {
    margin: 0.5em 4px 0 0;
    float: left;
}

.woocommerce .woocommerce-product-rating {
    display: flex;
    align-items: center;
    margin-bottom: 1.5em;
    background: linear-gradient(to right, rgba(248, 187, 0, 0.1), transparent);
    padding: 8px 15px;
    border-radius: 20px;
    max-width: fit-content;
    transition: all 0.3s ease;
}

.woocommerce .woocommerce-product-rating:hover {
    background: linear-gradient(to right, rgba(248, 187, 0, 0.2), transparent);
    transform: translateX(5px);
}

.woocommerce-review-link {
    font-size: 0.9em;
    color: #777;
    text-decoration: none;
    transition: color 0.3s ease;
    margin-left: 5px;
    position: relative;
}

.woocommerce-review-link:hover {
    color: #333;
    text-decoration: underline;
}

/* Style improvements for review list */
.woocommerce #reviews #comments ol.commentlist {
    padding-left: 0;
}

.woocommerce #reviews #comments ol.commentlist li .comment-text {
    border-radius: 5px;
    border: 1px solid #e4e1e3;
    padding: 1em 1em 0;
    margin: 0 0 0 50px;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: relative;
}

.woocommerce #reviews #comments ol.commentlist li .comment-text:before {
    content: '';
    position: absolute;
    left: -8px;
    top: 15px;
    width: 15px;
    height: 15px;
    background: #fff;
    border-left: 1px solid #e4e1e3;
    border-bottom: 1px solid #e4e1e3;
    transform: rotate(45deg);
}

.woocommerce #reviews #comments ol.commentlist li img.avatar {
    border-radius: 50%;
    border: 3px solid #f8bb00;
    padding: 0;
    width: 60px;
    height: auto;
    background: transparent;
    transition: all 0.3s ease;
}

.woocommerce #reviews #comments ol.commentlist li:hover img.avatar {
    transform: scale(1.05) rotate(5deg);
}

/* Add a bit of animation to the reviews section */
.woocommerce #reviews #comments ol.commentlist li {
    transition: transform 0.3s ease;
    margin-bottom: 1.5em;
}

.woocommerce #reviews #comments ol.commentlist li:hover {
    transform: translateX(5px);
}

/* Styling for review form submit button */
.woocommerce #respond input#submit {
    background-color: #f8bb00;
    color: #fff;
    border-radius: 30px;
    padding: 0.5em 2em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.woocommerce #respond input#submit:hover {
    background-color: #e5ac00;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Make review form more modern */
#review_form #respond textarea {
    border-radius: 5px;
    border: 1px solid #ddd;
    padding: 10px;
    transition: border-color 0.3s ease;
}

#review_form #respond textarea:focus {
    border-color: #f8bb00;
    outline: none;
    box-shadow: 0 0 0 2px rgba(248, 187, 0, 0.2);
}

/* Improve overall review tab appearance */
.woocommerce-Tabs-panel--reviews {
    padding: 20px !important;
    background-color: #fcfcfc;
    border-radius: 5px;
    margin-bottom: 2em;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.woocommerce-Tabs-panel--reviews:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

/* Animation for reviews panel when clicking on "Reviews" tab */
.woocommerce-Tabs-panel--reviews.animate-reviews {
    animation: reviews-panel-entrance 0.6s ease-out forwards;
}

@keyframes reviews-panel-entrance {
    0% {
        opacity: 0.5;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.woocommerce-Reviews-title {
    font-size: 1.5em;
    margin-bottom: 1em;
    color: #333;
    border-bottom: 2px solid #f8bb00;
    padding-bottom: 0.5em;
    display: inline-block;
}

/* Better styling for the "Be the first to review" message */
.woocommerce-noreviews {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #f8bb00;
    margin-bottom: 1.5em;
}

/* Add emoji-like stars for a bit of fun */
@media (min-width: 769px) {
    .stars a:hover::before {
        animation: star-pulse 0.5s ease-in-out;
    }
    
    @keyframes star-pulse {
        0% { transform: scale(1); }
        50% { transform: scale(1.3); }
        100% { transform: scale(1); }
    }
    
    /* Add special effects for custom JavaScript interactions */
    .stars a.hover::before {
        color: #ffcd3c;
        text-shadow: 0 0 8px rgba(255, 205, 60, 0.6);
    }
    
    .stars a.selected-animation::before {
        animation: star-selected 0.7s ease-in-out;
    }
    
    @keyframes star-selected {
        0% { transform: scale(1); color: #f8bb00; }
        25% { transform: scale(1.4); color: #ffcd3c; }
        50% { transform: scale(0.9); color: #f8bb00; }
        75% { transform: scale(1.2); color: #ffcd3c; }
        100% { transform: scale(1); color: #f8bb00; }
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    p.stars a {
        margin-right: 0.3em;
        font-size: 1.2em; /* Larger touch targets on mobile */
    }
    
    .comment-form-rating {
        padding: 0.8em;
    }
    
    .woocommerce #reviews #comments ol.commentlist li .comment-text {
        margin-left: 40px;
    }
    
    /* Adjust product rating display on mobile */
    .woocommerce .woocommerce-product-rating {
        flex-wrap: wrap;
        padding: 5px 10px;
    }
    
    /* Improve tap targets for mobile */
    p.stars a {
        padding: 5px;
    }
}

/* Add an entrance animation for the stars when the review form appears */
@keyframes star-entrance {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

p.stars a {
    animation: star-entrance 0.4s ease-out forwards;
    animation-delay: calc(0.1s * var(--star-index, 0));
}

p.stars a:nth-child(1) { --star-index: 1; }
p.stars a:nth-child(2) { --star-index: 2; }
p.stars a:nth-child(3) { --star-index: 3; }
p.stars a:nth-child(4) { --star-index: 4; }
p.stars a:nth-child(5) { --star-index: 5; }
