/* ============================
   萌百科 MoeWiki - 主样式
   ============================ */

/* ===== CSS 变量 ===== */
:root {
    --primary: #ff6b9d;
    --primary-light: #ffa0c4;
    --primary-dark: #d44a7a;
    --secondary: #7c5cff;
    --accent: #00d4ff;
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #f87171;

    --bg-main: #fef6ff;
    --bg-card: #ffffff;
    --bg-sidebar: #fff0f7;
    --bg-overlay: rgba(254, 246, 255, 0.95);

    --text-primary: #2d1b36;
    --text-secondary: #6b5876;
    --text-muted: #a896b0;
    --text-inverse: #ffffff;

    --border: #f0d4e8;
    --border-light: #fce8f3;

    --shadow-sm: 0 2px 8px rgba(255, 107, 157, 0.08);
    --shadow-md: 0 8px 24px rgba(255, 107, 157, 0.12);
    --shadow-lg: 0 16px 48px rgba(255, 107, 157, 0.16);
    --shadow-glow: 0 0 30px rgba(255, 107, 157, 0.25);

    --gradient-hero: linear-gradient(135deg, #ff6b9d 0%, #7c5cff 50%, #00d4ff 100%);
    --gradient-card: linear-gradient(145deg, #fff5f9 0%, #f0e6ff 100%);
    --gradient-dark: linear-gradient(135deg, #1a0e2e 0%, #2d1b4e 100%);
    --gradient-pink: linear-gradient(135deg, #ff6b9d 0%, #ff9ec6 100%);
    --gradient-purple: linear-gradient(135deg, #7c5cff 0%, #a78bfa 100%);
    --gradient-blue: linear-gradient(135deg, #00d4ff 0%, #60a5fa 100%);

    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 9999px;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);

    --font-main: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    --header-height: 70px;
    --container-width: 1200px;
}

/* ===== 暗色主题 ===== */
[data-theme="dark"] {
    --bg-main: #0f0820;
    --bg-card: #1a1035;
    --bg-sidebar: #150d2a;
    --bg-overlay: rgba(15, 8, 32, 0.95);
    --text-primary: #f0e6ff;
    --text-secondary: #c4b0d6;
    --text-muted: #7a6890;
    --border: #2d1b4e;
    --border-light: #231540;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(124, 92, 255, 0.3);
    --gradient-card: linear-gradient(145deg, #1a1035 0%, #150d2a 100%);
}

/* ===== 基础重置 ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-main);
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: var(--transition);
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== 粒子背景 ===== */
#particles-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ===== 顶部导航 ===== */
#main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-overlay);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

#main-header.scrolled {
    box-shadow: var(--shadow-md);
}

.header-inner {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 32px;
    animation: float 3s ease-in-out infinite;
}

.logo-text {
    font-size: 22px;
    font-weight: 900;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.logo-sub {
    font-size: 11px;
    font-weight: 400;
    display: block;
    letter-spacing: 3px;
    -webkit-text-fill-color: var(--text-muted);
    text-transform: uppercase;
}

/* 导航链接 */
#main-nav {
    display: flex;
    gap: 4px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 10px 18px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--gradient-hero);
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary);
    background: rgba(255, 107, 157, 0.06);
}

.nav-link.active {
    color: var(--primary);
    font-weight: 700;
}

.nav-link.active::after {
    width: 50%;
}

.nav-icon {
    margin-right: 4px;
    font-size: 16px;
}

/* 头部按钮 */
.header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-icon {
    width: 38px;
    height: 38px;
    border: 1.5px solid var(--border);
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    border-color: var(--primary);
    transform: scale(1.08);
    box-shadow: var(--shadow-sm);
}

#mobile-menu-btn {
    display: none;
}

/* 搜索面板 */
.search-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
}

.search-panel.open {
    max-height: 400px;
}

.search-inner {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    gap: 12px;
}

#search-input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

#search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 107, 157, 0.1);
}

#search-close {
    border: none;
}

.search-results {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 24px 16px;
}

.search-result-item {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-result-item:hover {
    background: var(--gradient-card);
}

.search-result-item .result-icon {
    font-size: 24px;
}

.search-result-item .result-title {
    font-weight: 600;
    font-size: 14px;
}

.search-result-item .result-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== 主内容区 ===== */
#app-content {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - var(--header-height));
    padding-top: var(--header-height);
}

