/* ============================================================
 * 工具评价组件 - 公共样式
 * 使用：<link rel="stylesheet" href="assets/rating.css">
 * ============================================================ */

.rating-section { text-align: center; }
.rating-summary {
    display: flex; align-items: center; justify-content: center;
    gap: 24px; margin-bottom: 20px; flex-wrap: wrap;
}
.rating-big-score { text-align: center; }
.rating-big-num { font-size: 48px; font-weight: 800; color: #ff9800; line-height: 1; }
.rating-big-label { font-size: 13px; color: #999; margin-top: 4px; }
.rating-distribution { text-align: left; flex: 1; min-width: 200px; max-width: 320px; }
.rating-dist-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rating-dist-label { font-size: 12px; color: #888; width: 28px; text-align: right; white-space: nowrap; }
.rating-dist-bar-bg { flex: 1; height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; }
.rating-dist-bar-fill {
    height: 100%; background: linear-gradient(90deg, #ffca28, #ff9800);
    border-radius: 4px; transition: width 0.5s ease;
}
.rating-dist-count { font-size: 11px; color: #bbb; width: 28px; }
.rating-total { font-size: 13px; color: #999; margin-bottom: 20px; }

.rating-stars {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; margin-bottom: 12px; cursor: pointer;
}
.rating-star-icon {
    width: 40px; height: 40px; position: relative; transition: transform 0.15s;
    -webkit-user-select: none; user-select: none;
}
.rating-star-icon:hover { transform: scale(1.2); }
.rating-star-icon svg { width: 100%; height: 100%; }
.rating-star-empty { fill: #e0e0e0; }
.rating-star-half  { fill: url(#ratingHalfGrad); }
.rating-star-full  { fill: #ff9800; }

.rating-hint { font-size: 14px; color: #999; margin-bottom: 16px; min-height: 22px; }
.rating-hint.selected { color: #ff9800; font-weight: 600; }

.rating-btn {
    padding: 10px 32px; border: none; border-radius: 8px;
    background: linear-gradient(135deg, #ff9800, #f57c00); color: #fff;
    font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.3s;
}
.rating-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(255,152,0,0.4); }
.rating-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.rating-success { color: #66bb6a; font-weight: 600; font-size: 15px; margin-top: 10px; display: none; }
.rating-success.show { display: block; animation: ratingFadeIn 0.4s ease; }

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

@media (max-width: 768px) {
    .rating-stars { gap: 4px; }
    .rating-star-icon { width: 36px; height: 36px; }
}

/* 外层卡片容器（可选，页面已有 .card 样式时会自动适配） */
.rating-card-title {
    font-size: 18px; font-weight: 700; color: #1e1e2e;
    margin-bottom: 20px; padding-bottom: 14px;
    border-bottom: 2px solid #f0f0f0;
    display: flex; align-items: center; gap: 10px;
}
.rating-card-title .icon { font-size: 22px; }
.rating-card-title .title-text { flex: 1; }

/* ===== 收藏按钮（嵌在评分卡标题栏右侧） ===== */
.rating-fav-btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 32px; padding: 0 14px;
    background: #fff; border: 1.5px solid #e5e7eb; border-radius: 999px;
    font-size: 13px; font-weight: 600; color: #6b7280;
    cursor: pointer; transition: all 0.2s ease;
    -webkit-user-select: none; user-select: none;
}
.rating-fav-btn:hover {
    border-color: #f43f5e; color: #f43f5e;
    box-shadow: 0 2px 8px rgba(244, 63, 94, 0.15);
}
.rating-fav-btn .heart-svg {
    width: 16px; height: 16px; transition: transform 0.2s ease;
}
.rating-fav-btn .heart-svg path {
    fill: none; stroke: currentColor; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round;
    transition: fill 0.2s ease, stroke 0.2s ease;
}
.rating-fav-btn.is-fav {
    background: linear-gradient(135deg, #fff1f2, #ffe4e6);
    border-color: #f43f5e; color: #e11d48;
}
.rating-fav-btn.is-fav .heart-svg path {
    fill: #f43f5e; stroke: #f43f5e;
}
.rating-fav-btn.is-fav:hover { color: #be123c; }
.rating-fav-btn:disabled { opacity: 0.6; cursor: wait; }
.rating-fav-btn.popping .heart-svg { animation: ratingFavPop 0.4s ease; }
@keyframes ratingFavPop {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.4); }
    60%  { transform: scale(0.9); }
    100% { transform: scale(1); }
}
