/* 评论系统样式 */
.comment-system {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f8f9fa;
}

.comment-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin: 0;
    display: flex;
    align-items: center;
}

.comment-title i {
    margin-right: 10px;
    color: #007bff;
}

.comment-count {
    background: #007bff;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* 评论编辑器 */
.comment-editor {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    border: 2px solid #e9ecef;
    transition: border-color 0.3s ease;
}

.comment-editor:focus-within {
    border-color: #007bff;
    background: white;
}

.editor-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
    flex-wrap: wrap;
}

.editor-btn {
    background: none;
    border: 1px solid #dee2e6;
    color: #6c757d;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.editor-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.editor-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.comment-textarea {
    width: 100%;
    min-height: 120px;
    border: none;
    outline: none;
    resize: vertical;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
    padding: 0;
    background: transparent;
}

.comment-textarea::placeholder {
    color: #adb5bd;
}

.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.editor-options {
    display: flex;
    gap: 15px;
    align-items: center;
}

.editor-actions {
    display: flex;
    gap: 10px;
}

.btn-comment {
    padding: 8px 20px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-comment-primary {
    background: #007bff;
    color: white;
}

.btn-comment-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.btn-comment-secondary {
    background: #6c757d;
    color: white;
}

.btn-comment-secondary:hover {
    background: #545b62;
}

/* 评论列表 */
.comment-list {
    margin-top: 20px;
}

.comment-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    border-left: 4px solid #007bff;
    transition: all 0.3s ease;
    position: relative;
}

.comment-item:hover {
    background: #e9ecef;
    transform: translateX(3px);
}

.comment-item.reply {
    margin-left: 40px;
    border-left-color: #28a745;
    background: #f1f8ff;
}

.comment-item.reply:hover {
    background: #e3f2fd;
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 10px;
}

.author-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.author-info {
    display: flex;
    flex-direction: column;
}

.author-name {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.author-role {
    font-size: 0.75rem;
    color: #6c757d;
}

.comment-time {
    color: #6c757d;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.comment-content {
    color: #333;
    line-height: 1.6;
    margin-bottom: 15px;
    word-wrap: break-word;
}

.comment-content p {
    margin-bottom: 10px;
}

.comment-content p:last-child {
    margin-bottom: 0;
}

/* 代码块在评论中的样式 */
.comment-content .code-block {
    background: #2d3748;
    color: #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    margin: 10px 0;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.comment-content .inline-code {
    background: #f1f3f4;
    color: #d73a49;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.comment-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.comment-action {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 15px;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.comment-action:hover {
    background: #dee2e6;
    color: #495057;
}

.comment-action.liked {
    color: #dc3545;
}

.comment-action.replied {
    color: #007bff;
}

/* 评论状态标识 */
.comment-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.comment-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
}

.badge-private {
    background: #fff3cd;
    color: #856404;
}

.badge-pinned {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-edited {
    background: #f8d7da;
    color: #721c24;
}

.badge-teacher {
    background: #d4edda;
    color: #155724;
}

.badge-assistant {
    background: #cce5ff;
    color: #004085;
}

/* 回复框 */
.reply-form {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
    display: none;
}

.reply-form.show {
    display: block;
    animation: slideDown 0.3s ease;
}

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

.reply-textarea {
    width: 100%;
    min-height: 80px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    resize: vertical;
    font-family: inherit;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.reply-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* 评论筛选 */
.comment-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 15px;
    border: 1px solid #dee2e6;
    background: white;
    color: #6c757d;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.filter-btn:hover {
    background: #f8f9fa;
}

.filter-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* 评论排序 */
.comment-sort {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.sort-label {
    color: #6c757d;
    font-size: 0.9rem;
}

.sort-select {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 5px 10px;
    background: white;
    color: #495057;
    font-size: 0.85rem;
}

/* 空状态 */
.comment-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.comment-empty i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.comment-empty h6 {
    margin-bottom: 10px;
    color: #495057;
}

/* 加载状态 */
.comment-loading {
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 分页 */
.comment-pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.pagination-btn {
    padding: 8px 15px;
    border: 1px solid #dee2e6;
    background: white;
    color: #007bff;
    text-decoration: none;
    margin: 0 2px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.pagination-btn:hover {
    background: #e9ecef;
    text-decoration: none;
}

.pagination-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.pagination-btn.disabled {
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.5;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .comment-system {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .comment-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .comment-item.reply {
        margin-left: 20px;
    }
    
    .editor-toolbar {
        gap: 5px;
    }
    
    .editor-btn {
        padding: 4px 8px;
        font-size: 0.8rem;
    }
    
    .editor-footer {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .editor-actions {
        justify-content: center;
    }
    
    .comment-filters {
        justify-content: center;
    }
    
    .comment-actions {
        flex-wrap: wrap;
        gap: 10px;
    }
}

/* 打印样式 */
@media print {
    .comment-editor,
    .comment-actions,
    .editor-toolbar,
    .comment-filters,
    .comment-pagination {
        display: none;
    }
    
    .comment-system {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    .comment-item {
        break-inside: avoid;
        background: white !important;
        border-left-color: #333 !important;
    }
}

/* 主题变体 */
.comment-system.theme-dark {
    background: #2d3748;
    color: #e2e8f0;
}

.comment-system.theme-dark .comment-item {
    background: #4a5568;
    color: #e2e8f0;
}

.comment-system.theme-dark .comment-editor {
    background: #4a5568;
    border-color: #718096;
}

.comment-system.theme-dark .comment-textarea {
    color: #e2e8f0;
}

/* 动画效果 */
.comment-item {
    animation: fadeInUp 0.5s ease;
}

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

.comment-action {
    transition: transform 0.2s ease;
}

.comment-action:active {
    transform: scale(0.95);
}

/* 特殊效果 */
.comment-item.highlighted {
    background: #fff3cd;
    border-left-color: #ffc107;
    animation: pulse 2s ease-in-out;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

.comment-item.new {
    border-left-color: #28a745;
    background: #d4edda;
}

.comment-item.editing {
    border-left-color: #ffc107;
    background: #fff3cd;
}