/* 加载动画 */
#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    text-align: center;
}

.loader-icon {
    font-size: 64px;
    animation: float 2s ease-in-out infinite;
    margin-bottom: 24px;
}

.loader-bar {
    width: 200px;
    height: 4px;
    background: var(--border);
    border-radius: var(--radius-full);
    margin: 0 auto 16px;
    overflow: hidden;
}

.loader-bar-inner {
    width: 40%;
    height: 100%;
    background: var(--gradient-hero);
    border-radius: var(--radius-full);
    animation: loaderSlide 1.2s ease-in-out infinite;
}

@keyframes loaderSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

.loader-text {
    color: var(--text-muted);
    font-size: 14px;
}

/* 回到顶部 */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--primary);
    font-size: 20px;
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

#back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

#back-to-top:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-3px);
}

/* ===== 页脚 ===== */
#main-footer {
    position: relative;
    z-index: 1;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    margin-top: 80px;
}

.footer-wave {
    position: absolute;
    top: -79px;
    left: 0;
    right: 0;
    height: 80px;
    overflow: hidden;
}

.footer-wave svg {
    width: 100%;
    height: 100%;
}

.footer-inner {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 60px 24px 32px;
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 40px;
}

.footer-col h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.footer-about p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 20px;
}

.footer-stats {
    display: flex;
    gap: 24px;
}

.stat-item {
    text-align: center;
}

.stat-num {
    display: block;
    font-size: 20px;
    font-weight: 900;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
    display: inline-block;
}

.footer-col ul li a:hover {
    color: var(--primary);
    transform: translateX(4px);
}

/* 标签云 */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    padding: 5px 14px;
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.tag:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: scale(1.05);
}

/* 社交链接 */
.social-links {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.social-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--gradient-card);
    border: 1px solid var(--border);
    text-decoration: none;
    font-size: 18px;
    transition: var(--transition);
}

.social-icon:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.footer-contact {
    font-size: 13px;
    color: var(--text-muted);
}

.footer-bottom {
    text-align: center;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
}

.footer-bottom a {
    color: var(--text-muted);
}

.footer-bottom a:hover {
    color: var(--primary);
}

/* ===== 通用组件 ===== */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
}

.section-title {
    text-align: center;
    margin-bottom: 48px;
}

.section-title h2 {
    font-size: 32px;
    font-weight: 900;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.section-title p {
    color: var(--text-muted);
    font-size: 15px;
}

.section-title .title-decoration {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
}

.title-decoration .line {
    width: 60px;
    height: 2px;
    background: var(--gradient-hero);
    border-radius: var(--radius-full);
}

.title-decoration .dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

/* 卡片 */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
    overflow: hidden;
    position: relative;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-hero);
    transform: scaleX(0);
    transition: var(--transition);
    transform-origin: left;
}

.card:hover::before {
    transform: scaleX(1);
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: rgba(255, 107, 157, 0.12);
    color: var(--primary);
}

.badge-secondary {
    background: rgba(124, 92, 255, 0.12);
    color: var(--secondary);
}

.badge-accent {
    background: rgba(0, 212, 255, 0.12);
    color: #00a8cc;
}

.badge-success {
    background: rgba(74, 222, 128, 0.12);
    color: #16a34a;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
    line-height: 1;
}

.btn-primary {
    background: var(--gradient-hero);
    color: #fff;
    box-shadow: 0 4px 16px rgba(255, 107, 157, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 107, 157, 0.4);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

.btn-ghost {
    background: rgba(255, 107, 157, 0.08);
    color: var(--primary);
}

.btn-ghost:hover {
    background: rgba(255, 107, 157, 0.15);
}

/* 网格系统 */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* 页面内通用标题 */
.page-header {
    text-align: center;
    padding: 60px 24px 40px;
    position: relative;
}

.page-header h1 {
    font-size: 42px;
    font-weight: 900;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.page-header .breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.page-header .breadcrumb a {
    color: var(--text-muted);
}

.page-header .breadcrumb a:hover {
    color: var(--primary);
}

/* 滚动渐入 */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ===== 关键帧 ===== */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
