/* ==================== Reset & Base ==================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #7c3aed;
    --primary-light: #a78bfa;
    --primary-dark: #6d28d9;
    --primary-bg: #f5f3ff;
    --text: #1f2937;
    --text-light: #6b7280;
    --text-lighter: #9ca3af;
    --bg: #f9fafb;
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --container: 1600px;
    --nav-height: 64px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img { max-width: 100%; height: auto; }
ul { list-style: none; }

/* ==================== Navbar ==================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    height: var(--nav-height);
}

.nav-container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    flex-shrink: 0;
}

.logo-icon { font-size: 1.5rem; }
.logo-text { white-space: nowrap; }

/* PC端 Tab 导航 */
.nav-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 16px;
    border-radius: var(--radius);
    color: var(--text-light);
    font-size: 0.875rem;
    transition: all var(--transition);
    white-space: nowrap;
    position: relative;
}

.nav-tab .tab-icon { font-size: 1.25rem; line-height: 1; }
.nav-tab .tab-label { font-size: 0.75rem; font-weight: 500; }

.nav-tab:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.nav-tab.active {
    background: var(--primary-bg);
    color: var(--primary);
    transform: translateY(-2px);
    font-weight: 600;
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

/* 搜索框 */
.nav-search form {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 4px 4px 16px;
    transition: border-color var(--transition);
}

.nav-search form:focus-within {
    border-color: var(--primary-light);
}

.nav-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.875rem;
    width: 160px;
    color: var(--text);
}

.nav-search button {
    border: none;
    background: var(--primary);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: background var(--transition);
}

.nav-search button:hover { background: var(--primary-dark); }

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all var(--transition);
}

.mobile-menu-btn.active span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.mobile-menu-btn.active span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.active span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

/* 移动端菜单 */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition);
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-menu {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: white;
    z-index: 98;
    padding: 16px;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: translateY(-100%);
    transition: transform var(--transition);
}

.mobile-menu.active {
    display: block;
    transform: translateY(0);
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--text);
    font-size: 1rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.mobile-menu-item:hover { background: var(--primary-bg); }

/* ==================== Main Content ==================== */
.main-content {
    max-width: var(--container);
    margin: 0 auto;
    padding: 32px 24px 80px;
}

.content-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 32px;
}

.content-layout-single {
    grid-template-columns: 1fr 300px;
}

/* ==================== Slideshow ==================== */
.slideshow {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    background: #1e293b;
}

.slideshow-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide {
    min-width: 100%;
    position: relative;
    aspect-ratio: 16 / 5;
    overflow: hidden;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.slide-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 32px 32px 28px;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    color: white;
}

.slide-overlay h3 {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.4;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.slide-overlay h3 a {
    color: white;
}

.slide-overlay h3 a:hover {
    color: var(--primary-light);
}

.slide-overlay p {
    font-size: 0.875rem;
    opacity: 0.85;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.slide-badge {
    display: inline-block;
    padding: 3px 10px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.slideshow-dots {
    position: absolute;
    bottom: 12px;
    right: 16px;
    display: flex;
    gap: 6px;
    z-index: 2;
}

.slide-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    padding: 0;
}

.slide-dot.active {
    background: white;
    width: 24px;
    border-radius: 4px;
}

.slideshow-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(8px);
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    z-index: 2;
    opacity: 0;
}

.slideshow:hover .slideshow-arrow {
    opacity: 1;
}

.slideshow-arrow:hover {
    background: rgba(255,255,255,0.35);
}

.slideshow-arrow.prev { left: 12px; }
.slideshow-arrow.next { right: 12px; }

/* ==================== Article Cards ==================== */
.article-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.article-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
    display: flex;
    align-items: stretch;
}

.article-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.article-card-thumb {
    flex-shrink: 0;
    width: 240px;
    min-height: 160px;
    position: relative;
    overflow: hidden;
    background: var(--bg);
}

.article-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
    transition: transform 0.4s ease;
}

.article-card:hover .article-card-thumb img {
    transform: scale(1.05);
}

