/* EcoSupp Product Reviews Widget Styles - REFACTORED */
/* File: assets/css/product-reviews.css */

.ecosupp-reviews-container {
    width: 100%;
    position: relative;
    direction: rtl;
    text-align: right;
}

/* Reviews List Styles */
.reviews-wrapper {
    margin-bottom: 30px;
}

.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Review Item Styles */
.review-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.3s ease;
}

.review-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Review Header */
.review-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
    flex-direction: row-reverse;
}

.review-avatar {
    flex-shrink: 0;
}

.review-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #f0f0f0;
}

.review-meta {
    flex: 1;
    min-width: 0;
    text-align: right;
}

.review-author-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.review-author {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.review-date-separator {
    color: #999;
    font-weight: 400;
}

.review-date {
    font-size: 13px;
    color: #666;
    font-weight: 400;
}

/* Verified Badge */
.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #e8f5e8;
    color: #28a745;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.verified-badge i {
    font-size: 14px;
}

/* Star Rating */
.review-rating {
    margin-bottom: 6px;
    text-align: right;
}

.star-rating {
    display: inline-flex !important;
    gap: 2px;
    font-size: 18px;
    line-height: 1;
    direction: ltr;
    font-family: Arial, sans-serif; /* Ensure Unicode stars render correctly */
}

.star-rating .star {
    display: inline-block;
}

.star-rating .filled-star {
    color: #ffb400 !important;
}

.star-rating .empty-star {
    color: #e0e0e0 !important;
}

/* Support for both icon-based (i) and Unicode-based (span) stars */
.star-rating i {
    display: inline-block;
}

/* Hide WooCommerce default stars if present */
.review-rating .woocommerce-product-rating {
    display: none !important;
}

/* Review Content */
.review-content {
    line-height: 1.6;
    color: #555;
    font-size: 14px;
    text-align: right;
}

.review-content p {
    margin: 0 0 12px 0;
}

.review-content p:last-child {
    margin-bottom: 0;
}

/* No Reviews Message */
.no-reviews-message {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    color: #666;
    font-size: 16px;
}

/* Review Form Section */
.review-form-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
    text-align: center;
}

/* Add Review Button */
.add-review-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #c7d957;
    color: #fff;
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(199, 217, 87, 0.3);
    font-family: inherit;
    outline: none;
}

.add-review-btn:hover {
    background: #b5c44b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(199, 217, 87, 0.4);
    color: #fff;
    text-decoration: none;
}

.add-review-btn i {
    font-size: 18px;
}

/* Review Form Wrapper */
.review-form-wrapper {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0;
    margin-top: 20px;
    overflow: hidden;
    display: none;
}

.review-form-inner {
    padding: 30px;
}

.review-form-inner h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    text-align: center;
}

/* Form Fields */
.form-row {
    margin-bottom: 20px;
    text-align: right;
}

.form-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-row .required {
    color: #dc3545;
}

.ecosupp-review-form textarea,
.ecosupp-review-form input[type="text"],
.ecosupp-review-form input[type="email"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    font-family: inherit;
    direction: rtl;
    text-align: right;
    outline: none;
}

.ecosupp-review-form textarea:focus,
.ecosupp-review-form input[type="text"]:focus,
.ecosupp-review-form input[type="email"]:focus {
    border-color: #c7d957;
    box-shadow: 0 0 0 2px rgba(199, 217, 87, 0.1);
}

.ecosupp-review-form textarea {
    resize: vertical;
    min-height: 120px;
}

/* Rating Input */
.rating-input {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 5px;
}

.rating-input input[type="radio"] {
    display: none;
}

.rating-input label {
    cursor: pointer;
    margin: 0;
    padding: 0;
    display: block;
}

/* Support both icon (i) and Unicode (span) based stars */
.rating-input label i,
.rating-input label .rating-star {
    font-size: 28px;
    color: #ddd;
    transition: color 0.2s ease;
    pointer-events: none;
    font-style: normal;
    display: inline-block;
    line-height: 1;
}

.rating-input label:hover i,
.rating-input label:hover ~ label i,
.rating-input input[type="radio"]:checked ~ label i,
.rating-input label:hover .rating-star,
.rating-input label:hover ~ label .rating-star,
.rating-input input[type="radio"]:checked ~ label .rating-star {
    color: #ffb400 !important;
}

/* Form Button Row */
.button-row {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}

/* Form Buttons */
.submit-review,
.cancel-review {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    outline: none;
}

