* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-cream: #FAF8F5;
    --bg-warm: #F5F0E8;
    --text-dark: #3D352A;
    --text-muted: #7A6F5F;
    --accent-terracotta: #C67B5C;
    --accent-sage: #8FA887;
    --accent-gold: #D4A574;
    --card-shadow: 0 4px 20px rgba(61, 53, 42, 0.08);
    --card-hover-shadow: 0 8px 30px rgba(61, 53, 42, 0.12);
}

body {
    font-family: 'Noto Serif SC', serif;
    background: linear-gradient(135deg, var(--bg-cream) 0%, var(--bg-warm) 100%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(ellipse at 20% 20%, rgba(198, 123, 92, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(143, 168, 135, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.main-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* 侧边栏 */
.sidebar {
    width: 320px;
    flex-shrink: 0;
    padding: 30px 24px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(61, 53, 42, 0.08);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-content {
    text-align: center;
}

.avatar-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 18px;
}

.avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-terracotta) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    box-shadow: var(--card-shadow);
    position: relative;
    z-index: 2;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar:hover {
    transform: scale(1.05);
}

.avatar-ring {
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border: 2px solid var(--accent-gold);
    border-radius: 50%;
    opacity: 0.3;
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.05); opacity: 0.6; }
}

.welcome-title {
    font-family: 'ZCOOL XiaoWei', serif;
    font-size: 26px;
    color: var(--text-dark);
    margin-bottom: 6px;
    letter-spacing: 2px;
}

.welcome-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
    letter-spacing: 1px;
}

.sidebar-stats {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-bottom: 16px;
    padding: 14px 0;
    border-top: 1px solid rgba(61, 53, 42, 0.08);
    border-bottom: 1px solid rgba(61, 53, 42, 0.08);
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-family: 'ZCOOL XiaoWei', serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-terracotta);
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* 搜索框 */
.search-container {
    margin: 20px 0;
    position: relative;
    z-index: 100;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    background: white;
    font-family: inherit;
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #C67B5C;
    box-shadow: 0 0 0 4px rgba(198, 123, 92, 0.1);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f8f9fa;
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #f8f9fa;
}

.search-result-title {
    font-size: 14px;
    color: #3D352A;
    margin-bottom: 4px;
}

.search-result-category {
    font-size: 12px;
    color: #7A6F5F;
}

.search-no-results {
    padding: 24px;
    text-align: center;
    color: #7A6F5F;
    font-size: 14px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    padding: 30px 35px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-y: auto;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    flex: 1;
    align-content: center;
}

.content-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 14px;
    padding: 20px 18px;
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.content-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-terracotta), var(--accent-gold), var(--accent-sage));
    transform: scaleX(0);
    transition: transform 0.4s ease;
}

.content-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow);
}

.content-card:hover::before {
    transform: scaleX(1);
}

.card-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.card-cover {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.card-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 10px;
}

.card-count {
    display: inline-block;
    padding: 3px 10px;
    background: linear-gradient(135deg, rgba(198, 123, 92, 0.1), rgba(212, 165, 116, 0.1));
    border-radius: 10px;
    font-size: 12px;
    color: var(--accent-terracotta);
    font-weight: 500;
}

/* 分类详情页 */
.single-category-view {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(198, 123, 92, 0.3);
    border-radius: 18px;
    font-size: 14px;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Serif SC', serif;
    margin-bottom: 20px;
}

.back-btn:hover {
    background: var(--accent-terracotta);
    color: white;
    transform: translateX(-4px);
}

.category-detail-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 28px;
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
}

.detail-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-terracotta) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
}

.detail-info {
    flex: 1;
}

