/**
 * 扁豆评分 - 前端样式
 * Lentil Rating Frontend Styles
 */

/* ========== 变量定义 ========== */
.lentil-rating-card {
    --lentil-primary: #6abe45;
    --lentil-primary-light: #8dd95f;
    --lentil-primary-dark: #4a9e2a;
    --lentil-bg: #ffffff;
    --lentil-border: #e8e8e8;
    --lentil-text: #333333;
    --lentil-text-light: #888888;
    --lentil-bg-light: #f8f9fa;
    --lentil-pros-color: #28a745;
    --lentil-cons-color: #dc3545;
    --lentil-radius: 12px;
    --lentil-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* ========== 卡片容器 ========== */
.lentil-rating-card {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--lentil-bg);
    border: 1px solid var(--lentil-border);
    border-radius: var(--lentil-radius);
    box-shadow: var(--lentil-shadow);
    margin: 24px 0;
    overflow: hidden;
    color: var(--lentil-text);
    line-height: 1.6;
}

.lentil-rating-inner {
    padding: 24px;
}

/* ========== 头部 ========== */
.lentil-rating-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.lentil-product-type {
    display: inline-block;
    background: var(--lentil-bg-light);
    color: var(--lentil-text-light);
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.lentil-rating-level {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
}

.lentil-level-excellent { background: #d4edda; color: #155724; }
.lentil-level-great { background: #d1ecf1; color: #0c5460; }
.lentil-level-good { background: #fff3cd; color: #856404; }
.lentil-level-average { background: #ffe5d0; color: #8a4d00; }
.lentil-level-poor { background: #f8d7da; color: #721c24; }
.lentil-level-bad { background: #f5c6cb; color: #721c24; }

/* ========== 主体评分区 ========== */
.lentil-rating-main {
    text-align: center;
    margin-bottom: 20px;
}

.lentil-rating-score-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.lentil-score-number {
    display: flex;
    align-items: baseline;
    justify-content: center;
}

.lentil-score-value {
    font-size: 48px;
    font-weight: 700;
    color: var(--lentil-primary);
    line-height: 1;
}

.lentil-score-max {
    font-size: 18px;
    color: var(--lentil-text-light);
    margin-left: 4px;
}

/* ========== 扁豆图标 ========== */
.lentil-beans {
    display: flex;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}

.lentil-bean {
    display: inline-block;
    width: 24px;
    height: 24px;
    transition: transform 0.2s ease;
}

.lentil-bean:hover {
    transform: scale(1.15);
}

.lentil-bean-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* 扁豆SVG内部样式（兼容旧class结构） */
.lentil-bean-full .lentil-bean-shape,
.lentil-bean-half .lentil-bean-shape {
    fill: var(--lentil-primary);
    stroke: var(--lentil-primary-dark);
    stroke-width: 1.2;
}

.lentil-bean-full .lentil-bean-line,
.lentil-bean-half .lentil-bean-line {
    stroke: var(--lentil-primary-dark);
    stroke-width: 1;
    opacity: 0.4;
}

.lentil-bean-full .lentil-bean-highlight,
.lentil-bean-half .lentil-bean-highlight {
    fill: white;
    opacity: 0.35;
}

.lentil-bean-empty .lentil-bean-shape {
    fill: #e8e8e8;
    stroke: #cccccc;
    stroke-width: 1.2;
}

.lentil-bean-empty .lentil-bean-line {
    stroke: #cccccc;
    stroke-width: 1;
    opacity: 0.3;
}

.lentil-bean-empty .lentil-bean-highlight {
    fill: white;
    opacity: 0.2;
}

/* 半颗扁豆：双层SVG + clip-path裁剪 */
.lentil-bean-half {
    position: relative;
    display: inline-block;
}

.lentil-bean-half .lentil-bean-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.lentil-bean-half .lentil-bean-base {
    position: relative;
    z-index: 1;
}

.lentil-bean-half .lentil-bean-overlay {
    z-index: 2;
    clip-path: inset(0 50% 0 0);
    -webkit-clip-path: inset(0 50% 0 0);
}

/* ========== 总进度条 ========== */
.lentil-progress-wrapper {
    margin-top: 16px;
}

.lentil-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--lentil-bg-light);
    border-radius: 4px;
    overflow: hidden;
}

.lentil-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--lentil-primary-light), var(--lentil-primary));
    border-radius: 4px;
    transition: width 0.6s ease;
}

/* ========== 评分总结 ========== */
.lentil-rating-summary {
    background: var(--lentil-bg-light);
    border-left: 3px solid var(--lentil-primary);
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.lentil-summary-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.lentil-rating-summary p {
    margin: 0;
    font-size: 14px;
    color: var(--lentil-text);
}

/* ========== 用户评分区域 ========== */
.lentil-user-rating-section {
    background: linear-gradient(135deg, #f8fff5 0%, #f0f9eb 100%);
    border: 1px solid #d4edda;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.lentil-user-rating-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.lentil-user-rating-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--lentil-text);
}

.lentil-user-rating-stats {
    font-size: 14px;
    color: var(--lentil-text-light);
}

.lentil-user-avg {
    font-size: 20px;
    font-weight: 700;
    color: var(--lentil-primary);
    margin-right: 4px;
}

.lentil-user-no-rating {
    font-size: 13px;
    color: var(--lentil-text-light);
    font-style: italic;
}

/* 用户评分只读展示 */
.lentil-user-rating-readonly {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.lentil-user-beans {
    display: flex;
    gap: 3px;
}

.lentil-user-beans .lentil-bean {
    width: 20px;
    height: 20px;
}

.lentil-already-rated {
    font-size: 12px;
    color: var(--lentil-primary);
    background: rgba(106, 190, 69, 0.1);
    padding: 3px 10px;
    border-radius: 12px;
}

/* 用户评分交互区 */
.lentil-user-rating-interactive {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lentil-user-rating-input {
    display: flex;
    gap: 4px;
    cursor: pointer;
}

.lentil-interactive-bean {
    display: inline-block;
    width: 28px;
    height: 28px;
    cursor: pointer;
    transition: transform 0.15s ease;
    position: relative;
}

.lentil-interactive-bean:hover {
    transform: scale(1.2);
}

.lentil-interactive-bean .lentil-bean-shape {
    fill: #e8e8e8;
    stroke: #cccccc;
    stroke-width: 1.2;
    transition: fill 0.15s ease, stroke 0.15s ease;
}

.lentil-interactive-bean .lentil-bean-line {
    stroke: #cccccc;
    stroke-width: 1;
    opacity: 0.3;
}

.lentil-interactive-bean .lentil-bean-highlight {
    fill: white;
    opacity: 0.2;
}

/* 已填充状态 */
.lentil-interactive-bean.filled .lentil-bean-shape,
.lentil-interactive-bean.hover-filled .lentil-bean-shape {
    fill: var(--lentil-primary);
    stroke: var(--lentil-primary-dark);
}

.lentil-interactive-bean.filled .lentil-bean-line,
.lentil-interactive-bean.hover-filled .lentil-bean-line {
    stroke: var(--lentil-primary-dark);
    opacity: 0.4;
}

.lentil-interactive-bean.filled .lentil-bean-highlight,
.lentil-interactive-bean.hover-filled .lentil-bean-highlight {
    opacity: 0.35;
}

/* 提交中状态 */
.lentil-user-rating-input.submitting {
    opacity: 0.5;
    pointer-events: none;
}

.lentil-rating-hint {
    font-size: 12px;
    color: var(--lentil-text-light);
}

.lentil-rating-message {
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 6px;
    margin-top: 4px;
}

.lentil-rating-message.success {
    background: #d4edda;
    color: #155724;
}

.lentil-rating-message.error {
    background: #f8d7da;
    color: #721c24;
}

/* ========== 细分维度 ========== */
.lentil-rating-breakdown {
    margin-bottom: 20px;
}

.lentil-breakdown-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--lentil-border);
}

.lentil-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lentil-breakdown-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lentil-breakdown-label {
    width: 80px;
    font-size: 13px;
    color: var(--lentil-text);
    flex-shrink: 0;
}

.lentil-breakdown-bar {
    flex: 1;
    height: 6px;
    background: var(--lentil-bg-light);
    border-radius: 3px;
    overflow: hidden;
}

.lentil-breakdown-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--lentil-primary-light), var(--lentil-primary));
    border-radius: 3px;
    transition: width 0.6s ease;
}

.lentil-breakdown-score {
    width: 36px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    color: var(--lentil-primary);
    flex-shrink: 0;
}

/* ========== 优缺点 ========== */
.lentil-rating-proscons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .lentil-rating-proscons {
        grid-template-columns: 1fr;
    }
}