.submit-review {
    background: #c7d957;
    color: #fff;
}

.submit-review:hover {
    background: #b5c44b;
    transform: translateY(-1px);
}

.submit-review:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.cancel-review {
    background: #6c757d;
    color: #fff;
}

.cancel-review:hover {
    background: #545b62;
    transform: translateY(-1px);
}

/* Login Notice */
.login-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
}

.login-notice p {
    margin: 0 0 15px 0;
    font-weight: 600;
}

.login-register-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.login-link,
.register-link {
    display: inline-block;
    padding: 10px 20px;
    background: #c7d957;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.login-link:hover,
.register-link:hover {
    background: #b5c44b;
    color: #fff;
    text-decoration: none;
}

.separator {
    color: #856404;
    font-weight: 500;
    margin: 0 5px;
}

/* Error Message */
.ecosupp-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
    margin: 20px 0;
}

/* Success/Error Messages */
.success-message,
.error-message {
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
    text-align: center;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* WoodMart Theme Integration */
.woodmart-theme .ecosupp-reviews-container {
    font-family: inherit;
}

.woodmart-theme .review-item {
    border-color: var(--wd-border-color, #e9ecef);
}

.woodmart-theme .review-item:hover {
    border-color: var(--wd-primary-color, #c7d957);
}

.woodmart-theme .star-rating .filled-star {
    color: var(--wd-primary-color, #ffb400);
}

.woodmart-theme .submit-review,
.woodmart-theme .add-review-btn {
    background: var(--wd-primary-color, #c7d957);
}

.woodmart-theme .submit-review:hover,
.woodmart-theme .add-review-btn:hover {
    background: var(--wd-primary-color-hover, #b5c44b);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .review-form-inner {
        padding: 20px 15px;
    }

    .review-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .review-meta {
        text-align: center;
    }

    .review-avatar {
        align-self: center;
    }

    .review-author-line {
        justify-content: center;
    }

    .review-rating {
        text-align: center;
    }

    /* Ensure stars display properly on mobile */
    .star-rating {
        display: inline-flex !important;
        visibility: visible !important;
        font-size: 16px;
    }

    .star-rating .star,
    .star-rating .filled-star,
    .star-rating .empty-star {
        display: inline-block !important;
        visibility: visible !important;
    }

    .review-content {
        text-align: center;
    }

    .rating-input {
        justify-content: center;
    }

    .login-register-links {
        flex-direction: column;
        gap: 10px;
    }

    .add-review-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .review-item {
        padding: 15px;
    }
    
    .review-form-inner {
        padding: 15px;
    }
    
    .rating-input label i {
        font-size: 20px;
    }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .review-item {
        background: #2a2a2a;
        border-color: #404040;
        color: #e0e0e0;
    }
    
    .review-author {
        color: #ffffff;
    }
    
    .review-content {
        color: #cccccc;
    }
    
    .review-date {
        color: #999999;
    }
    
    .review-form-wrapper {
        background: #2a2a2a;
        border-color: #404040;
    }
    
    .ecosupp-review-form input[type="text"],
    .ecosupp-review-form input[type="email"],
    .ecosupp-review-form textarea {
        background: #1a1a1a;
        border-color: #404040;
        color: #e0e0e0;
    }
    
    .no-reviews-message {
        background: #2a2a2a;
        border-color: #404040;
        color: #cccccc;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .review-item {
        border-width: 2px;
    }
    
    .star-rating .filled-star {
        color: #ff6600;
    }
    
    .verified-badge {
        background: #000000;
        color: #00ff00;
        border: 1px solid #00ff00;
    }
    
    .submit-review,
    .add-review-btn {
        border: 2px solid #ffffff;
    }
}

/* Pagination Styles */
.reviews-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    padding: 20px 0;
    border-top: 1px solid #e9ecef;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.pagination-link:hover {
    background: #c7d957;
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(199, 217, 87, 0.3);
}

.pagination-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-link i {
    font-size: 14px;
}

.pagination-info {
    color: #666;
    font-size: 14px;
    font-weight: 500;
    padding: 0 10px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .review-item,
    .submit-review,
    .add-review-btn,
    .rating-input label i,
    .pagination-link {
        transition: none;
    }
}

/* Print Styles */
@media print {
    .review-form-section,
    .add-review-btn {
        display: none;
    }
    
    .review-item {
        border: 1px solid #000;
        break-inside: avoid;
        margin-bottom: 20px;
    }
    
    .star-rating .filled-star {
        color: #000 !important;
    }
}