.detail-title {
    font-family: 'ZCOOL XiaoWei', serif;
    font-size: 26px;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.detail-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.detail-badge {
    display: inline-block;
    padding: 5px 14px;
    background: linear-gradient(135deg, var(--accent-terracotta) 0%, var(--accent-gold) 100%);
    color: white;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 500;
}

/* 子分类和文章列表 */
.subcategories-container {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 26px;
    box-shadow: var(--card-shadow);
}

.subcategory {
    margin-bottom: 26px;
}

.subcategory:last-child {
    margin-bottom: 0;
}

.subcategory-title {
    color: var(--text-dark);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 14px;
    padding-left: 10px;
    border-left: 3px solid var(--accent-terracotta);
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.subcategory-title:hover {
    color: var(--accent-terracotta);
}

.toggle-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.toggle-icon.expanded {
    transform: rotate(90deg);
}

.article-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, opacity 0.3s ease-out;
    opacity: 0;
}

.article-list.expanded {
    max-height: none;
    opacity: 1;
    overflow-y: visible;
}

.subcategory-count {
    margin-left: auto;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
}

.load-more-btn {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 10px 16px;
    background: rgba(198, 123, 92, 0.08);
    border: 1px dashed rgba(198, 123, 92, 0.4);
    border-radius: 10px;
    color: var(--accent-terracotta);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.load-more-btn:hover {
    background: rgba(198, 123, 92, 0.15);
    border-style: solid;
}

.search-loading,
.search-hint {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

.article-list-inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.article-item {
    padding: 16px 18px;
    background: rgba(250, 248, 245, 0.6);
    border: 1px solid transparent;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    gap: 14px;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.article-item:hover {
    background: white;
    border-color: var(--accent-terracotta);
    transform: translateX(6px);
    box-shadow: var(--card-hover-shadow);
}

.article-cover {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.article-info {
    flex: 1;
    min-width: 0;
}

.article-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.5;
}

.article-item:hover .article-title {
    color: var(--accent-terracotta);
}

.article-meta {
    display: flex;
    gap: 12px;
    align-items: center;
}

.article-date {
    color: var(--text-muted);
    font-size: 13px;
}

.article-tag {
    background: linear-gradient(135deg, var(--accent-terracotta) 0%, var(--accent-gold) 100%);
    color: white;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

.article-empty {
    background: rgba(250, 248, 245, 0.6);
    border-radius: 12px;
    padding: 26px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.empty-icon {
    font-size: 36px;
    opacity: 0.5;
}

.empty-text {
    color: var(--text-muted);
    font-size: 13px;
}

/* 加载状态 */
.loading-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
}

.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(198, 123, 92, 0.3);
    border-radius: 50%;
    border-top-color: #C67B5C;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: #7A6F5F;
    font-size: 14px;
    margin-left: 10px;
}

/* 二维码 */
.qrcode-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.qrcode-box {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    text-align: center;
}

.qrcode-title {
    font-size: 14px;
    color: #3D352A;
    margin-bottom: 10px;
    font-weight: 600;
}

.qrcode-box img {
    width: 150px;
    height: 150px;
    border-radius: 8px;
}

.mobile-qrcode {
    display: none;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .content-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .main-layout {
        flex-direction: column;
        align-items: stretch;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid rgba(61, 53, 42, 0.08);
        padding: 30px 20px;
    }
    
    .main-content {
        padding: 25px 20px;
        min-height: auto;
    }

    .content-grid {
        grid-template-columns: repeat(2, 1fr);
        align-content: start;
    }
}

@media (max-width: 640px) {
    .main-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        padding: 25px 16px;
    }
    
    .main-content {
        padding: 20px 16px;
        min-height: auto;
    }

    .content-grid {
        grid-template-columns: 1fr;
        gap: 14px;
        align-content: start;
    }
    
    .category-detail-header {
        flex-direction: column;
        text-align: center;
        padding: 22px 16px;
    }

    .sidebar-stats {
        gap: 24px;
    }

    .welcome-title {
        font-size: 24px;
    }

    .card-title {
        font-size: 15px;
    }

    .qrcode-container {
        display: none;
    }

    .mobile-qrcode {
        display: block !important;
        margin-top: 30px;
        text-align: center;
    }
}
