/* ========== Comment System with Rating ========== */

/* --- 评分统计区域 --- */
#rating-summary {
    display: none;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    gap: 40px;
    align-items: center;
}

.rating-summary-left {
    text-align: center;
    min-width: 140px;
}

.rating-big-number {
    font-size: 48px;
    font-weight: 700;
    color: #333;
    line-height: 1;
}

.rating-label {
    font-size: 16px;
    font-weight: 600;
    color: #666;
    margin: 4px 0 8px;
}

.rating-stars-display {
    margin: 8px 0;
}

.rating-stars-display .star-display {
    font-size: 20px;
    color: #ddd;
}

.rating-stars-display .star-display.filled {
    color: #00b67a;
}

.rating-total {
    font-size: 14px;
    color: #999;
}

.rating-summary-right {
    flex: 1;
    max-width: 400px;
}

.rating-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.rating-bar-label {
    width: 50px;
    font-size: 13px;
    color: #666;
}

.rating-bar-track {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.rating-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.rating-bar-5 { background: #00b67a; }
.rating-bar-4 { background: #73cf11; }
.rating-bar-3 { background: #ffce00; }
.rating-bar-2 { background: #ff8622; }
.rating-bar-1 { background: #ff3722; }

.rating-bar-count {
    width: 30px;
    font-size: 12px;
    color: #999;
    text-align: right;
}

/* --- 表单区域 --- */
#comment-section {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
}

#comment-section h3 {
    font-size: 24px;
    color: #333;
    margin-bottom: 20px;
}

.c-form {
    background: #f8f9fa;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
}

/* 评分选择器 */
#rating-section {
    margin-bottom: 16px;
}

.rating-select-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.star-selector {
    display: inline-flex;
    gap: 4px;
}

.star-selector .star {
    font-size: 26px;
    color: #ddd;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.star-selector .star:hover,
.star-selector .star.preview {
    color: #ffce00;
    transform: scale(1.1);
}

.star-selector .star.active {
    color: #00b67a;
}

#rating-text {
    display: inline-block;
    margin-left: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #00b67a;
    vertical-align: middle;
}

/* 输入框 */
.c-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.c-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.c-input:focus {
    outline: none;
    border-color: #00b67a;
}

#c_title {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    box-sizing: border-box;
}

#c_title:focus {
    outline: none;
    border-color: #00b67a;
}

.c-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.c-textarea:focus {
    outline: none;
    border-color: #00b67a;
}

/* 底部操作栏 */
.c-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.c-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.c-upload-label:hover {
    border-color: #00b67a;
    color: #00b67a;
}

.c-btn {
    padding: 12px 32px;
    background: #00b67a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.c-btn:hover {
    background: #009a65;
}

.c-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 图片预览 */
/* 图片预览 - 默认隐藏 */
#img-preview-box {
    display: none;
    margin-top: 12px;
    position: relative;
}

#img-preview-box.show {
    display: inline-block;
}

#img-preview {
    max-width: 150px;
    max-height: 100px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.remove-img-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #ff4d4f;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 24px;
    text-align: center;
}

/* 回复状态 */
#reply-status {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #e6f7ff;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #1890ff;
}

#reply-status button {
    background: none;
    border: none;
    color: #ff4d4f;
    cursor: pointer;
    font-size: 14px;
}

/* 隐藏字段 */
.c-hidden {
    display: none !important;
}

/* --- 评论列表 --- */
#c-list {
    margin-top: 24px;
}

.c-item {
    margin-bottom: 0;
}

.c-main {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
}

.c-main.admin-bg {
    background: #f6ffed;
}

.c-avatar {
    flex-shrink: 0;
}

.c-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.c-content {
    flex: 1;
    min-width: 0;
}

.c-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.c-header-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.c-nick {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.c-date {
    font-size: 13px;
    color: #999;
}

.badge-admin {
    background: #00b67a;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.badge-pinned {
    background: #722ed1;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

/* 评论中的评分 */
.c-rating {
    margin-bottom: 6px;
}

.c-rating .star-display {
    font-size: 16px;
    color: #ddd;
}

.c-rating .star-display.filled {
    color: #00b67a;
}

/* 评论标题 */
.c-title {
    font-weight: 600;
    font-size: 16px;
    color: #333;
    margin-bottom: 8px;
}

.c-text {
    font-size: 15px;
    color: #444;
    line-height: 1.6;
    word-wrap: break-word;
}

.c-img-display {
    max-width: 300px;
    max-height: 200px;
    margin-top: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.c-img-display:hover {
    transform: scale(1.02);
}

.btn-reply {
    background: none;
    border: none;
    color: #00b67a;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
}

.btn-reply:hover {
    text-decoration: underline;
}

/* 子评论 */
.c-children {
    margin-left: 64px;
    border-left: 2px solid #f0f0f0;
}

.c-children .c-main {
    padding: 16px 20px;
}

.c-children .c-avatar img {
    width: 40px;
    height: 40px;
}

/* 加载更多 */
#load-more-container {
    display: none;
    text-align: center;
    padding: 20px 0;
}

#btn-load-more {
    padding: 12px 32px;
    background: #fff;
    border: 1px solid #00b67a;
    color: #00b67a;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

#btn-load-more:hover {
    background: #00b67a;
    color: #fff;
}

/* 弹窗 */
#custom-alert-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.custom-alert-box {
    background: #fff;
    padding: 24px 32px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
}

#custom-alert-content {
    font-size: 16px;
    color: #333;
    margin-bottom: 20px;
}

.custom-alert-box button {
    padding: 10px 32px;
    background: #00b67a;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

/* Lightbox */
#lightbox-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

#lightbox-img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: #fff;
    cursor: pointer;
    background: none;
    border: none;
}

/* 响应式 */
@media (max-width: 600px) {
    #rating-summary {
        flex-direction: column;
        gap: 20px;
    }
    
    .c-row {
        flex-direction: column;
    }
    
    .c-main {
        padding: 16px;
    }
    
    .c-children {
        margin-left: 20px;
    }
    
    .star-selector .star {
        font-size: 28px;
    }
}