/* theme.css - 全局主题变量与基础样式 */
/* ===== 基础重置与变量 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0 !important;
    padding: 0 !important;
    height: 100%;
}

body {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: background-color 0.3s, color 0.3s;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ===== 主题变量 ===== */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #333333;
    --text-secondary: #666666;
    --accent-color: #5e72e4;
    --accent-gradient-from: #5e72e4;
    --accent-gradient-to: #825ee4;
    --border-color: #e9ecef;
    --link-hover-bg: #edf2f7;
    --card-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --error-color: #e53e3e;
    --success-color: #38a169;
}

[data-theme="dark"] {
    --bg-primary: #1a202c;
    --bg-secondary: #2d3748;
    --text-primary: #f7fafc;
    --text-secondary: #cbd5e0;
    --accent-color: #7f9cf5;
    --accent-gradient-from: #667eea;
    --accent-gradient-to: #9f7aea;
    --border-color: #4a5568;
    --link-hover-bg: #4a5568;
    --card-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

[data-theme="cyberpunk"] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a2e;
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e0;
    --accent-color: #00f2ea;
    --accent-gradient-from: #00f2ea;
    --accent-gradient-to: #ff006e;
    --link-hover-bg: #2d3748;
    --border-color: #4a5568;
    --card-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

/* ===== 通用按钮样式 ===== */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-gradient-from), var(--accent-gradient-to));
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary:hover {
    background-color: var(--link-hover-bg);
}

.btn-danger {
    background-color: #e53e3e;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-danger:hover {
    opacity: 0.9;
}

/* ===== 卡片通用样式 ===== */
.content-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 2rem;
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
    background: var(--bg-primary);
    font-size: 0.85rem;
}

.pagination a:hover {
    background-color: var(--link-hover-bg);
}

.pagination .active {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.pagination .disabled {
    color: var(--text-secondary);
    pointer-events: none;
    border-color: var(--border-color);
}

/* ===== 消息提示 ===== */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== 模态框（通用） ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--card-shadow);
    animation: modalSlideIn 0.3s ease;
    color: var(--text-primary);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2, .modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.close {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

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

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

/* ===== 表单元素通用 ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

.form-input, .form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-input:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* ===== 帖子卡片通用样式 ===== */
.post-card {
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    transition: background-color 0.2s;
    background: var(--bg-primary);
    position: relative;
    cursor: pointer;
}

.post-card:hover {
    background-color: var(--link-hover-bg);
}

.post-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.8rem;
}

.post-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    margin-right: 0.8rem;
    flex-shrink: 0;
    overflow: hidden;
    line-height: 0;
}

.post-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-user-info {
    flex: 1;
}

.post-username {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    font-size: 0.9rem;
}

.post-time {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.post-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
    line-height: 1.4;
}

.post-content {
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.8rem;
    max-height: 60px;
    overflow: hidden;
    position: relative;
    font-size: 0.9rem;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.8rem;
}

.post-stats {
    display: flex;
    gap: 1.2rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.post-stat {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
}

.stat-icon {
    width: 16px;
    height: 16px;
    transition: color 0.2s;
}

/* 头像通用样式 */
.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-gradient-from), var(--accent-gradient-to));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.2rem;
    overflow: hidden;
    flex-shrink: 0;
    line-height: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
    .content-card {
        padding: 1.5rem;
    }
    .post-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    .user-avatar {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}