/**
 * Stunning Product Reviews Styling
 * 
 * Premium, modern redesign for WooCommerce product reviews.
 * Scoped to body.single-product only.
 * 
 * Features:
 * - Modern card-based layout
 * - Premium review summary header
 * - Stunning review cards
 * - Clean review form
 * - No AJAX dependencies
 * 
 * @package RinnoTools
 */

/* ============================================
   CSS Variables (Reviews Specific)
   ============================================ */
body.single-product {
    --reviews-card-radius: 12px;
    --reviews-card-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --reviews-card-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.1);
    --reviews-border: 1px solid rgba(0, 0, 0, 0.08);
    --reviews-spacing: 24px;
    --reviews-spacing-sm: 16px;
    --reviews-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Reviews View Container
   ============================================ */
body.single-product .reviews-view {
    background: #ffffff;
    border-radius: var(--reviews-card-radius);
    box-shadow: var(--reviews-card-shadow);
    border: none;
    padding: 32px;
    margin-top: 0;
}

body.single-product .reviews-view__list {
    margin: 0;
}

body.single-product .reviews-view__header {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text, #222222);
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.08);
}

/* ============================================
   WooCommerce Reviews Container
   ============================================ */
body.single-product #reviews.woocommerce-Reviews {
    margin-top: 0;
}

body.single-product #comments {
    margin-bottom: 40px;
}

body.single-product #comments h2.woocommerce-Reviews-title {
    display: none; /* Hide default WooCommerce title, we have our own */
}

/* ============================================
   Review Summary Header (Stunning)
   ============================================ */
body.single-product .reviews-summary {
    background: linear-gradient(135deg, rgba(170, 28, 28, 0.05) 0%, rgba(170, 28, 28, 0.02) 100%);
    border-radius: var(--reviews-card-radius);
    padding: 32px;
    margin-bottom: 40px;
    border: var(--reviews-border);
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    align-items: center;
}

body.single-product .reviews-summary__average {
    flex: 0 0 auto;
    text-align: center;
    min-width: 140px;
}

