/* ===== 全局样式 ===== */
:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #f59e0b;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-dark: #1e293b;
    --text-gray: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --radius: 12px;
    --radius-sm: 8px;
}

/* 黑暗模式 */
[data-theme="dark"] {
    --primary: #818cf8;
    --primary-light: #a5b4fc;
    --primary-dark: #6366f1;
    --secondary: #fbbf24;
    --bg-light: #1e293b;
    --bg-white: #0f172a;
    --text-dark: #f8fafc;
    --text-gray: #cbd5e1;
    --text-light: #64748b;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --gradient: linear-gradient(135deg, #4c1d95 0%, #5b21b6 50%, #7c3aed 100%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Noto Sans SC', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* 英文字体 */
[data-lang="en"] body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ===== 导航栏 ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-white);
    box-shadow: var(--shadow);
    z-index: 1000;
    height: 70px;
}
.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-dark);
}
.brand-icon { font-size: 1.8rem; }
.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}
.nav-menu a {
    text-decoration: none;
    color: var(--text-gray);
    font-weight: 500;
    padding: 8px 0;
    position: relative;
    transition: color 0.3s;
}
.nav-menu a.active,
.nav-menu a:hover {
    color: var(--primary);
}
.nav-menu a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
}
.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}
.theme-toggle {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-white);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}
.theme-toggle:hover {
    background: var(--bg-light);
}
.language-selector {
    position: relative;
}
.lang-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-dark);
}
.lang-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    list-style: none;
    min-width: 120px;
    display: none;
    margin-top: 5px;
}
.lang-menu.show { display: block; }
.lang-menu li {
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s;
}
.lang-menu li:hover { background: var(--bg-light); }
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}
.menu-toggle span {
    width: 25px;
    height: 3px;
    background: var(--text-dark);
    border-radius: 2px;
}

/* ===== Hero Section ===== */
.hero {
    padding: 140px 0 80px;
    background: var(--gradient);
    position: relative;
    overflow: hidden;
    text-align: center;
    color: white;
}
.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}
.hero .container { position: relative; z-index: 1; }
.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}
.hero-subtitle {
    font-size: 1.3rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}
.hero-desc {
    font-size: 1rem;
    opacity: 0.8;
    max-width: 600px;
    margin: 0 auto 2rem;
}
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 2rem;
}
.stat { text-align: center; }
.stat-num {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--secondary);
}
.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}
.hero-btns {
    display: flex;
    justify-content: center;
    gap: 1rem;
}
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}
.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}
.btn-secondary {
    background: var(--bg-white);
    color: var(--text-dark);
    border: 2px solid var(--border);
}
.btn-secondary:hover {
    background: var(--bg-light);
    transform: translateY(-2px);
}

/* ===== 筛选栏 ===== */
.showcase { padding: 60px 0; }
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}
.filter-item {
    display: flex;
    align-items: center;
    gap: 10px;
}
.filter-item label {
    color: var(--text-gray);
    font-weight: 500;
}
.filter-item select {
    padding: 10px 35px 10px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    font-size: 0.95rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.search-box {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-white);
}
.search-box input {
    padding: 10px 15px;
    border: none;
    outline: none;
    font-size: 0.95rem;
    width: 200px;
}
.search-btn {
    padding: 10px 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
}

/* ===== 卡片网格 ===== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    position: relative;
}
.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}
.card-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--primary);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 10;
}
.card-img {
    width: 100%;
    height: 220px;
    overflow: hidden;
    position: relative;
}
.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.card:hover .card-img img {
    transform: scale(1.05);
}
.card-body {
    padding: 1.5rem;
}
.card-body h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}
.card-author {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}
.card-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 1rem;
}
.card-tags span {
    padding: 4px 12px;
    background: var(--bg-light);
    border: 1px solid var(--primary-light);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}
.card-actions {
    display: flex;
    gap: 10px;
}
.btn-sm {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.btn-sm:hover {
    background: var(--bg-light);
    border-color: var(--primary-light);
}
.btn-view { border-color: var(--primary-light); color: var(--primary); }

/* ===== 加载更多 ===== */
.load-more {
    text-align: center;
    margin-top: 3rem;
}
.btn-load-more {
    background: var(--primary);
    color: white;
    padding: 14px 40px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-load-more:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ===== 关于 & 渠道 ===== */
.about, .channels {
    padding: 60px 0;
}
.about { background: var(--bg-white); }
.section-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: var(--text-dark);
}
.about-grid, .channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}
.about-card, .channel-card {
    background: var(--bg-light);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    transition: all 0.3s;
}
.about-card:hover, .channel-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}
.about-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}
.about-card h3, .channel-card h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}
.about-card p {
    color: var(--text-gray);
    line-height: 1.7;
}
.about-card ul, .channel-card ul {
    list-style: none;
    text-align: left;
}
.about-card li, .channel-card li {
    padding: 8px 0;
    color: var(--text-gray);
}
.channel-card { background: var(--bg-white); border: 1px solid var(--border); }
.channel-card a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}
.channel-card a:hover { color: var(--primary-dark); text-decoration: underline; }

