/**
 * 评论样式
 * 
 * @package APYDA_Theme
 */

/* 评论区域基础样式 */
.comments-area {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 评论列表样式 */
.comments-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.comment-item {
    position: relative;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.comment-item:hover {
    border-color: #e5e7eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* 评论头像样式 */
.comment-avatar img {
    transition: transform 0.3s ease;
}

.comment-item:hover .comment-avatar img {
    transform: scale(1.05);
}

/* 评论作者徽章 */
.author-badge {
    animation: fadeIn 0.3s ease;
}

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

/* 评论操作按钮 */
.comment-actions a {
    position: relative;
    transition: all 0.2s ease;
    text-decoration: none;
}

.comment-actions a:hover {
    transform: translateY(-1px);
}

.comment-actions a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: currentColor;
    transition: width 0.3s ease;
}

.comment-actions a:hover::after {
    width: 100%;
}

/* 评论表单样式 */
.comment-form {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    padding: 2rem;
    border: 1px solid #e2e8f0;
}

.comment-form input,
.comment-form textarea {
    transition: all 0.3s ease;
    border: 2px solid #e2e8f0;
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

.comment-form input:hover,
.comment-form textarea:hover {
    border-color: #cbd5e1;
}

/* 提交按钮样式 */
.comment-form .submit {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.comment-form .submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.comment-form .submit:active {
    transform: translateY(0);
}

.comment-form .submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.comment-form .submit:hover::before {
    left: 100%;
}

/* 评论等待审核样式 */
.comment-awaiting-moderation {
    position: relative;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* 评论回复表单 */
.comment-reply-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    animation: slideDown 0.3s ease;
}

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

/* 评论导航 */
.comment-navigation a {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

.comment-navigation a:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 无评论状态 */
.no-comments {
    text-align: center;
    animation: fadeInUp 0.5s ease;
}

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

/* 评论嵌套样式 */
.children {
    margin-left: 2rem;
    margin-top: 1rem;
    padding-left: 1rem;
    border-left: 3px solid #e5e7eb;
    position: relative;
}

.children::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, #3b82f6 0%, #e5e7eb 100%);
    border-radius: 2px;
}

.children .comment-item {
    background: #ffffff;
    border: 1px solid #f3f4f6;
    position: relative;
    overflow: hidden;
}

.children .comment-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #3b82f6, #1d4ed8);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.children .comment-item:hover {
    border-color: #d1d5db;
    transform: translateX(2px);
    transition: all 0.3s ease;
}

.children .comment-item:hover::before {
    opacity: 1;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .comment-form {
        padding: 1.5rem;
    }
    
    .comment-item {
        padding: 1rem;
    }
    
    .comment-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .comment-avatar {
        margin-bottom: 0.75rem;
    }
    
    .comment-text {
        margin-left: 0;
    }
    
    .children {
        margin-left: 1rem;
    }
    
    .comment-form input,
    .comment-form textarea {
        font-size: 16px; /* 防止iOS缩放 */
    }
}

@media (max-width: 480px) {
    .comment-form {
        padding: 1rem;
    }
    
    .comment-item {
        padding: 0.75rem;
    }
    
    .children {
        margin-left: 0.5rem;
        padding-left: 0.5rem;
    }
    
    .comment-metadata {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .comment-actions {
        margin-top: 0.5rem;
    }
}

/* 加载动画 */
.comment-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 评论计数器样式 */
.comments-header h3 {
    position: relative;
    display: inline-block;
}

.comments-header h3::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 60%;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    border-radius: 2px;
}

/* 评论表单标签样式 */
.comment-form label {
    position: relative;
    transition: color 0.3s ease;
}

.comment-form input:focus + label,
.comment-form textarea:focus + label {
    color: #3b82f6;
}

/* 必填字段标记 */
.comment-form .text-red-500 {
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-3px); }
    60% { transform: translateY(-2px); }
}

/* 评论成功提示 */
.comment-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 1px solid #6ee7b7;
    color: #065f46;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    animation: slideInDown 0.5s ease;
}

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

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .comment-item {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .comment-form {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
        border-color: #374151;
    }
    
    .comment-form input,
    .comment-form textarea {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .comment-form input:focus,
    .comment-form textarea:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
    }
}

/* 字符计数器样式 */
.comment-char-counter {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 0.75rem;
    color: #6b7280;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.3s ease;
}

.comment-char-counter.warning {
    color: #f59e0b;
}

.comment-char-counter.danger {
    color: #ef4444;
}

/* 评论预览样式 */
.comment-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.5rem;
    display: none;
}

.comment-preview.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.comment-preview-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.comment-preview-content {
    color: #334155;
    line-height: 1.6;
}

/* 表情符号选择器 */
.emoji-picker {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
    max-width: 280px;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.25rem;
}

.emoji-picker.active {
    display: grid;
    animation: slideUp 0.3s ease;
}

.emoji-picker button {
    padding: 0.5rem;
    border: none;
    background: none;
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.emoji-picker button:hover {
    background: #f1f5f9;
}

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

/* 评论工具栏 */
.comment-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.comment-toolbar button {
    padding: 0.375rem 0.75rem;
    border: none;
    background: white;
    color: #64748b;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
}

.comment-toolbar button:hover {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.comment-toolbar button.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* 评论状态指示器 */
.comment-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
}

.comment-status.pending {
    background: #fef3c7;
    color: #92400e;
}

.comment-status.approved {
    background: #d1fae5;
    color: #065f46;
}

.comment-status.spam {
    background: #fee2e2;
    color: #991b1b;
}

/* 评论回复表单动画 */
.comment-reply-form {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.comment-reply-form.active {
    opacity: 1;
    max-height: 500px;
    margin-top: 1rem;
}

/* 评论点赞功能 */
.comment-like-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border: none;
    background: none;
    color: #6b7280;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.comment-like-btn:hover {
    background: #f3f4f6;
    color: #3b82f6;
}

.comment-like-btn.liked {
    color: #ef4444;
}

.comment-like-btn .like-count {
    font-weight: 500;
}

/* 评论加载骨架屏 */
.comment-skeleton {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    animation: pulse 1.5s ease-in-out infinite;
}

.comment-skeleton-avatar {
    width: 48px;
    height: 48px;
    background: #e2e8f0;
    border-radius: 50%;
    margin-bottom: 1rem;
}

.comment-skeleton-line {
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.comment-skeleton-line.short {
    width: 60%;
}

.comment-skeleton-line.medium {
    width: 80%;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}