/**
 * Reviews System Styles
 * Star ratings, review forms, review display
 * 
 * @package ToolsAIApp
 */

/* ========================================
   Star Rating Display
   ======================================== */

.star-rating-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.star-rating-display .stars {
    display: flex;
    gap: 2px;
}

.star-rating-display .star {
    font-size: 18px;
    line-height: 1;
    transition: color 0.3s ease;
}

.star-rating-display .star.filled {
    color: #ffc107;
}

.star-rating-display .star.half {
    color: #ffc107;
    position: relative;
}

.star-rating-display .star.empty {
    color: #ddd;
}

.star-rating-display .rating-number {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
}

/* Star rating in tool stats */
.tool-stats .rating-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tool-stats .rating-count {
    font-size: 13px;
    color: #666;
}

/* Star rating in tool cards */
.tool-card-rating {
    margin: 8px 0;
}

.tool-card-rating .star-rating-display .stars {
    gap: 1px;
}

.tool-card-rating .star-rating-display .star {
    font-size: 16px;
}

.tool-card-rating .review-count {
    font-size: 13px;
    color: #666;
    margin-left: 4px;
}

/* ========================================
   Reviews Section
   ======================================== */

.reviews-section {
    margin-top: 40px;
}

.reviews-header {
    margin-bottom: 30px;
}

.reviews-header h2 {
    font-size: 28px;
    margin-bottom: 20px;
}

/* Reviews Summary */
.reviews-summary {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 40px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 30px;
}

.average-rating {
    text-align: center;
}

.rating-score {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 10px;
}

.average-rating .star-rating-display {
    justify-content: center;
    margin-bottom: 8px;
}

.average-rating .star-rating-display .star {
    font-size: 24px;
}

.rating-text {
    font-size: 14px;
    color: #666;
}

/* Rating Breakdown */
.rating-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rating-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.star-label {
    font-size: 14px;
    font-weight: 600;
    min-width: 40px;
}

.bar-container {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffc107, #ff9800);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.rating-bar .count {
    font-size: 14px;
    color: #666;
    min-width: 40px;
    text-align: right;
}

.no-reviews-yet {
    color: #666;
    font-style: italic;
}

/* ========================================
   Write Review Button
   ======================================== */

.write-review-cta {
    margin-bottom: 30px;
}

#write-review-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ========================================
   Review Form
   ======================================== */

.review-form-container {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 40px;
}

.review-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.review-form .form-group {
    margin-bottom: 20px;
}

.review-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.review-form .required {
    color: #e53e3e;
}

.review-form input[type="text"],
.review-form input[type="email"],
.review-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.review-form input:focus,
.review-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.review-form textarea {
    resize: vertical;
    min-height: 100px;
}

/* Star Rating Input */
.star-rating-input {
    display: flex;
    gap: 8px;
    font-size: 32px;
    cursor: pointer;
}

.star-rating-input .star {
    color: #ddd;
    transition: color 0.2s ease, transform 0.2s ease;
}

.star-rating-input .star:hover,
.star-rating-input .star.hover {
    color: #ffc107;
    transform: scale(1.1);
}

.star-rating-input .star.selected {
    color: #ffc107;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.form-message {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    display: none;
}

.form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* ========================================
   Reviews List
   ======================================== */

.reviews-list {
    margin-top: 40px;
}

.review-item {
    padding: 24px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    margin-bottom: 20px;
    background: #fff;
    transition: box-shadow 0.3s ease;
}

.review-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.review-author {
    display: flex;
    gap: 12px;
}

.author-avatar {
    flex-shrink: 0;
}

.author-avatar img {
    border-radius: 50%;
    width: 48px;
    height: 48px;
}

.author-info h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.review-date {
    font-size: 13px;
    color: #666;
}

.review-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--text-color);
}

.review-content {
    font-size: 15px;
    line-height: 1.6;
    color: #444;
    margin-bottom: 16px;
}

/* Pros and Cons */
.review-pros-cons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.review-pros,
.review-cons {
    font-size: 14px;
}

.review-pros strong {
    color: #28a745;
    display: block;
    margin-bottom: 8px;
}

.review-cons strong {
    color: #dc3545;
    display: block;
    margin-bottom: 8px;
}

.review-pros p,
.review-cons p {
    margin: 0;
    line-height: 1.5;
}

/* Review Footer */
.review-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.helpful-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.helpful-btn:hover {
    background: #e9ecef;
    border-color: #ccc;
}

.helpful-btn.voted {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.thumb-icon {
    font-size: 16px;
}

/* Load More Reviews */
.load-more-reviews {
    text-align: center;
    margin-top: 30px;
}

#load-more-reviews {
    min-width: 200px;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .reviews-summary {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 20px;
    }
    
    .review-form-container {
        padding: 20px;
    }
    
    .review-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .review-pros-cons {
        grid-template-columns: 1fr;
    }
    
    .review-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .star-rating-input {
        font-size: 28px;
    }
    
    .rating-score {
        font-size: 40px;
    }
}

@media (max-width: 480px) {
    .review-item {
        padding: 16px;
    }
    
    .author-avatar img {
        width: 40px;
        height: 40px;
    }
    
    .reviews-header h2 {
        font-size: 24px;
    }
    
    .star-rating-input {
        font-size: 24px;
    }
}

/* ========================================
   Loading States
   ======================================== */

.reviews-list.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.reviews-list.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

.review-form.submitting {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.review-form.submitting::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}
