/* 靶场留言区样式 */

.comments-item {
    background: rgba(26, 31, 54, 0.6);
    border: 1px solid rgba(90, 122, 138, 0.2);
    border-radius: 8px;
    padding: 1.2rem;
    backdrop-filter: blur(3px);
    transition: all 0.3s ease;
    flex: 1;  /* 占据父容器全部空间 */
    display: flex;
    flex-direction: column;
    min-height: 0;  /* 允许正确收缩 */
    overflow: hidden;  /* 防止整体溢出 */
}

.comments-item:hover {
    border-color: rgba(90, 122, 138, 0.4);
    background: rgba(26, 31, 54, 0.75);
}

.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(90, 122, 138, 0.2);
    flex-shrink: 0;  /* 标题不缩小 */
}

.comments-header h3 {
    margin: 0;
    color: #5a7a8a;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.comments-header h3 i {
    filter: drop-shadow(0 0 4px rgba(90, 122, 138, 0.4));
    font-size: 1.1rem;
}

.comments-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.comments-count i {
    color: #8b7aa3;
    margin-right: 0.3rem;
}

/* 留言输入区 */
.comment-input-section {
    margin-bottom: 1.2rem;
    padding: 1rem;
    background: rgba(90, 122, 138, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(90, 122, 138, 0.15);
    flex-shrink: 0;  /* 输入区不缩小 */
}

.comment-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.comment-textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.8rem;
    background: rgba(26, 31, 54, 0.6);
    border: 1px solid rgba(90, 122, 138, 0.3);
    border-radius: 6px;
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
    transition: all 0.3s ease;
    font-family: inherit;
}

.comment-textarea:focus {
    outline: none;
    border-color: #5a7a8a;
    background: rgba(26, 31, 54, 0.8);
    box-shadow: 0 0 0 0.2rem rgba(90, 122, 138, 0.25);
}

