/**
 * TLS Sitejabber Plugin Styles
 * Custom styles for Sitejabber widgets on WooCommerce product pages
 */

/* Main product rating widget container */
.main-product-rating-widget {
    margin: 15px 0;
    padding: 0;
}

/* Sitejabber product rating widget */
.stjr-product-rating {
    display: inline-block;
    margin: 10px 0;
    padding: 0;
    line-height: 1.4;
}

/* Sitejabber product review page widget */
.stjr-product-review-page {
    width: 100%;
    margin: 20px 0;
    padding: 0;
    clear: both;
}

/* Rating widget wrapper for auto-placement */
.sitejabber-rating-widget {
    min-height: 40px;
}

.stjr-product-rating{
    min-height: 20px;
    margin:0 !important;
}

/* Shop/category page rating widget wrapper */
.sitejabber-shop-rating-widget {
    margin: 8px 0;
    text-align: left;
}

ul.products .sitejabber-shop-rating-widget{
    text-align: center;
}

/* Hide rating widgets with 0.0 star rating on shop/category pages */
.sitejabber-shop-rating-widget .stars[title="0.0 star rating"],
.sitejabber-shop-rating-widget .stars[aria-label="0.0 out of 5 stars"] {
    display: none !important;
}

/* Hide the entire widget when stars are hidden and there are 0 reviews */
.sitejabber-shop-rating-widget:has(.stars[title="0.0 star rating"]) {
    display: none !important;
}

/* Alternative approach - hide widgets containing only empty star icons */
.sitejabber-shop-rating-widget .stars:has(.custom-icon-star2-empty):not(:has(.custom-icon-star2-full)):not(:has(.custom-icon-star2-half-left)) {
    display: none !important;
}

/* Customer reviews section wrapper */
.sitejabber-reviews-section {
    width: 100%;
    margin: 30px 0 40px 0;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    clear: both;
}

.sitejabber-reviews-section h3 {
    margin: 0 0 20px 0;
    padding: 0;
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sitejabber-reviews-section {
        margin: 20px 0 30px 0;
        padding: 15px;
    }
    
    .sitejabber-reviews-section h3 {
        font-size: 1.3em;
        margin-bottom: 15px;
    }
    
    .stjr-product-rating {
        margin: 8px 0;
    }
}

/* Integration with common WooCommerce themes */
.woocommerce .sitejabber-reviews-section {
    box-sizing: border-box;
}

.woocommerce .stjr-product-rating {
    vertical-align: middle;
}

/* Ensure widgets don't break theme layouts */
.stjr-product-rating,
.stjr-product-review-page {
    max-width: 100%;
    box-sizing: border-box;
}

/* Loading state placeholder */
.summary .stjr-product-rating:empty::before {
    content: "Loading reviews...";
    color: #999;
    font-style: italic;
    font-size: .5em;
    line-height: 1em;
    display: inline-block;
}

.stjr-product-review-page:empty::before {
    content: "Loading reviews...";
    color: #999;
    font-style: italic;
}

/* Accessibility improvements */
.sitejabber-reviews-section h3 {
    outline: none;
}

.sitejabber-reviews-section:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .sitejabber-reviews-section {
        background: white;
        border: 1px solid #ccc;
    }
}