body.single-product .reviews-summary__average-number {
    font-size: 56px;
    font-weight: 700;
    color: var(--color-primary, #aa1c1c);
    line-height: 1;
    margin-bottom: 8px;
}

body.single-product .reviews-summary__average-stars {
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
    gap: 2px;
}

body.single-product .reviews-summary__average-text {
    font-size: 14px;
    color: var(--color-muted, #777777);
    font-weight: 500;
}

body.single-product .reviews-summary__breakdown {
    flex: 1;
    min-width: 280px;
}

body.single-product .reviews-summary__breakdown-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

body.single-product .reviews-summary__breakdown-label {
    font-size: 13px;
    color: var(--color-text, #222222);
    min-width: 60px;
    font-weight: 500;
}

body.single-product .reviews-summary__breakdown-bar {
    flex: 1;
    height: 8px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

body.single-product .reviews-summary__breakdown-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary, #aa1c1c) 0%, var(--color-primary-dark, #8e0000) 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
}

body.single-product .reviews-summary__breakdown-count {
    font-size: 13px;
    color: var(--color-muted, #777777);
    min-width: 40px;
    text-align: right;
}

body.single-product .reviews-summary__actions {
    flex: 0 0 auto;
    text-align: center;
}

body.single-product .reviews-summary__button {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--color-primary, #aa1c1c) 0%, var(--color-primary-dark, #8e0000) 100%);
    color: #ffffff;
    border: none;
    text-decoration: none;
    display: inline-block;
    transition: var(--reviews-transition);
    box-shadow: 0 2px 8px rgba(170, 28, 28, 0.2);
}

body.single-product .reviews-summary__button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(170, 28, 28, 0.3);
    color: #ffffff;
    text-decoration: none;
}

/* ============================================
   Review List / Comments
   ============================================ */
body.single-product .commentlist,
body.single-product ol.commentlist {
    list-style: none;
    padding: 0;
    margin: 0;
}

body.single-product .commentlist li,
body.single-product .commentlist > li {
    margin-bottom: 24px;
    padding: 0;
    list-style: none;
}

body.single-product .commentlist li:last-child {
    margin-bottom: 0;
}

/* Review Item Card */
body.single-product .comment_container {
    background: #ffffff;
    border: var(--reviews-border);
    border-radius: var(--reviews-card-radius);
    padding: 24px;
    transition: var(--reviews-transition);
    position: relative;
}

body.single-product .comment_container:hover {
    box-shadow: var(--reviews-card-shadow);
    border-color: rgba(170, 28, 28, 0.2);
}

body.single-product .comment_text {
    position: relative;
}

/* Review Meta (Author, Date, Rating) */
body.single-product .comment_container .meta {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

body.single-product .woocommerce-review__author,
body.single-product .comment-author,
body.single-product .comment_container .meta strong {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text, #222222);
    display: inline;
    margin: 0;
}

body.single-product .woocommerce-review__published-date,
body.single-product .comment-meta,
body.single-product .comment_container .meta time {
    font-size: 13px;
    color: var(--color-muted, #777777);
    display: inline;
    margin: 0;
}

body.single-product .woocommerce-review__dash {
    color: var(--color-muted, #777777);
    margin: 0 4px;
}

body.single-product .woocommerce-review__published-date a,
body.single-product .comment-meta a {
    color: var(--color-muted, #777777);
    text-decoration: none;
}

body.single-product .woocommerce-review__published-date a:hover,
body.single-product .comment-meta a:hover {
    color: var(--color-primary, #aa1c1c);
    text-decoration: underline;
}

/* Rating Stars in Review */
body.single-product .comment_container .star-rating {
    float: none;
    margin: 0 0 12px 0;
    display: inline-block;
    font-size: 14px;
    line-height: 1;
}

body.single-product .comment_container .star-rating::before {
    color: rgba(0, 0, 0, 0.15);
}

body.single-product .comment_container .star-rating span {
    color: #ffb400;
}

/* Avatar */
body.single-product .comment_container img.avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    float: left;
    margin-right: 16px;
    margin-top: 0;
    border: 3px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: var(--reviews-transition);
}

body.single-product .comment_container:hover img.avatar {
    border-color: var(--color-primary, #aa1c1c);
    box-shadow: 0 4px 12px rgba(170, 28, 28, 0.2);
}

/* Review Text */
body.single-product .woocommerce-review__description,
body.single-product .comment_container .description {
    font-size: 15px;
    line-height: 1.7;
    color: var(--color-text, #222222);
    margin-top: 12px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

body.single-product .comment_container .description p {
    margin-bottom: 12px;
}

body.single-product .comment_container .description p:last-child {
    margin-bottom: 0;
}

/* Verified Owner Badge */
body.single-product .woocommerce-review__verified,
body.single-product .comment_container .verified {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(122, 208, 58, 0.1);
    color: #5a9e28;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
    border: 1px solid rgba(122, 208, 58, 0.2);
    font-style: normal;
}

body.single-product .woocommerce-review__verified::before {
    content: '✓ ';
    margin-right: 2px;
}

/* ============================================
   Empty State (No Reviews)
   ============================================ */
body.single-product .woocommerce-noreviews {
    text-align: center;
    padding: 60px 32px;
    color: var(--color-muted, #777777);
    font-size: 16px;
    margin: 0;
}

body.single-product .reviews-empty {
    text-align: center;
    padding: 60px 32px;
}

body.single-product .reviews-empty__icon {
    font-size: 64px;
    color: rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

body.single-product .reviews-empty__title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text, #222222);
    margin-bottom: 12px;
}

body.single-product .reviews-empty__text {
    font-size: 15px;
    color: var(--color-muted, #777777);
    margin-bottom: 24px;
    line-height: 1.6;
}

body.single-product .reviews-empty__button {
    padding: 12px 32px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--color-primary, #aa1c1c) 0%, var(--color-primary-dark, #8e0000) 100%);
    color: #ffffff;
    border: none;
    text-decoration: none;
    display: inline-block;
    transition: var(--reviews-transition);
    box-shadow: 0 2px 8px rgba(170, 28, 28, 0.2);
}

body.single-product .reviews-empty__button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(170, 28, 28, 0.3);
    color: #ffffff;
    text-decoration: none;
}

/* ============================================
   Pagination
   ============================================ */
body.single-product .woocommerce-pagination {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

body.single-product .woocommerce-pagination ul.page-numbers {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

body.single-product .woocommerce-pagination ul.page-numbers li {
    margin: 0;
    padding: 0;
    list-style: none;
}

body.single-product .woocommerce-pagination ul.page-numbers a,
body.single-product .woocommerce-pagination ul.page-numbers span {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #ffffff;
    color: var(--color-text, #222222);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--reviews-transition);
    min-width: 38px;
    text-align: center;
}

body.single-product .woocommerce-pagination ul.page-numbers a:hover {
    background: var(--color-primary, #aa1c1c);
    border-color: var(--color-primary, #aa1c1c);
    color: #ffffff;
}

body.single-product .woocommerce-pagination ul.page-numbers span.current {
    background: var(--color-primary, #aa1c1c);
    border-color: var(--color-primary, #aa1c1c);
    color: #ffffff;
}

body.single-product .woocommerce-pagination ul.page-numbers span.dots {
    border: none;
    background: transparent;
    color: var(--color-muted, #777777);
}

/* ============================================
   Review Form (Stunning)
   ============================================ */
body.single-product #review_form_wrapper {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px solid rgba(0, 0, 0, 0.08);
}

body.single-product #review_form {
    background: #ffffff;
    border: var(--reviews-border);
    border-radius: var(--reviews-card-radius);
    padding: 32px;
}

body.single-product #review_form h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text, #222222);
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.single-product #review_form p.comment-form-author,
body.single-product #review_form p.comment-form-email,
body.single-product #review_form p.comment-form-rating,
body.single-product #review_form p.comment-form-comment {
    margin-bottom: 20px;
}

body.single-product #review_form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text, #222222);
    margin-bottom: 8px;
}

body.single-product #review_form label .required {
    color: #ff2626;
    margin-left: 4px;
}

body.single-product #review_form input[type="text"],
body.single-product #review_form input[type="email"],
body.single-product #review_form input[type="url"],
body.single-product #review_form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    color: var(--color-text, #222222);
    background: #ffffff;
    transition: var(--reviews-transition);
    box-sizing: border-box;
}

body.single-product #review_form input[type="text"]:focus,
body.single-product #review_form input[type="email"]:focus,
body.single-product #review_form input[type="url"]:focus,
body.single-product #review_form textarea:focus {
    outline: none;
    border-color: var(--color-primary, #aa1c1c);
    box-shadow: 0 0 0 3px rgba(170, 28, 28, 0.1);
}

body.single-product #review_form textarea {
    min-height: 120px;
    resize: vertical;
}

/* Rating Input (Stars) */
body.single-product .comment-form-rating {
    position: relative;
}

/* Default WooCommerce stars - hide when stars-rating exists */
body.single-product .comment-form-rating:has(.stars-rating) p.stars,
body.single-product .comment-form-rating p.stars.stars-hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    z-index: -1 !important;
    width: 0 !important;
}

/* Fallback: show default p.stars only if stars-rating doesn't exist (no JS fallback) */
body.single-product .comment-form-rating:not(:has(.stars-rating)) p.stars:not(.stars-hidden) {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    margin: 8px 0 !important;
    padding: 0 !important;
    position: static !important;
    left: auto !important;
    z-index: auto !important;
    width: auto !important;
}

body.single-product .comment-form-rating p.stars a {
    display: inline-block;
    position: relative;
    height: 1em;
    width: 1em;
    text-indent: -9999px;
    text-decoration: none;
    margin-right: 4px;
}

body.single-product .comment-form-rating p.stars a::before {
    content: '\2605';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 1em;
    height: 1em;
    line-height: 1em;
    text-indent: 0;
    font-size: 18px;
    color: #d0d0d0;
    transition: var(--reviews-transition);
}

body.single-product .comment-form-rating p.stars:hover a::before,
body.single-product .comment-form-rating p.stars a:hover ~ a::before {
    color: #d0d0d0 !important;
}

body.single-product .comment-form-rating p.stars.selected a.active::before,
body.single-product .comment-form-rating p.stars a.active::before,
body.single-product .comment-form-rating p.stars.selected a.active ~ a::before,
body.single-product .comment-form-rating p.stars a.active ~ a::before {
    color: #ffb400;
}

body.single-product .comment-form-rating .stars-rating {
    display: flex;
    gap: 4px;
    margin-top: 12px;
    margin-bottom: 8px;
}

/* Hide select when stars-rating exists */
body.single-product .comment-form-rating:has(.stars-rating) select#rating {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    pointer-events: none;
    z-index: -1;
}

body.single-product .stars-rating__item {
    font-size: 24px;
    color: #d0d0d0;
    cursor: pointer;
    transition: var(--reviews-transition);
    user-select: none;
    line-height: 1;
}

body.single-product .stars-rating__item:hover,
body.single-product .stars-rating__item.hover {
    color: #ffb400;
    transform: scale(1.1);
}

body.single-product .stars-rating__item.active {
    color: #ffb400;
}

/* Submit Button */
body.single-product #review_form .form-submit {
    margin-top: 24px;
    margin-bottom: 0;
}

body.single-product #review_form input[type="submit"],
body.single-product #review_form button[type="submit"],
body.single-product #review_form #submit {
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--color-primary, #aa1c1c) 0%, var(--color-primary-dark, #8e0000) 100%);
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: var(--reviews-transition);
    box-shadow: 0 2px 8px rgba(170, 28, 28, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.single-product #review_form input[type="submit"]:hover,
body.single-product #review_form button[type="submit"]:hover,
body.single-product #review_form #submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(170, 28, 28, 0.3);
}

body.single-product #review_form input[type="submit"]:active,
body.single-product #review_form button[type="submit"]:active,
body.single-product #review_form #submit:active {
    transform: translateY(0);
}

body.single-product #review_form input[type="submit"]:disabled,
body.single-product #review_form button[type="submit"]:disabled,
body.single-product #review_form #submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Form Notices / Errors */
body.single-product .woocommerce-error,
body.single-product .woocommerce-info,
body.single-product .woocommerce-message {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    border-left: 4px solid;
    font-size: 14px;
}

body.single-product .woocommerce-error {
    background: rgba(255, 38, 38, 0.1);
    border-color: #ff2626;
    color: #cc1f1f;
}

body.single-product .woocommerce-info {
    background: rgba(42, 162, 204, 0.1);
    border-color: #2aa2cc;
    color: #1a7a9a;
}

body.single-product .woocommerce-message {
    background: rgba(122, 208, 58, 0.1);
    border-color: #7ad03a;
    color: #5a9e28;
}

/* Must log in message */
body.single-product #review_form .must-log-in {
    padding: 16px 20px;
    border-radius: 8px;
    background: rgba(42, 162, 204, 0.1);
    border-left: 4px solid #2aa2cc;
    color: #1a7a9a;
    font-size: 14px;
    margin-bottom: 24px;
}

body.single-product #review_form .must-log-in a {
    color: #1a7a9a;
    font-weight: 600;
    text-decoration: underline;
}

body.single-product #review_form .must-log-in a:hover {
    color: #155f7a;
}

/* Verification required message */
body.single-product .woocommerce-verification-required {
    padding: 20px 24px;
    border-radius: 8px;
    background: rgba(42, 162, 204, 0.1);
    border-left: 4px solid #2aa2cc;
    color: #1a7a9a;
    font-size: 15px;
    margin-top: 24px;
    text-align: center;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 767px) {
    body.single-product .reviews-view {
        padding: 20px;
    }
    
    body.single-product .reviews-summary {
        flex-direction: column;
        text-align: center;
        gap: 24px;
        padding: 24px;
    }
    
    body.single-product .reviews-summary__breakdown {
        width: 100%;
    }
    
    body.single-product .reviews-summary__average-number {
        font-size: 48px;
    }
    
    body.single-product .comment_container {
        padding: 20px;
    }
    
    body.single-product .comment_container img.avatar {
        width: 40px;
        height: 40px;
        margin-right: 12px;
    }
    
    body.single-product #review_form {
        padding: 24px;
    }
}

/* ============================================
   Smooth Scroll for Anchor Links
   ============================================ */
html {
    scroll-behavior: smooth;
}

/* ============================================
   Micro-animations (CSS only)
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.single-product .comment_container {
    animation: fadeIn 0.3s ease-out;
}

body.single-product .comment_container:nth-child(1) { animation-delay: 0.05s; }
body.single-product .comment_container:nth-child(2) { animation-delay: 0.1s; }
body.single-product .comment_container:nth-child(3) { animation-delay: 0.15s; }
body.single-product .comment_container:nth-child(4) { animation-delay: 0.2s; }
body.single-product .comment_container:nth-child(5) { animation-delay: 0.25s; }
