/* ==================== 文章评分系统样式 ==================== */

.article-engagement-section {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 1.5rem 0;
}

.engagement-container {
    max-width: 1100px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

/* ==================== 紧凑型评分组件 ==================== */

.compact-rating-widget {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.compact-rating-widget .rating-header h4 {
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.rating-content {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.current-rating-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rating-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rating-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: #DC512D;
}

.rating-stars-compact {
    display: flex;
    gap: 0.125rem;
}

.rating-stars-compact .fa {
    font-size: 1rem;
    color: #ddd;
}

.rating-stars-compact .fa.filled {
    color: #FCC41B;
}

.rating-stars-compact span {
    font-size: 1rem;
    color: #ddd;
    display: inline-block;
    min-width: 16px;
    text-align: center;
    line-height: 1;
}

.rating-stars-compact span.filled {
    color: #FCC41B !important;
}

.rating-stars-compact span.half-filled {
    color: #FCC41B !important;
    opacity: 0.6;
}

.rating-count {
    color: #6c757d;
    font-size: 0.9rem;
}

.rating-form-compact {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rate-label {
    color: #495057;
    font-weight: 500;
    font-size: 0.95rem;
}

.star-rating-compact {
    display: flex;
    gap: 0.25rem;
}

.star-rating-compact .rating-star {
    font-size: 1.5rem;
    color: #ddd !important;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    min-width: 24px;
    text-align: center;
    user-select: none;
    line-height: 1;
}

.star-rating-compact .rating-star:hover {
    color: #FCC41B !important;
    transform: scale(1.1);
}

.star-rating-compact .rating-star.active {
    color: #FCC41B !important;
}

.star-rating-compact .rating-star.selected {
    color: #DC512D !important;
}

.rating-message-compact {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

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

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

/* ==================== 响应式设计 ==================== */

@media (max-width: 768px) {
    .engagement-container {
        margin: 0 1rem;
        padding: 1.5rem;
    }
    
    .rating-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .rating-form-compact {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .compact-rating-widget .rating-header h4 {
        font-size: 1.25rem;
    }
    
    .rating-score {
        font-size: 1.25rem;
    }
    
    .star-rating-compact .rating-star {
        font-size: 1.1rem;
    }
}

.rating-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.rating-header {
    text-align: center;
    margin-bottom: 2rem;
}

.rating-header h3 {
    color: #2c3e50;
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.rating-header p {
    color: #6c757d;
    font-size: 1.1rem;
}

/* ==================== 当前评分显示 ==================== */

.current-rating {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 4px solid #DC512D;
}

.rating-summary {
    flex: 1;
}

.rating-average {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.average-score {
    font-size: 3rem;
    font-weight: 700;
    color: #DC512D;
    line-height: 1;
}

.rating-stars-display {
    display: flex;
    gap: 0.25rem;
}

.rating-stars-display .fa {
    font-size: 1.5rem;
    color: #ddd;
}

.rating-stars-display .fa.filled {
    color: #FCC41B;
}

.rating-count {
    color: #6c757d;
    font-size: 1rem;
    font-weight: 500;
}

/* ==================== 评分分布 ==================== */

.rating-distribution {
    flex: 2;
    min-width: 300px;
}

.rating-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.star-label {
    display: flex;
    gap: 0.125rem;
    min-width: 80px;
}

.star-label .fa {
    font-size: 0.875rem;
    color: #FCC41B;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FCC41B 0%, #DC512D 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.percentage {
    min-width: 40px;
    text-align: right;
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
}

/* ==================== 评分表单 ==================== */

.rating-form {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border-radius: 12px;
    border: 2px dashed #e9ecef;
    margin-bottom: 1rem;
}

.rating-form h4 {
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.star-rating {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.rating-star {
    font-size: 2.5rem;
    color: #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.rating-star:hover {
    color: #FCC41B;
    transform: scale(1.1);
}

.rating-star.active {
    color: #FCC41B;
}

.rating-star.selected {
    color: #DC512D;
    animation: starPulse 0.6s ease;
}

@keyframes starPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.rating-message {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    margin-top: 1rem;
    animation: fadeIn 0.3s ease;
}

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

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== 无评分状态 ==================== */

.no-ratings {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    margin-bottom: 1rem;
}

.no-ratings-content i {
    font-size: 3rem;
    color: #DC512D;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.no-ratings-content h4 {
    color: #2c3e50;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.no-ratings-content p {
    color: #6c757d;
    font-size: 1.1rem;
}

/* ==================== 响应式设计 ==================== */

@media (max-width: 768px) {
    .rating-container {
        padding: 1rem;
        margin: 0 1rem;
    }
    
    .current-rating {
        flex-direction: column;
        gap: 1rem;
    }
    
    .rating-average {
        justify-content: center;
    }
    
    .average-score {
        font-size: 2.5rem;
    }
    
    .rating-stars-display .fa {
        font-size: 1.25rem;
    }
    
    .rating-distribution {
        min-width: auto;
    }
    
    .rating-bar {
        gap: 0.5rem;
    }
    
    .star-label {
        min-width: 60px;
    }
    
    .star-label .fa {
        font-size: 0.75rem;
    }
    
    .rating-star {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .rating-header h3 {
        font-size: 1.5rem;
    }
    
    .rating-form h4 {
        font-size: 1.1rem;
    }
    
    .star-rating {
        gap: 0.25rem;
    }
    
    .rating-star {
        font-size: 1.75rem;
    }
    
    .average-score {
        font-size: 2rem;
    }
}

/* ==================== 加载状态 ==================== */

.star-rating.loading .rating-star {
    opacity: 0.6;
    pointer-events: none;
}

.star-rating.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #DC512D;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ==================== 悬停效果 ==================== */

.rating-star:hover ~ .rating-star {
    color: #ddd;
    transform: scale(1);
}

.star-rating:hover .rating-star {
    color: #ddd;
}

.star-rating .rating-star:hover,
.star-rating .rating-star:hover ~ .rating-star {
    color: #ddd;
}

.star-rating .rating-star:hover {
    color: #FCC41B;
}

/* ==================== 工具提示 ==================== */

.rating-star {
    position: relative;
}

.rating-star::before {
    content: attr(title);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.rating-star::after {
    content: '';
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #2c3e50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.rating-star:hover::before,
.rating-star:hover::after {
    opacity: 1;
}

/* ==================== 动画增强 ==================== */

.rating-container {
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.current-rating {
    animation: fadeInLeft 0.8s ease-out 0.2s both;
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.rating-form {
    animation: fadeInRight 0.8s ease-out 0.4s both;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
