/* =====================================================
   index.css — 前台页面样式
   ===================================================== */

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC",
                 "Microsoft YaHei", sans-serif;
    background-color: #f7f9fc;
    color: #333;
}

.custom-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2.5rem 15px;
}

/* ---------- 文章卡片 ---------- */
.article-card {
    border: none;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04), 0 2px 10px rgba(0, 0, 0, 0.02);
    background: #ffffff;
    margin-bottom: 2.5rem;
    padding: 3rem 2rem !important;
    transition: transform 0.3s ease;
}

.article-title {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.3;
    color: #111827;
    margin-bottom: 2.5rem;
    position: relative;
    padding-bottom: 1.5rem;
}

.article-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    border-radius: 2px;
}

/* 修正 Markdown 内容背景并美化 */
.markdown-body {
    background-color: transparent !important;
    color: #374151 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji" !important;
    font-size: 1.05rem !important;
    line-height: 1.8 !important;
    word-wrap: break-word;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 0.5rem;
    margin-top: 2rem;
    color: #111827;
}

.markdown-body blockquote {
    border-left: 4px solid #e5e7eb;
    color: #6b7280;
    padding: 0 1rem;
    font-style: italic;
}

.markdown-body code {
    background-color: #f3f4f6 !important;
    padding: 0.2rem 0.4rem !important;
    border-radius: 4px !important;
    color: #eb5757 !important;
    font-size: 0.9em !important;
}

.markdown-body pre {
    background-color: #f8fafc !important;
    border-radius: 12px !important;
    padding: 1.25rem !important;
    border: 1px solid #e2e8f0 !important;
}

.markdown-body img {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin: 1.5rem 0;
}

/* ---------- 主卡片 ---------- */
.main-card {
    border: none;
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.06);
    margin-bottom: 1.25rem;
    background: #fff;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.main-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
}

/* ---------- 搜索框 ---------- */
.search-input {
    border-top-left-radius: 50px;
    border-bottom-left-radius: 50px;
    border: 2px solid #eaedf1;
    border-right: none;
    padding-left: 1.5rem;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02) !important;
    font-size: 1.1rem;
    height: auto;
}
.search-input:focus {
    border-color: #0d6efd;
    background-color: #fff;
}
.search-btn {
    border-top-right-radius: 50px;
    border-bottom-right-radius: 50px;
    padding: 0.8rem 2.5rem;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    transition: all 0.3s ease;
}
/* ---------- Markdown Table & List Extensions ---------- */
.markdown-body table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 2rem 0;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

.markdown-body table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #4b5563;
    border-bottom: 1px solid #e5e7eb;
}

.markdown-body table th, .markdown-body table td {
    padding: 0.75rem 1rem;
    border-right: 1px solid #e5e7eb;
}

.markdown-body table tr:last-child td {
    border-bottom: none;
}

.markdown-body table th:last-child, .markdown-body table td:last-child {
    border-right: none;
}

.markdown-body ul, .markdown-body ol {
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.markdown-body li {
    margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
    .article-card {
        padding: 2rem 1.25rem !important;
        border-radius: 16px;
    }
    .article-title {
        font-size: 1.75rem;
    }
}

/* ---------- 数据集导航 ---------- */
.data-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
}
.data-nav .nav-link {
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
}
.data-nav .nav-link:hover {
    background-color: #f1f5f9;
    color: #2563eb;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}
.data-nav .nav-link.disabled {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff !important;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    pointer-events: none;
    padding: 0.5rem 1.5rem;
}

/* ---------- 面包屑 ---------- */
.breadcrumb-container {
    background: transparent;
    padding: 0;
    margin-bottom: 1.5rem;
    font-size: 15px;
}
.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: #94a3b8;
    font-size: 18px;
    vertical-align: middle;
    line-height: 1;
}
.breadcrumb-item a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}
.breadcrumb-item a:hover { color: #1e40af; }

/* ---------- 列表 ---------- */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.list-item-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 1rem 1.5rem;
    border: 1px solid #f1f5f9;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    margin-bottom: 0.5rem;
}

.list-item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(148, 163, 184, 0.15);
    border-color: #dbeafe;
    text-decoration: none;
    color: #2563eb;
}
.icon-wrapper {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #3b82f6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.list-item-card:hover .icon-wrapper {
    transform: scale(1.05);
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}
.list-item-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
}
.list-item-card:hover .list-item-title { color: #2563eb; }
.list-item-path {
    font-size: 0.85rem;
    color: #64748b;
}

/* ---------- 提示框 ---------- */
.custom-alert {
    border-radius: 16px;
    background: linear-gradient(to right, #fffbeb, #fef3c7);
    border: none;
    color: #92400e;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.1);
}

/* ---------- 页脚 ---------- */
.page-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #f1f5f9;
    text-align: center;
    color: #64748b;
}
.page-footer p { font-size: 0.95rem; margin-bottom: 0.5rem; }
.page-footer a {
    color: #94a3b8;
    font-size: 0.85rem;
    transition: color 0.2s;
    text-decoration: none;
}
.page-footer a:hover { color: #64748b; }

/* =====================================================
   文章在线编辑器 — 模态框样式
   ===================================================== */

/* 悬浮编辑按钮 */
.admin-edit-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1050;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 0.7rem 1.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 6px 24px rgba(245,158,11,0.4);
    cursor: pointer;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.admin-edit-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(245,158,11,0.5);
}

/* 编辑器模态框容器 */
.article-editor-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1055;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}
.article-editor-modal-overlay.show {
    display: flex;
}
.article-editor-modal {
    width: 92vw;
    max-width: 1280px;
    height: 88vh;
    background: #1e293b;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(0,0,0,0.5);
    animation: modalSlideIn 0.25s ease;
}
@keyframes modalSlideIn {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* 模态框顶栏 */
.editor-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.2rem;
    background: #0f172a;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
}
.editor-modal-header .modal-title-text {
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.editor-modal-header .modal-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 编辑区 + 预览区 */
.editor-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}
#article-editor-textarea {
    flex: 1;
    resize: none;
    border: none;
    border-right: 1px solid #334155;
    padding: 1.2rem 1.4rem;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.75;
    background: #0f172a;
    color: #e2e8f0;
    outline: none;
}
#article-editor-textarea::placeholder { color: #475569; }
#editor-preview-panel {
    flex: 1;
    overflow-y: auto;
    padding: 1.4rem 1.8rem;
    background: #ffffff !important;
}

/* 操作按钮 */
.editor-save-btn {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border: none;
    color: #fff;
    font-weight: 600;
    padding: 0.4rem 1.3rem;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.875rem;
    cursor: pointer;
}
.editor-save-btn:hover { background: linear-gradient(135deg, #16a34a, #15803d); transform: translateY(-1px); }
.editor-save-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.editor-cancel-btn {
    background: #334155;
    border: none;
    color: #94a3b8;
    font-weight: 600;
    padding: 0.4rem 1.1rem;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.875rem;
    cursor: pointer;
}
.editor-cancel-btn:hover { background: #475569; color: #fff; }
