/* ===== 全局样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --border-color: #e0e0e0;
    --sidebar-width-wide: 80%;
    --sidebar-width-narrow: 20%;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --border-color: #333333;
}

/* 隐藏滚动条 */
::-webkit-scrollbar {
    display: none;
}
html {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    transition: var(--transition);
}

/* ===== 电脑端样式 ===== */
.desktop-container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: var(--sidebar-width-wide);
    background: var(--bg-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow: hidden;
}

.sidebar.narrow {
    width: var(--sidebar-width-narrow);
}

.control-bar {
    display: flex;
    padding: 20px;
    gap: 15px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.icon-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.icon-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--text-color);
    transition: var(--transition);
}

.search-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-color);
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--text-color);
    transform: scale(1.02);
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
    overflow-y: auto;
    height: calc(100vh - 80px);
}

.article-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    animation: slideInUp 0.5s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.article-card.selected {
    border: 2px solid var(--text-color);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.1);
}

.article-cover {
    height: 150px;
    overflow: hidden;
    position: relative;
}

.article-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.no-cover {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border-color);
    color: var(--text-color);
    font-weight: bold;
}

.article-info {
    padding: 15px;
}

.article-info h3 {
    margin-bottom: 8px;
    font-size: 1.1em;
}

.summary {
    color: #666;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.content-preview {
    color: #888;
    margin-bottom: 10px;
    font-size: 0.85em;
    line-height: 1.4;
}

.tags {
    margin-bottom: 10px;
}

.tag {
    display: inline-block;
    background: var(--border-color);
    color: var(--text-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    margin-right: 5px;
    margin-bottom: 5px;
}

.stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: #999;
}

.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    height: 100vh;
}

.selected-article h1 {
    margin-bottom: 20px;
    font-size: 2.5em;
}

.article-meta {
    margin-bottom: 30px;
    color: #666;
    font-size: 0.9em;
}

.article-actions {
    margin-top: 30px;
}

.like-btn {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

/* ===== 手机端样式 ===== */
.mobile-container {
    display: none;
}

@media (max-width: 768px) {
    .desktop-container {
        display: none;
    }
    
    .mobile-container {
        display: block;
        height: 100vh;
        overflow: hidden;
    }
    
    .mobile-nav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: var(--bg-color);
        border-bottom: 1px solid var(--border-color);
        z-index: 100;
    }
    
    .mobile-control-bar {
        display: flex;
        padding: 15px;
        gap: 10px;
        align-items: center;
    }
    
    .mobile-search-input {
        flex: 1;
        padding: 8px 12px;
        border: 1px solid var(--border-color);
        border-radius: 6px;
        background: var(--bg-color);
        color: var(--text-color);
    }
    
    .mobile-main {
        margin-top: 70px;
        height: calc(100vh - 70px);
        overflow-y: auto;
        padding: 15px;
    }
    
    .mobile-article-list {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    
    .mobile-article-card {
        display: flex;
        background: var(--bg-color);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 15px;
        cursor: pointer;
        transition: var(--transition);
        animation: slideInRight 0.4s ease forwards;
    }
    
    .mobile-article-card:hover {
        transform: scale(1.02);
    }
    
    .mobile-article-card.selected {
        border-color: var(--text-color);
    }
    
    .mobile-article-cover {
        width: 60px;
        height: 60px;
        margin-right: 15px;
        flex-shrink: 0;
    }
    
    .mobile-article-cover img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 6px;
    }
    
    .mobile-article-info {
        flex: 1;
    }
    
    .mobile-article-info h3 {
        margin-bottom: 5px;
        font-size: 1.1em;
    }
    
    .mobile-summary {
        color: #666;
        margin-bottom: 8px;
        font-size: 0.9em;
    }
    
    .mobile-tags {
        margin-bottom: 8px;
    }
    
    .mobile-article-card .stats {
        justify-content: flex-start;
        gap: 15px;
    }
    
    .mobile-selected-article {
        animation: slideInUp 0.5s ease;
    }
    
    .back-to-list {
        margin-bottom: 20px;
        padding: 8px 15px;
        background: none;
        border: 1px solid var(--border-color);
        border-radius: 6px;
        cursor: pointer;
    }
    
    .mobile-selected-article h1 {
        margin-bottom: 15px;
        font-size: 1.8em;
    }
}

/* Toast UI Editor 样式调整 */
.toastui-editor {
    line-height: 1.6;
}

.toastui-editor h1 { font-size: 2em; margin: 1.5em 0 0.5em; }
.toastui-editor h2 { font-size: 1.5em; margin: 1.2em 0 0.3em; }
.toastui-editor p { margin: 1em 0; }
.toastui-editor code { background: var(--border-color); padding: 2px 4px; border-radius: 4px; }
.toastui-editor pre { background: #f5f5f5; padding: 15px; border-radius: 8px; overflow-x: auto; }
[data-theme="dark"] .toastui-editor pre { background: #2d2d2d; }

/* ===== 动画效果 ===== */
@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.article-card:nth-child(1) { animation-delay: 0.1s; }
.article-card:nth-child(2) { animation-delay: 0.2s; }
.article-card:nth-child(3) { animation-delay: 0.3s; }
.article-card:nth-child(4) { animation-delay: 0.4s; }