/* article.css - 文章页特有样式 */

/* 主布局 */
.main-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* 目录侧边栏 */
.toc-sidebar {
    width: 250px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.toc-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.toc-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin: 6px 0;
}

.toc-list a {
    display: block;
    font-size: 13px;
    color: #666;
    text-decoration: none;
    padding: 4px 0;
    border-left: 2px solid transparent;
    padding-left: 10px;
    transition: all 0.2s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toc-list a:hover {
    color: #07c160;
    border-left-color: #07c160;
}

.toc-list a.active {
    color: #07c160;
    border-left-color: #07c160;
    font-weight: 500;
}

.toc-list .toc-h2 { padding-left: 10px; }
.toc-list .toc-h3 { padding-left: 22px; font-size: 12px; }

.article-list {
    counter-reset: article-counter;
}

.article-list li {
    counter-increment: article-counter;
}

.article-list a {
    padding-left: 8px;
}

.article-list a::before {
    content: counter(article-counter) ". ";
    color: #999;
    font-size: 12px;
}

/* 内容区域 */
.content-area {
    flex: 1;
    min-width: 0;
}

/* 文章头部 */
.article-header {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.article-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.repost-thoughts {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-left: 4px solid #07c160;
    color: #444;
}

.repost-thoughts-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.repost-thoughts-title {
    display: inline-block;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    color: inherit;
    line-height: 1.75;
}

.repost-thoughts-text {
    font-size: 14px;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
}

.article-meta {
    font-size: 14px;
    color: #888;
}

.article-meta span {
    margin-right: 20px;
}

.article-url {
    font-size: 12px;
    color: #999;
    word-break: break-all;
    margin-top: 10px;
}

.article-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.article-url a {
    color: #07c160;
}

/* 区块 */
.section {
    margin-bottom: 15px;
}

.section-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 字体控制 */
.font-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

.font-btn {
    width: 32px;
    height: 28px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
}

.font-btn:hover {
    background: #07c160;
    color: white;
    border-color: #07c160;
}

.font-btn:active {
    transform: scale(0.95);
}

.font-size-display {
    min-width: 28px;
    text-align: center;
    font-size: 12px;
    color: #888;
}

/* 摘要输入 */
.summary-textarea {
    width: 100%;
    height: 80px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

.summary-textarea:focus {
    outline: none;
    border-color: #07c160;
}

.char-count {
    font-size: 12px;
    color: #888;
    text-align: right;
    margin-top: 5px;
}

/* 标签区 */
.tags-section {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.add-tag {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.add-tag select {
    padding: 4px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

/* Markdown 内容 */
.markdown-content {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    font-size: 15px;
    line-height: 1.8;
}

.markdown-content h1, .markdown-content h2, .markdown-content h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: #1a1a1a;
}

.markdown-content h1 { font-size: 1.6em; }
.markdown-content h2 { font-size: 1.4em; }
.markdown-content h3 { font-size: 1.2em; }
.markdown-content p { margin: 1em 0; }

.markdown-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 1em 0;
}

.markdown-content blockquote {
    border-left: 4px solid #07c160;
    padding-left: 16px;
    margin: 1em 0;
    color: #666;
    background: #f9f9f9;
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
}

.markdown-content code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

.markdown-content pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1em 0;
}

.markdown-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.markdown-content ul, .markdown-content ol {
    padding-left: 2em;
    margin: 1em 0;
}

.markdown-content li { margin: 0.5em 0; }

.markdown-content a {
    color: #07c160;
    text-decoration: none;
}

.markdown-content a:hover { text-decoration: underline; }

.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

.markdown-content th, .markdown-content td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}

.markdown-content th { background: #f5f5f5; }

/* 操作栏 */
.actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* 回到顶部按钮 */
.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #07c160;
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
}

.scroll-top-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.scroll-top-btn:hover {
    background: #06ae56;
    transform: scale(1.1);
}

/* 手机端文章列表浮动按钮 */
.mobile-list-btn {
    display: none;
    position: fixed;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(24, 144, 255, 0.9);
    backdrop-filter: blur(8px);
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(24, 144, 255, 0.35);
    z-index: 1000;
    transition: transform 0.2s, box-shadow 0.2s;
}

.mobile-list-btn:active {
    transform: scale(0.9);
}

/* 手机端文章列表弹框 */
.mobile-list-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 10000;
    align-items: flex-end;
    justify-content: center;
}

.mobile-list-box {
    background: white;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.mobile-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    position: relative;
}

.mobile-list-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
}

.mobile-list-header button {
    background: #f0f0f0;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 16px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.mobile-list-header button:active {
    background: #e0e0e0;
}

.mobile-list-items {
    list-style: none;
    padding: 0 0 env(safe-area-inset-bottom, 20px);
    margin: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    counter-reset: ml-counter;
}

.mobile-list-items li {
    counter-increment: ml-counter;
}

.mobile-list-items a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    color: #333;
    text-decoration: none;
    font-size: 15px;
    line-height: 1.4;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
}

.mobile-list-items a::before {
    content: counter(ml-counter);
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #f0f0f0;
    color: #999;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-list-items a.active {
    color: #07c160;
    font-weight: 500;
    background: linear-gradient(135deg, #f0faf5, #e8f8ee);
}

.mobile-list-items a.active::before {
    background: #07c160;
    color: white;
}

.mobile-list-items a:active {
    background: #f5f5f5;
}

/* 响应式 */
@media (max-width: 900px) {
    .main-layout { flex-direction: column; }
    .toc-sidebar { width: 100%; position: static; max-height: none; }
}

@media (max-width: 600px) {
    .mobile-list-btn { display: flex; align-items: center; justify-content: center; }
    .scroll-top-btn { bottom: 24px; right: 16px; width: 40px; height: 40px; font-size: 18px; }
    body { padding: 0; background: white; }
    .container { padding: 0; }
    .card { padding: 4px !important; border-radius: 0; margin-bottom: 0; box-shadow: none; }
    .article-header { padding-bottom: 6px; margin-bottom: 6px; }
    .article-title { font-size: 17px; }
    .markdown-content { padding: 4px 14px !important; font-size: 14px; line-height: 1.7; border: none; background: transparent; }
    .markdown-content blockquote { padding: 8px 10px; margin: 0.5em 0; }
    .markdown-content img { margin: 0.5em 0; }
    .toc-sidebar { display: none; }
    .font-controls { margin-left: 10px; }
    .font-btn { width: 28px; height: 24px; font-size: 12px; }
    .font-size-display { min-width: 22px; font-size: 11px; }
    .nav { gap: 12px; font-size: 14px; margin-bottom: 6px; padding: 6px 4px; background: #f5f5f5; }
    .article-meta { font-size: 12px; }
    .article-meta span { display: block; margin-bottom: 4px; margin-right: 0; }
    .article-url { font-size: 11px; }
    .section { margin-bottom: 6px; }
    .section-title { font-size: 13px; margin-bottom: 4px; }
}