/* 渠道链接样式美化 */
.channel-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}
.channel-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    text-align: left;
}
.channel-link:not(.offline):hover {
    transform: translateX(5px);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.05) 0%, rgba(99, 102, 241, 0.05) 100%);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
}
.channel-link.offline {
    cursor: default;
    opacity: 0.9;
}
.channel-icon {
    font-size: 2rem;
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%);
    border-radius: 10px;
    transition: all 0.3s ease;
}
.channel-link:not(.offline):hover .channel-icon {
    transform: scale(1.1) rotate(5deg);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2) 0%, rgba(99, 102, 241, 0.2) 100%);
}
.channel-info {
    flex: 1;
    min-width: 0;
}
.channel-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
    word-break: break-all;
}
.channel-desc {
    font-size: 0.875rem;
    color: var(--text-gray);
    line-height: 1.4;
}

/* 移除旧的ul样式 */
.channel-card ul {
    display: none;
}

/* ===== Footer ===== */
.footer {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    color: white;
    text-align: center;
    padding: 2rem;
}
.footer p {
    opacity: 0.8;
    margin: 5px 0;
}

/* ===== 返回顶部 ===== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 999;
}
.back-to-top.show {
    opacity: 1;
    visibility: visible;
}
.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
}

/* ===== 模态框 ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}
.modal.show { display: flex; }
.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    position: relative;
}
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    background: var(--bg-light);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
}
.modal-content img {
    width: 100%;
    display: block;
}
.modal-info {
    padding: 1.5rem;
}
.modal-info h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}
.modal-info p {
    color: var(--text-gray);
    line-height: 1.8;
    margin-bottom: 1rem;
    background: var(--bg-light);
    padding: 1rem;
    border-radius: var(--radius-sm);
}
.btn-copy-prompt {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
}
.btn-copy-prompt:hover { background: var(--primary-dark); }

/* ===== 投稿部分 ===== */
.contribute { padding: var(--section-padding); background: var(--bg-light); }
.contribute-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}
.contribute-card {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.contribute-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}
.contribute-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    text-align: center;
}
.contribute-card h3 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    text-align: center;
}
.contribute-card ul { list-style: none; }
.contribute-card li {
    padding: 0.75rem 0;
    position: relative;
    padding-left: 1.5rem;
    border-bottom: 1px solid var(--border);
}
.contribute-card li:last-child { border-bottom: none; }
.contribute-card li::before {
    content: "📝";
    position: absolute;
    left: 0;
    color: var(--secondary);
}

.contribute-methods {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.method {
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
}
.method h4 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}
.method p {
    color: var(--text-gray);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.template-code {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
}
.template-code pre {
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-dark);
    white-space: pre-wrap;
    word-wrap: break-word;
}
.btn-copy-template {
    width: 100%;
    justify-content: center;
}
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    text-align: center;
}
.btn-outline:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* 分组选择器样式 */
select optgroup {
    font-weight: 600;
    color: var(--primary);
    background: var(--bg-light);
}

select optgroup option {
    font-weight: normal;
    color: var(--text-dark);
    padding-left: 1rem;
}

/* 案例卡片的悬停效果增强 */
.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.card-img img {
    transition: transform 0.3s ease;
}

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

/* 标签样式优化 */
.card-tags span {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    margin: 2px;
    display: inline-block;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .nav-menu, .nav-actions { display: none; }
    .menu-toggle { display: flex; }
    .nav-menu.show {
        display: flex;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--bg-white);
        flex-direction: column;
        padding: 20px;
        box-shadow: var(--shadow);
        gap: 0;
    }
    .nav-menu.show li { padding: 15px 0; border-bottom: 1px solid var(--border); }
    .hero-title { font-size: 2rem; }
    .hero-stats { gap: 1.5rem; }
    .stat-num { font-size: 1.8rem; }
    .hero-btns { flex-direction: column; align-items: center; }
    .filter-bar { flex-direction: column; gap: 1rem; }
    .card-grid { grid-template-columns: 1fr; }
    .channel-link {
        padding: 0.875rem;
        gap: 0.75rem;
    }
    .channel-icon {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    .channel-name {
        font-size: 0.9rem;
    }
    .channel-desc {
        font-size: 0.8rem;
    }
}

/* ===== 分页样式 ===== */
.pagination {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg-white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pagination-info {
    text-align: center;
    color: var(--text-gray);
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination-per-page {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.pagination-per-page select {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    color: var(--text-dark);
    font-size: 0.9rem;
}

.pagination-pages {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

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

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

.page-dots {
    display: flex;
    align-items: center;
    color: var(--text-gray);
    font-size: 1.2rem;
    padding: 0 0.5rem;
}

.btn-page {
    padding: 0.5rem 1rem;
    background: var(--bg-white);
    color: var(--text-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .pagination {
        padding: 1rem;
    }

    .pagination-controls {
        flex-direction: column;
        gap: 1rem;
    }

    .pagination-pages {
        max-width: 100%;
        overflow-x: auto;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .pagination-info {
        font-size: 0.8rem;
    }

    .page-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .btn-page {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}
}