.article-card-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--text-lighter);
    background: linear-gradient(135deg, var(--primary-bg), #ede9fe);
}

.article-card-body {
    flex: 1;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.article-meta-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 0.8125rem;
    color: var(--text-light);
}

.article-category-badge {
    display: inline-block;
    padding: 2px 10px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.article-date, .article-views { color: var(--text-lighter); }

.article-title {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 8px;
}

.article-title a {
    color: var(--text);
}

.article-title a:hover { color: var(--primary); }

.article-summary {
    color: var(--text-light);
    font-size: 0.9375rem;
    line-height: 1.7;
    margin-bottom: 16px;
}

.article-footer {
    display: flex;
    justify-content: flex-end;
}

.read-more {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary);
}

.read-more:hover { color: var(--primary-dark); }

/* ==================== Article Detail ==================== */
.article-detail {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--text-light);
    margin-bottom: 24px;
}

.breadcrumb .separator { color: var(--text-lighter); }
.breadcrumb .current { color: var(--text); font-weight: 500; }

.article-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.article-detail-title {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 12px;
}

.article-detail-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.875rem;
    color: var(--text-light);
}

.article-detail-meta .meta-category a {
    display: inline-block;
    padding: 2px 12px;
    background: var(--primary-bg);
    border-radius: 12px;
    font-size: 0.8125rem;
}

.article-content {
    font-size: 1rem;
    line-height: 1.85;
    color: var(--text);
}

.article-content h2,
.article-content h3 {
    margin-top: 1.8em;
    margin-bottom: 0.8em;
    font-weight: 600;
}

.article-content p { margin-bottom: 1.2em; }

.article-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 1.5em 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

.article-content code {
    background: var(--primary-bg);
    color: var(--primary-dark);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.875em;
}

.article-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.article-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 12px 20px;
    margin: 1.5em 0;
    background: var(--primary-bg);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-light);
}

.article-content img {
    border-radius: var(--radius-sm);
    margin: 1.5em 0;
}

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

.article-content li { margin-bottom: 0.5em; }

/* 文章标签 */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.tag-item {
    display: inline-block;
    padding: 4px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 0.8125rem;
    color: var(--text-light);
    transition: all var(--transition);
}

.tag-item:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    background: var(--primary-bg);
}

/* 上一篇/下一篇 */
.article-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.article-nav-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    transition: all var(--transition);
}

.article-nav-item:hover {
    background: var(--primary-bg);
}

.article-nav-item.next { text-align: right; }
.article-nav-item.disabled { opacity: 0.4; pointer-events: none; }

.nav-direction { font-size: 0.8125rem; color: var(--text-lighter); }
.nav-title { font-size: 0.9375rem; color: var(--text); font-weight: 500; }

/* ==================== Sidebar ==================== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-widget {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.widget-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-bg);
    position: relative;
}

.widget-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--primary);
}

.widget-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.widget-list li:last-child { border-bottom: none; }

.widget-link {
    flex: 1;
    color: var(--text);
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 8px;
}

.widget-link:hover { color: var(--primary); }

.widget-date { font-size: 0.75rem; color: var(--text-lighter); flex-shrink: 0; }

.widget-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: var(--border);
    color: var(--text-light);
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 8px;
    flex-shrink: 0;
}

.widget-rank.top-1 { background: #fee2e2; color: #dc2626; }
.widget-rank.top-2 { background: #fef3c7; color: #d97706; }
.widget-rank.top-3 { background: #d1fae5; color: #059669; }

.widget-categories li { padding: 8px 0; border-bottom: 1px solid var(--border-light); }
.widget-categories li:last-child { border-bottom: none; }
.widget-categories a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text);
    font-size: 0.875rem;
}

.widget-categories a:hover { color: var(--primary); }

.cat-count {
    display: inline-block;
    padding: 1px 8px;
    background: var(--bg);
    border-radius: 10px;
    font-size: 0.75rem;
    color: var(--text-lighter);
}

.widget-links-list li { padding: 6px 0; }
.widget-links-list a { font-size: 0.875rem; color: var(--text-light); }
.widget-links-list a:hover { color: var(--primary); }

/* ==================== Pagination ==================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 32px;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.875rem;
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.page-btn:hover, .page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-ellipsis { color: var(--text-lighter); padding: 0 4px; }

/* ==================== Empty State ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state p { color: var(--text-light); margin-bottom: 20px; }

.btn-primary {
    display: inline-block;
    padding: 10px 24px;
    background: var(--primary);
    color: white !important;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124,58,237,0.3);
}

/* ==================== List Header ==================== */
.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.list-title { font-size: 1.5rem; font-weight: 700; }
.list-count { font-size: 0.875rem; color: var(--text-light); }

