/* =============================================
   Think - 全局样式
   目标：干净、可读、SEO 友好、移动端适配
   ============================================= */

/* ----- 重置 & 基础 ----- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    color: #1f2937;
    background: #f9fafb;
    line-height: 1.7;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; color: #1d4ed8; }

img { max-width: 100%; height: auto; }

/* ----- 容器 ----- */
.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ----- 导航栏 ----- */
.navbar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.navbar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 60px;
}

.navbar-brand {
    font-size: 1.375rem;
    font-weight: 800;
    color: #111827;
    text-decoration: none;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}
.navbar-brand:hover { color: #2563eb; text-decoration: none; }

.navbar-search {
    display: flex;
    flex: 1;
    max-width: 400px;
    background: #f3f4f6;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}
.search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 16px;
    font-size: 0.875rem;
    color: #111827;
    outline: none;
}
.search-btn {
    border: none;
    background: transparent;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1rem;
    color: #6b7280;
}
.search-btn:hover { color: #2563eb; }

.navbar-links { display: flex; gap: 8px; margin-left: auto; flex-shrink: 0; }
.nav-link {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
}
.nav-link:hover { background: #f3f4f6; text-decoration: none; color: #111827; }
.nav-admin { color: #2563eb; }

/* ----- 主体布局 ----- */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 32px;
    padding: 32px 20px;
    align-items: start;
}

.main-content { min-width: 0; }

/* ----- 页面标题 ----- */
.page-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
}

/* ----- 文章卡片网格 ----- */
.article-grid {
    display: grid;
    gap: 20px;
}

.article-list { display: grid; gap: 20px; }

.article-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: box-shadow .2s, transform .2s;
}
.article-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    transform: translateY(-1px);
}

.article-card-body { padding: 20px; }

.article-meta-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.article-date { font-size: 0.8rem; color: #9ca3af; }

.article-title {
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 10px;
}
.article-title a { color: #111827; }
.article-title a:hover { color: #2563eb; text-decoration: none; }

.article-excerpt {
    font-size: 0.9375rem;
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    color: #9ca3af;
    flex-wrap: wrap;
}

.article-author, .article-views { font-size: 0.8rem; color: #9ca3af; }

.read-more {
    margin-left: auto;
    font-size: 0.875rem;
    font-weight: 600;
    color: #2563eb;
}
.read-more:hover { text-decoration: underline; }

/* ----- 标签 ----- */
.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #eff6ff;
    color: #2563eb;
    white-space: nowrap;
}
.tag-category { background: #f0fdf4; color: #15803d; }

/* ----- 文章全文 ----- */
.article-full {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 32px;
}

.breadcrumb {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-bottom: 20px;
}
.breadcrumb a { color: #6b7280; }
.breadcrumb a:hover { color: #2563eb; }

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

.article-full-title {
    font-size: 1.875rem;
    font-weight: 800;
    color: #111827;
    line-height: 1.3;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.article-full-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.875rem;
    color: #6b7280;
    padding: 12px 0;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 16px;
}
.article-full-meta strong { color: #374151; }

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

/* 文章正文 Typography */
.article-body {
    font-size: 1rem;
    line-height: 1.8;
    color: #1f2937;
}
.article-body h1, .article-body h2, .article-body h3,
.article-body h4, .article-body h5, .article-body h6 {
    font-weight: 700;
    color: #111827;
    margin: 1.75em 0 0.75em;
    line-height: 1.3;
}
.article-body h2 { font-size: 1.5rem; border-bottom: 1px solid #e5e7eb; padding-bottom: 8px; }
.article-body h3 { font-size: 1.25rem; }
.article-body p { margin-bottom: 1.25em; }
.article-body ul, .article-body ol { margin: 1em 0 1em 2em; }
.article-body li { margin-bottom: 0.5em; }
.article-body blockquote {
    border-left: 4px solid #2563eb;
    padding: 12px 20px;
    background: #eff6ff;
    border-radius: 0 6px 6px 0;
    margin: 1.5em 0;
    color: #374151;
    font-style: italic;
}
.article-body code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "Fira Code", "JetBrains Mono", monospace;
    font-size: 0.9em;
    color: #dc2626;
}
.article-body pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5em 0;
}
.article-body pre code { background: none; color: inherit; padding: 0; }
.article-body a { color: #2563eb; }
.article-body img { border-radius: 6px; margin: 1em 0; }

.article-share {
    margin-top: 32px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}
.article-share p { font-size: 0.9rem; color: #6b7280; margin-bottom: 10px; }
.share-url {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    background: #fff;
    color: #374151;
    cursor: pointer;
}

/* ----- 侧边栏 ----- */
.sidebar { display: flex; flex-direction: column; gap: 20px; }

.widget {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 20px;
}

.widget-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
}

.widget-list { list-style: none; }
.widget-list li {
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
}
.widget-list li:last-child { border-bottom: none; }
.widget-list a {
    font-size: 0.875rem;
    color: #374151;
    display: block;
}
.widget-list a:hover { color: #2563eb; text-decoration: none; }

.popular-list li {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}
.popular-list .view-count {
    font-size: 0.7rem;
    color: #9ca3af;
    white-space: nowrap;
    padding-top: 2px;
}

.widget-api { background: linear-gradient(135deg, #eff6ff, #f0fdf4); border-color: #bfdbfe; }
.widget-desc { font-size: 0.8rem; color: #374151; margin-bottom: 12px; }
.btn-api {
    display: block;
    text-align: center;
    padding: 8px 16px;
    background: #2563eb;
    color: #fff;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}
.btn-api:hover { background: #1d4ed8; text-decoration: none; color: #fff; }

/* ----- 分页 ----- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}
.page-btn {
    padding: 8px 18px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
}
.page-btn:hover { background: #eff6ff; border-color: #2563eb; color: #2563eb; text-decoration: none; }
.page-info { font-size: 0.875rem; color: #9ca3af; }

/* ----- 搜索页 ----- */
.search-form-main {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}
.search-input-main {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    color: #111827;
    outline: none;
}
.search-input-main:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.btn-primary {
    padding: 12px 24px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}
.btn-primary:hover { background: #1d4ed8; }

.result-count {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 16px;
}

/* ----- 空状态 ----- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
    font-size: 1rem;
}
.empty-state a { color: #2563eb; }

/* ----- 页脚 ----- */
.footer {
    background: #fff;
    border-top: 1px solid #e5e7eb;
    margin-top: 48px;
    padding: 24px 0;
}
.footer-inner {
    text-align: center;
    font-size: 0.875rem;
    color: #9ca3af;
}
.footer-inner a { color: #6b7280; }
.footer-inner a:hover { color: #2563eb; }

/* ----- 响应式 ----- */
@media (max-width: 768px) {
    .main-layout {
        grid-template-columns: 1fr;
        padding: 20px;
        gap: 24px;
    }
    .sidebar { order: -1; }
    .navbar-search { max-width: none; flex: 1; }
    .navbar-links .nav-link { padding: 6px 10px; }
    .article-full { padding: 20px; }
    .article-full-title { font-size: 1.5rem; }
    .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .navbar-brand { font-size: 1.125rem; }
    .article-full-meta { gap: 8px; }
    .search-form-main { flex-direction: column; }
}
