/**
 * 文章系统样式 - 重构版
 * 卡片Grid布局 + 高级筛选栏 + 右侧边栏
 */

/* ==================== 页面布局 ==================== */

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding-top: 80px;
    padding-bottom: 2rem;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.main-area {
    min-width: 0;
}

/* ==================== 高级筛选栏 ==================== */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.filter-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-categories {
    flex: 1;
    flex-wrap: wrap;
}

.filter-btn, .sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.filter-btn:hover, .sort-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.filter-btn.active {
    color: white;
    background: var(--primary);
    border-color: var(--primary);
}

.sort-btn.active {
    color: var(--primary);
    background: var(--primary-light);
    border-color: var(--primary);
}

.sort-btn i {
    font-size: 0.75rem;
}

/* 搜索框 */
.filter-search {
    margin-left: auto;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i.fa-search {
    position: absolute;
    left: 0.875rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    pointer-events: none;
}

.search-box input {
    width: 220px;
    padding: 0.5rem 2rem 0.5rem 2.25rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-primary);
    width: 280px;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-clear {
    position: absolute;
    right: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-clear:hover {
    color: var(--text-primary);
}

/* ==================== 文章卡片网格 ==================== */

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.article-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    border-color: transparent;
}

/* 封面区域 */
.card-cover {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 比例 */
    background: var(--bg-secondary);
    overflow: hidden;
}

.card-cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.article-card:hover .card-cover img {
    transform: scale(1.05);
}

/* 文字封面（无图片时） */
.card-cover-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    text-align: center;
}

.card-cover-text::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.card-cover-text-content {
    position: relative;
    z-index: 1;
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* 封面颜色主题 */
.card-cover-text.theme-blue { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.card-cover-text.theme-green { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.card-cover-text.theme-orange { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.card-cover-text.theme-cyan { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.card-cover-text.theme-purple { background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%); }
.card-cover-text.theme-dark { background: linear-gradient(135deg, #2c3e50 0%, #4ca1af 100%); }

/* 阅读时间标签 */
.card-reading-time {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.65);
    color: white;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    backdrop-filter: blur(4px);
}

/* 卡片内容 */
.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-title a {
    color: inherit;
    text-decoration: none;
}

.card-title a:hover {
    color: var(--primary);
}

.card-summary {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.75rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}

.card-tag {
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    color: var(--primary);
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    font-weight: 500;
}

/* 卡片底部 */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.card-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.card-author .avatar-component {
    gap: 0.5rem;
}

.card-author .avatar-wrapper {
    width: 22px;
    height: 22px;
}

.card-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.card-stat i {
    font-size: 0.625rem;
}

/* ==================== 右侧边栏 ==================== */

.right-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 90px;
    height: fit-content;
}

.sidebar-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.sidebar-title i {
    color: var(--primary);
    font-size: 0.875rem;
}

/* 用户资料卡片 */
.user-profile-card .guest-prompt {
    text-align: center;
    padding: 1rem 0;
}

.user-profile-card .guest-prompt p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.user-profile-card .guest-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.user-profile-card .user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.user-profile-card .user-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.user-profile-card .user-details {
    flex: 1;
    min-width: 0;
}

.user-profile-card .user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.user-profile-card .user-bio {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.user-profile-card .user-stats {
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.user-profile-card .stat-item {
    text-align: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.user-profile-card .stat-item.stat-clickable {
    cursor: pointer;
}

.user-profile-card .stat-item.stat-clickable:hover {
    background: var(--primary-light);
}

.user-profile-card .stat-item.stat-clickable:hover .stat-value {
    color: var(--primary);
}

.user-profile-card .stat-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: color var(--transition-fast);
}

.user-profile-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-profile-card .write-btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
}

/* 热门文章 */
.hot-articles {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hot-article-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
    cursor: pointer;
}

.hot-article-item:hover {
    background: var(--bg-secondary);
}

.hot-article-rank {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.hot-article-rank.top-1 { background: #ff6b6b; color: white; }
.hot-article-rank.top-2 { background: #ff9f43; color: white; }
.hot-article-rank.top-3 { background: #feca57; color: white; }

.hot-article-info {
    flex: 1;
    min-width: 0;
}

.hot-article-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.hot-article-meta {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

/* 热门标签 */
.hot-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hot-tag {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.hot-tag:hover {
    color: var(--primary);
    background: var(--primary-light);
}

/* ==================== 加载更多 ==================== */

.load-more {
    text-align: center;
    padding: 2rem 0;
}

/* ==================== 占位符 ==================== */

.loading-placeholder,
.empty-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.loading-placeholder i,
.empty-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

/* ==================== 响应式 ==================== */

@media (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .right-sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-categories {
        order: 1;
    }
    
    .filter-sort {
        order: 2;
        justify-content: flex-start;
    }
    
    .filter-search {
        order: 0;
        margin-left: 0;
        margin-bottom: 0.5rem;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .search-box input:focus {
        width: 100%;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .right-sidebar {
        grid-template-columns: 1fr;
    }
}

/* ==================== 我的文章管理模态框 ==================== */

.my-articles-manager {
    min-height: 300px;
}

.manager-header {
    margin-bottom: 1rem;
}

.manager-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.manager-tab {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.manager-tab:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.manager-tab.active {
    color: var(--primary);
    background: var(--primary-light);
}

.manager-list {
    max-height: 400px;
    overflow-y: auto;
}

.my-article-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition-fast);
}

.my-article-item:hover {
    background: var(--bg-secondary);
}

.my-article-item:last-child {
    border-bottom: none;
}

.my-article-item .article-info {
    flex: 1;
    min-width: 0;
}

.my-article-item .article-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.my-article-item .article-title a {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.my-article-item .article-title a:hover {
    color: var(--primary);
}

.my-article-item .article-status {
    flex-shrink: 0;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
}

.my-article-item .article-status.status-published {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.my-article-item .article-status.status-draft {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.my-article-item .article-status.status-deleted {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.my-article-item .visibility-badge {
    flex-shrink: 0;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.my-article-item .visibility-badge.visibility-logged-in {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.my-article-item .visibility-badge.visibility-private {
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
}

.my-article-item .article-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.my-article-item .article-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.my-article-item .article-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.my-article-item .article-actions .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* 回收站相关样式 */
.my-article-item.deleted-item {
    background: rgba(239, 68, 68, 0.03);
    border-left: 3px solid var(--danger);
}

.my-article-item.deleted-item:hover {
    background: rgba(239, 68, 68, 0.06);
}

.my-article-item.deleted-item .article-title a {
    color: var(--text-muted);
    text-decoration: line-through;
}

.expires-warning {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.expires-warning i {
    font-size: 0.625rem;
}

.btn-success {
    color: #fff;
    background: var(--success);
    border-color: var(--success);
}

.btn-success:hover {
    background: #059669;
    border-color: #059669;
}

/* 回收站标签样式 */
.manager-tab[data-status="deleted"] {
    color: var(--danger);
}

.manager-tab[data-status="deleted"]:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.manager-tab[data-status="deleted"].active {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
}

/* 模态框内的占位符样式调整 */
.my-articles-manager .loading-placeholder,
.my-articles-manager .empty-placeholder {
    padding: 3rem 1rem;
}

.my-articles-manager .loading-placeholder i,
.my-articles-manager .empty-placeholder i {
    font-size: 2rem;
}