.lentil-pros,
.lentil-cons {
    background: var(--lentil-bg-light);
    border-radius: 8px;
    padding: 14px 16px;
}

.lentil-pros h5,
.lentil-cons h5 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lentil-pros h5 { color: var(--lentil-pros-color); }
.lentil-cons h5 { color: var(--lentil-cons-color); }

.lentil-pros-icon { color: var(--lentil-pros-color); }
.lentil-cons-icon { color: var(--lentil-cons-color); }

.lentil-pros ul,
.lentil-cons ul {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
    color: var(--lentil-text);
}

.lentil-pros li,
.lentil-cons li {
    margin-bottom: 4px;
}

.lentil-pros li:last-child,
.lentil-cons li:last-child {
    margin-bottom: 0;
}

/* ========== 响应式 ========== */
@media (max-width: 480px) {
    .lentil-rating-inner {
        padding: 16px;
    }

    .lentil-score-value {
        font-size: 36px;
    }

    .lentil-bean {
        width: 20px;
        height: 20px;
    }

    .lentil-interactive-bean {
        width: 24px;
        height: 24px;
    }

    .lentil-breakdown-label {
        width: 64px;
        font-size: 12px;
    }
}

/* ========== 动画 ========== */
@keyframes lentil-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

.lentil-interactive-bean.rated {
    animation: lentil-bounce 0.4s ease;
}

@keyframes lentil-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.lentil-rating-card {
    animation: lentil-fade-in 0.4s ease;
}