.comment-textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.comment-input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.comment-char-count {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.comment-char-count.warning {
    color: #ff6b35;
}

.comment-submit-btn {
    padding: 0.6rem 1.5rem;
    background: linear-gradient(135deg, #5a7a8a, #4a6a7a);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comment-submit-btn:hover {
    background: linear-gradient(135deg, #6a8a9a, #5a7a8a);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(90, 122, 138, 0.4);
}

.comment-submit-btn:active {
    transform: translateY(0);
}

.comment-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.comment-submit-btn i {
    font-size: 0.9rem;
}

/* 留言列表 */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;  /* 占据剩余空间 */
    overflow-y: auto;  /* 允许垂直滚动 */
    overflow-x: hidden;  /* 禁止水平滚动 */
    min-height: 200px;  /* 设置最小高度确保可见 */
    max-height: 100%;  /* 限制最大高度 */
    padding-right: 0.5rem;  /* 为滚动条留出空间 */
}

/* 自定义滚动条样式 */
.comments-list::-webkit-scrollbar {
    width: 8px;
}

.comments-list::-webkit-scrollbar-track {
    background: rgba(90, 122, 138, 0.1);
    border-radius: 4px;
}

.comments-list::-webkit-scrollbar-thumb {
    background: rgba(90, 122, 138, 0.3);
    border-radius: 4px;
    transition: background 0.3s ease;
}

.comments-list::-webkit-scrollbar-thumb:hover {
    background: rgba(90, 122, 138, 0.5);
}

/* Firefox滚动条样式 */
.comments-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(90, 122, 138, 0.3) rgba(90, 122, 138, 0.1);
}

.comment-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.comment-empty i {
    font-size: 3rem;
    color: rgba(90, 122, 138, 0.3);
    margin-bottom: 1rem;
    display: block;
}

.comment-empty p {
    margin: 0.5rem 0 0 0;
    font-size: 0.95rem;
}

/* 单条留言 */
.comment-card {
    background: rgba(90, 122, 138, 0.08);
    border: 1px solid rgba(90, 122, 138, 0.15);
    border-radius: 6px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.comment-card:hover {
    background: rgba(90, 122, 138, 0.12);
    border-color: rgba(90, 122, 138, 0.25);
}

.comment-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.comment-user-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5a7a8a, #8b7aa3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.comment-user-details {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.comment-username {
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.comment-time {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.comment-time i {
    margin-right: 0.3rem;
    font-size: 0.75rem;
}

.comment-actions {
    display: flex;
    gap: 0.5rem;
}

.comment-edit-btn {
    padding: 0.4rem 0.8rem;
    background: rgba(139, 122, 163, 0.15);
    color: #8b7aa3;
    border: 1px solid rgba(139, 122, 163, 0.3);
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.comment-edit-btn:hover {
    background: rgba(139, 122, 163, 0.25);
    border-color: rgba(139, 122, 163, 0.5);
}

.comment-edit-btn i {
    font-size: 0.8rem;
}

.comment-delete-btn {
    padding: 0.4rem 0.8rem;
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.comment-delete-btn:hover {
    background: rgba(220, 53, 69, 0.25);
    border-color: rgba(220, 53, 69, 0.5);
}

.comment-delete-btn i {
    font-size: 0.8rem;
}

.comment-content {
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.6;
    word-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;
}

/* 编辑模式样式 */
.comment-card.editing .comment-content {
    display: none;
}

.comment-edit-form {
    display: none;
    margin-top: 0.8rem;
}

.comment-card.editing .comment-edit-form {
    display: block;
}

.comment-edit-textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.8rem;
    background: rgba(26, 31, 54, 0.6);
    border: 1px solid rgba(90, 122, 138, 0.3);
    border-radius: 6px;
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
    transition: all 0.3s ease;
    font-family: inherit;
    margin-bottom: 0.8rem;
}

.comment-edit-textarea:focus {
    outline: none;
    border-color: #5a7a8a;
    background: rgba(26, 31, 54, 0.8);
    box-shadow: 0 0 0 0.2rem rgba(90, 122, 138, 0.25);
}

.comment-edit-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.comment-save-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #5a7a8a, #4a6a7a);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.comment-save-btn:hover {
    background: linear-gradient(135deg, #6a8a9a, #5a7a8a);
}

.comment-cancel-btn {
    padding: 0.5rem 1rem;
    background: rgba(108, 117, 125, 0.15);
    color: #6c757d;
    border: 1px solid rgba(108, 117, 125, 0.3);
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.comment-cancel-btn:hover {
    background: rgba(108, 117, 125, 0.25);
    border-color: rgba(108, 117, 125, 0.5);
}

/* 分页相关样式已移除，改为滚动显示 */

/* 加载状态 */
.comments-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.comments-loading i {
    font-size: 2rem;
    color: #5a7a8a;
    animation: spin 1s linear infinite;
    display: block;
    margin-bottom: 0.8rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 错误提示 */
.comments-error {
    padding: 1rem;
    background: rgba(220, 53, 69, 0.15);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 6px;
    color: #dc3545;
    text-align: center;
}

.comments-error i {
    margin-right: 0.5rem;
}

/* 登录提示 */
.comment-login-tip {
    padding: 1rem;
    background: rgba(139, 122, 163, 0.15);
    border: 1px solid rgba(139, 122, 163, 0.3);
    border-radius: 6px;
    color: #8b7aa3;
    text-align: center;
    font-size: 0.95rem;
    flex-shrink: 0;  /* 登录提示不缩小 */
    margin-bottom: 1.2rem;
}

.comment-login-tip i {
    margin-right: 0.5rem;
    font-size: 1rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .comments-item {
        padding: 1rem;
    }
    
    .comments-list {
        min-height: 200px;  /* 确保留言列表有足够高度显示内容 */
    }
    
    .comments-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .comment-input-section {
        padding: 0.8rem;
    }
    
    .comment-textarea {
        min-height: 70px;
        font-size: 0.9rem;
    }
    
    .comment-input-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .comment-submit-btn {
        width: 100%;
        justify-content: center;
    }
    
    .comment-header-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }
    
    .comment-actions {
        align-self: flex-end;
    }
    
    .comment-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
    
}

@media (max-width: 480px) {
    .comments-item {
        padding: 0.8rem;
    }
    
    .comments-list {
        min-height: 150px;  /* 小屏幕确保留言列表有足够高度 */
    }
    
    .comments-header h3 {
        font-size: 1.1rem;
    }
    
    .comment-input-section {
        padding: 0.7rem;
    }
    
    .comment-textarea {
        min-height: 60px;
        padding: 0.7rem;
        font-size: 0.85rem;
    }
    
    .comment-card {
        padding: 0.8rem;
    }
    
    .comment-username {
        font-size: 0.9rem;
    }
    
    .comment-content {
        font-size: 0.9rem;
    }
}