/* ==================== Links Page ==================== */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.link-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all var(--transition);
}

.link-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.link-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.link-name { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.link-url { font-size: 0.8125rem; color: var(--text-lighter); word-break: break-all; }

/* ==================== 404 Page ==================== */
.error-page {
    text-align: center;
    padding: 80px 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.error-code {
    font-size: 6rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 16px;
}

.error-title { font-size: 1.5rem; margin-bottom: 8px; }
.error-desc { color: var(--text-light); margin-bottom: 24px; }

/* ==================== Footer ==================== */
.footer {
    background: white;
    border-top: 1px solid var(--border-light);
    padding: 40px 24px 100px;
}

.footer-container {
    max-width: var(--container);
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 24px;
}

.footer-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 12px; }
.footer-subtitle { font-size: 1rem; font-weight: 600; margin-bottom: 12px; color: var(--text); }
.footer-desc { color: var(--text-light); font-size: 0.875rem; line-height: 1.7; }

.footer-links li { margin-bottom: 8px; }
.footer-links a {
    color: var(--text-light);
    font-size: 0.875rem;
}
.footer-links a:hover { color: var(--primary); }

.footer-bottom {
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
    text-align: center;
}

.footer-bottom p {
    font-size: 0.8125rem;
    color: var(--text-lighter);
    margin-bottom: 4px;
}

.footer-powered { font-size: 0.75rem; }

/* ==================== Mobile Bottom Nav ==================== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--border-light);
    z-index: 100;
    padding: 8px 0;
    padding-bottom: env(safe-area-inset-bottom, 8px);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    color: var(--text-light);
    font-size: 0.6875rem;
    transition: color var(--transition);
}

.mobile-nav-icon { font-size: 1.375rem; line-height: 1; }
.mobile-nav-label { font-weight: 500; }

.mobile-nav-item.active {
    color: var(--primary);
}

.mobile-nav-item.active .mobile-nav-icon {
    transform: scale(1.1);
    transition: transform var(--transition);
}

/* ==================== Responsive ==================== */
@media (max-width: 1024px) {
    .content-layout, .content-layout-single {
        grid-template-columns: 1fr;
    }
    .sidebar { order: 2; }
}

@media (max-width: 768px) {
    .nav-tabs, .nav-search { display: none; }
    .mobile-menu-btn { display: flex; }
    .nav-container { padding: 0 16px; gap: 12px; }
    .logo-text { font-size: 1.1rem; }

    .main-content { padding: 20px 16px 80px; }

    .article-card { flex-direction: column; }
    .article-card-thumb { width: 100%; min-height: 180px; aspect-ratio: 16 / 9; }
    .article-card-body { padding: 16px; }
    .article-detail { padding: 20px; }
    .article-detail-title { font-size: 1.375rem; }

    .article-nav { grid-template-columns: 1fr; }

    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
    .footer { padding-bottom: 80px; }

    .mobile-bottom-nav { display: flex; }

    .pagination { flex-wrap: wrap; }

    .slideshow-arrow { opacity: 1; }
    .slide-overlay { padding: 20px 20px 16px; }
    .slide-overlay h3 { font-size: 1.125rem; }
}

@media (max-width: 480px) {
    .article-detail-title { font-size: 1.25rem; }
    .list-title { font-size: 1.25rem; }
    .error-code { font-size: 4rem; }
}
