/* ================================================================
 * DS 资源评分 + 评论 v4.1 样式
 * ================================================================ */

.ds-rating-block { margin: 32px 0; padding: 24px; background: var(--ds-color-white, #fff); border: 1px solid var(--ds-color-border, #ebeef5); border-radius: var(--ds-radius-md, 8px); }
.ds-rating-title { font-size: var(--ds-fs-md, 18px); font-weight: 700; margin: 0 0 20px; color: var(--ds-color-text-1, #222); }

.ds-rating-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 32px; align-items: start; }

/* 左侧:评分总览 */
.ds-rating-summary { display: flex; flex-direction: column; gap: 16px; }
.ds-rating-avg { text-align: center; padding: 16px; background: var(--ds-color-bg, #fafafa); border-radius: var(--ds-radius-md, 8px); }
.ds-rating-avg-num { font-size: 48px; font-weight: 800; color: var(--ds-color-primary, #FF7D00); line-height: 1.1; }
.ds-rating-avg-stars { font-size: 22px; color: #ddd; margin: 4px 0; }
.ds-rating-avg-stars .ds-rating-star { display: inline-block; transition: color 0.2s; }
.ds-rating-avg-stars .ds-rating-star.is-full { color: #FFB400; }
.ds-rating-avg-stars .ds-rating-star.is-half { background: linear-gradient(90deg, #FFB400 50%, #ddd 50%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ds-rating-avg-count { font-size: 13px; color: var(--ds-color-text-3, #909399); margin-top: 4px; }

.ds-rating-dist { display: flex; flex-direction: column; gap: 6px; }
.ds-rating-dist-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.ds-rating-dist-label { width: 32px; color: var(--ds-color-text-2, #606266); flex-shrink: 0; }
.ds-rating-dist-bar { flex: 1; height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; }
.ds-rating-dist-fill { height: 100%; background: linear-gradient(90deg, #FFB400, #FF7D00); border-radius: 4px; transition: width 0.4s; }
.ds-rating-dist-pct { width: 48px; text-align: right; color: var(--ds-color-text-3, #909399); flex-shrink: 0; }

/* 右侧:提交表单 */
.ds-rating-form { padding: 20px; background: var(--ds-color-bg, #fafafa); border-radius: var(--ds-radius-md, 8px); }
.ds-rating-form h3 { font-size: 14px; font-weight: 600; margin: 0 0 12px; color: var(--ds-color-text-1, #222); }
.ds-rating-login-tip { padding: 20px; text-align: center; color: var(--ds-color-text-3, #909399); font-size: 13px; }
.ds-rating-login-tip a { color: var(--ds-color-primary, #FF7D00); text-decoration: none; }
.ds-rating-login-tip a:hover { text-decoration: underline; }

.ds-rating-stars-input { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; }
.ds-rating-star-input { font-size: 32px; color: #ddd; cursor: pointer; transition: all 0.15s; user-select: none; }
.ds-rating-star-input:hover { transform: scale(1.15); }
.ds-rating-star-input.is-on, .ds-rating-star-input.is-hover { color: #FFB400; }
.ds-rating-stars-tip { margin-left: 12px; font-size: 12px; color: var(--ds-color-text-3, #909399); }

.ds-rating-textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--ds-color-border, #ebeef5); border-radius: 6px; font-size: 14px; resize: vertical; min-height: 80px; font-family: inherit; background: #fff; color: var(--ds-color-text-1, #222); transition: border-color 0.2s; box-sizing: border-box; }
.ds-rating-textarea:focus { outline: none; border-color: var(--ds-color-primary, #FF7D00); }

.ds-rating-form-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.ds-rating-form-count { font-size: 12px; color: var(--ds-color-text-3, #909399); }
.ds-rating-submit-btn { background: var(--ds-color-primary, #FF7D00); color: #fff; border: 0; padding: 8px 24px; border-radius: 4px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.ds-rating-submit-btn:hover { background: #ff6a00; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255,125,0,.3); }
.ds-rating-submit-btn:disabled { background: #ccc; cursor: not-allowed; transform: none; box-shadow: none; }

/* 评论区 */
.ds-comments-wrap { margin-top: 32px; }
.ds-comments-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--ds-color-border, #ebeef5); }
.ds-comments-header h3 { font-size: 15px; font-weight: 700; margin: 0; color: var(--ds-color-text-1, #222); }
.ds-comments-sort { display: flex; gap: 4px; }
.ds-comments-sort button { background: transparent; border: 1px solid var(--ds-color-border, #ebeef5); padding: 4px 12px; font-size: 12px; color: var(--ds-color-text-2, #606266); border-radius: 4px; cursor: pointer; transition: all 0.2s; }
.ds-comments-sort button.is-active { background: var(--ds-color-primary, #FF7D00); color: #fff; border-color: var(--ds-color-primary, #FF7D00); }

.ds-comments-list { display: flex; flex-direction: column; gap: 18px; }
.ds-comment { display: flex; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--ds-color-border, #ebeef5); }
.ds-comment:last-child { border-bottom: 0; }
.ds-comment-avatar { flex-shrink: 0; }
.ds-comment-avatar img { width: 40px; height: 40px; border-radius: 50%; }
.ds-comment-body { flex: 1; min-width: 0; }
.ds-comment-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.ds-comment-name { font-size: 13px; font-weight: 600; color: var(--ds-color-text-1, #222); }
.ds-comment-stars { display: inline-flex; gap: 1px; font-size: 12px; }
.ds-comment-star { color: #ddd; }
.ds-comment-star.is-on { color: #FFB400; }
.ds-comment-time { font-size: 12px; color: var(--ds-color-text-3, #909399); }
.ds-comment-text { font-size: 14px; line-height: 1.6; color: var(--ds-color-text-1, #222); word-wrap: break-word; }
.ds-comment-actions { display: flex; gap: 12px; margin-top: 8px; }
.ds-comment-actions button { background: transparent; border: 0; padding: 4px 8px; font-size: 12px; color: var(--ds-color-text-3, #909399); cursor: pointer; transition: color 0.2s; border-radius: 4px; }
.ds-comment-actions button:hover { color: var(--ds-color-primary, #FF7D00); background: var(--ds-color-bg, #fafafa); }
.ds-comment-actions button.is-liked { color: var(--ds-color-primary, #FF7D00); }
.ds-comment-actions button:disabled { opacity: 0.5; cursor: not-allowed; }

/* 嵌套回复 */
.ds-comment-replies { margin-top: 12px; padding: 12px; background: var(--ds-color-bg, #fafafa); border-radius: 6px; border-left: 3px solid var(--ds-color-primary, #FF7D00); }
.ds-comment-reply-item { display: flex; gap: 8px; padding: 6px 0; }
.ds-comment-reply-item img { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.ds-comment-reply-body { flex: 1; min-width: 0; }
.ds-comment-reply-body .ds-comment-text { font-size: 13px; }

.ds-comments-more { text-align: center; margin-top: 16px; }
.ds-comments-load-more { background: transparent; border: 1px solid var(--ds-color-border, #ebeef5); padding: 8px 24px; font-size: 13px; color: var(--ds-color-text-2, #606266); border-radius: 4px; cursor: pointer; transition: all 0.2s; }
.ds-comments-load-more:hover { color: var(--ds-color-primary, #FF7D00); border-color: var(--ds-color-primary, #FF7D00); }

.ds-rating-empty { padding: 40px 20px; text-align: center; color: var(--ds-color-text-3, #909399); font-size: 14px; }

/* 提交反馈动效 */
.ds-rating-submit-success { animation: ds-rating-pulse 0.6s ease; }
@keyframes ds-rating-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 暗黑模式 */
[data-ds-theme="dark"] .ds-rating-block, [data-ds-theme="dark"] .ds-rating-form, [data-ds-theme="dark"] .ds-rating-avg { background: #1e1e1e; border-color: #333; }
[data-ds-theme="dark"] .ds-rating-form { background: #252525; }
[data-ds-theme="dark"] .ds-rating-avg { background: #252525; }
[data-ds-theme="dark"] .ds-rating-dist-bar { background: #2a2a2a; }
[data-ds-theme="dark"] .ds-rating-textarea { background: #2a2a2a; border-color: #333; color: #e0e0e0; }
[data-ds-theme="dark"] .ds-comment { border-color: #333; }
[data-ds-theme="dark"] .ds-comment-name, [data-ds-theme="dark"] .ds-comment-text { color: #e0e0e0; }
[data-ds-theme="dark"] .ds-comment-replies { background: #252525; }
[data-ds-theme="dark"] .ds-comments-header { border-color: #333; }
[data-ds-theme="dark"] .ds-comments-sort button { color: #aaa; border-color: #333; }

/* 移动端 */
@media (max-width: 768px) {
    .ds-rating-block { padding: 16px; }
    .ds-rating-grid { grid-template-columns: 1fr; gap: 20px; }
    .ds-rating-avg-num { font-size: 40px; }
    .ds-rating-star-input { font-size: 28px; }
    .ds-comment-avatar img { width: 32px; height: 32px; }
}
