/**
 * RedCMS 前台样式
 */

:root {
    --primary: #e74c3c;
    --primary-dark: #c0392b;
    --text: #333;
    --text-muted: #666;
    --text-light: #999;
    --bg: #f5f7fa;
    --white: #fff;
    --border: #e8e8e8;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部导航 */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: bold;
    color: var(--primary);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
}

.nav {
    display: flex;
    gap: 32px;
}

.nav a {
    color: var(--text-muted);
    font-size: 15px;
    transition: color 0.2s;
}

.nav a:hover,
.nav a.active {
    color: var(--primary);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-right .btn {
    padding: 8px 20px;
}

/* 主内容区 */
.main-content {
    padding: 32px 0;
    min-height: calc(100vh - 200px);
}

/* 首页布局 */
.home-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
}

/* 侧边栏 */
.sidebar {
    position: sticky;
    top: 88px;
    height: fit-content;
}

.sidebar-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.sidebar-card h3 {
    font-size: 16px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* 栏目列表 */
.category-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-list a {
    display: block;
    padding: 10px 14px;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.category-list a:hover {
    background: var(--bg);
    color: var(--text);
}

.category-list a.active {
    background: var(--primary);
    color: #fff;
}

/* 文章列表 */
.article-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.article-item {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.article-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.article-thumb {
    width: 220px;
    height: 150px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.article-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.article-category {
    display: inline-block;
    padding: 4px 10px;
    background: var(--primary);
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 10px;
    width: fit-content;
}

.article-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.article-excerpt {
    color: var(--text-muted);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.article-meta {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--text-light);
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 文章详情页 */
.article-detail {
    max-width: 800px;
    margin: 0 auto;
}

.article-cover {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 30px;
}

.article-header {
    margin-bottom: 30px;
}

.article-header h1 {
    font-size: 32px;
    font-weight: bold;
    line-height: 1.4;
    margin-bottom: 20px;
}

.article-info {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

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

.article-author-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
}

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

.article-author-name {
    font-weight: 500;
    color: var(--text);
}

.article-time {
    font-size: 13px;
    color: var(--text-light);
}

.article-summary {
    padding: 20px;
    background: var(--bg);
    border-left: 4px solid var(--primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 24px 0;
    color: var(--text-muted);
}

.article-content {
    font-size: 16px;
    line-height: 1.9;
    color: var(--text);
}

.article-content p {
    margin-bottom: 20px;
}

.article-content h2 {
    margin: 30px 0 20px;
    font-size: 24px;
}

.article-content img {
    max-width: 100%;
    border-radius: var(--radius-sm);
}

.article-tags {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
}

.article-tag {
    padding: 6px 12px;
    background: var(--bg);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

/* 评论区 */
.comments-section {
    margin-top: 50px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.comments-title {
    font-size: 20px;
    margin-bottom: 24px;
}

.comment-form {
    margin-bottom: 30px;
}

.comment-form textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    resize: vertical;
    margin-bottom: 12px;
    font-family: inherit;
    font-size: 14px;
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment-item {
    display: flex;
    gap: 15px;
}

.comment-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 16px;
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.comment-author {
    font-weight: 500;
    color: var(--text);
}

.comment-time {
    font-size: 13px;
    color: var(--text-light);
}

.comment-content {
    color: var(--text);
    line-height: 1.6;
}

/* 用户中心 */
.profile-header {
    display: flex;
    gap: 30px;
    padding: 30px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 36px;
    font-weight: bold;
    flex-shrink: 0;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.profile-info h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.profile-bio {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.profile-stats {
    display: flex;
    gap: 40px;
}

.profile-stat {
    text-align: center;
}

.profile-stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--text);
}

.profile-stat-label {
    font-size: 13px;
    color: var(--text-light);
}

/* 表单 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

textarea.form-control {
    min-height: 150px;
    resize: vertical;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-secondary:hover {
    background: var(--border);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* 搜索框 */
.search-box {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
}

.search-box input {
    flex: 1;
}

/* 登录注册页 */
.auth-container {
    max-width: 400px;
    margin: 60px auto;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
}

.auth-title {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 30px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
}

/* 底部 */
.footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 30px 0;
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    margin-top: 60px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

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

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
}

.pagination a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* 响应式 */
@media (max-width: 968px) {
    .home-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
    }
    
    .article-item {
        flex-direction: column;
    }
    
    .article-thumb {
        width: 100%;
        height: 200px;
    }
}

@media (max-width: 768px) {
    .nav {
        display: none;
    }
    
    .header-inner {
        justify-content: space-between;
    }
    
    .article-header h1 {
        font-size: 24px;
    }
    
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-avatar {
        margin: 0 auto;
    }
    
    .profile-stats {
        justify-content: center;
    }
}

/* 工具类 */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* =============================================
   移动端响应式样式
   ============================================= */

/* 平板和手机断点 */
@media screen and (max-width: 1024px) {
    .container {
        padding: 0 15px;
    }
    
    .nav {
        gap: 20px;
    }
    
    .article-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .content-with-sidebar {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        margin-top: 30px;
    }
    
    .pricing-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .header-inner {
        height: 56px;
    }
    
    .logo {
        font-size: 18px;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        flex-direction: column;
        gap: 0;
        padding: 10px 0;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
    
    .nav.show {
        display: flex;
    }
    
    .nav a {
        display: block;
        padding: 12px 20px;
        color: var(--text);
    }
    
    .mobile-menu-btn {
        display: flex !important;
    }
    
    .hero {
        padding: 60px 0;
    }
    
    .hero h1 {
        font-size: 28px;
    }
    
    .hero p {
        font-size: 16px;
    }
    
    .hero-buttons {
        flex-direction: column;
    }
    
    .hero-buttons .btn {
        width: 100%;
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .feature-card {
        padding: 25px 20px;
    }
    
    .article-grid {
        grid-template-columns: 1fr;
    }
    
    .article-thumb {
        width: 100%;
        height: 180px;
    }
    
    .auth-container {
        padding: 30px 20px;
    }
    
    .auth-card {
        padding: 25px 20px;
    }
    
    .pricing-grid {
        grid-template-columns: 1fr;
    }
    
    .pricing-card {
        padding: 25px 20px;
    }
    
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .footer {
        padding: 40px 0 20px;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

@media screen and (max-width: 480px) {
    .container {
        padding: 0 12px;
    }
    
    .logo span:last-child {
        display: none;
    }
    
    .hero h1 {
        font-size: 24px;
    }
    
    .stats-item {
        padding: 15px;
    }
    
    .stats-number {
        font-size: 28px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .pricing-card {
        padding: 20px 15px;
    }
    
    .price-amount {
        font-size: 32px;
    }
}

@media (hover: none) and (pointer: coarse) {
    a:active,
    .btn:active {
        opacity: 0.8;
    }
    
    .nav a,
    .btn,
    .form-control {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    .header,
    .footer,
    .sidebar,
    .share-buttons {
        display: none !important;
    }
}
