/* ============ 基础变量 ============ */
:root {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --primary-bg: rgba(79, 70, 229, 0.08);
    --accent: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --bg: #f7f8fc;
    --bg-card: #ffffff;
    --bg-hover: #f3f4f7;
    --bg-sidebar: #ffffff;

    --text: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f0f1f5;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 30px rgba(79, 70, 229, 0.12);

    --radius: 12px;
    --radius-lg: 16px;
    --radius-sm: 8px;

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg: #0f1115;
    --bg-card: #1a1d24;
    --bg-hover: #242831;
    --bg-sidebar: #161920;
    --text: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-light: #6b7280;
    --border: #2a2f3a;
    --border-light: #232730;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s, color 0.3s;
}

a { text-decoration: none; color: inherit; }

/* ============ 顶部导航 ============ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.header-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 14px 32px;
    display: flex;
    align-items: center;
    gap: 32px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.logo-icon svg { width: 22px; height: 22px; }

.logo-text h1 {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text span {
    font-size: 11px;
    color: var(--text-light);
    letter-spacing: 1px;
}

.search-box {
    flex: 1;
    max-width: 600px;
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 16px;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.search-icon {
    width: 18px;
    height: 18px;
    color: var(--text-light);
    margin-right: 10px;
    flex-shrink: 0;
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: var(--text);
}

.search-box kbd {
    font-size: 11px;
    color: var(--text-light);
    background: var(--bg-card);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition);
}

.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.theme-toggle svg { width: 18px; height: 18px; }

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 6px;
    border-radius: 30px;
    background: var(--bg);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.user-profile:hover { border-color: var(--primary); }

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-light); }

/* ============ 布局 ============ */
.main-layout {
    max-width: 1600px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    padding: 24px 32px;
}

/* ============ 侧边栏 ============ */
.sidebar {
    position: sticky;
    top: 88px;
    height: calc(100vh - 112px);
    display: flex;
    flex-direction: column;
}

.nav-menu {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.sidebar-footer { margin-top: 16px; }

.tip-card {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.tip-icon { font-size: 20px; margin-bottom: 6px; }
.tip-card h4 { font-size: 13px; margin-bottom: 4px; }
.tip-card p { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

/* ============ Banner ============ */
.banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #4f46e5 100%);
    border-radius: var(--radius-lg);
    padding: 40px;
    margin-bottom: 32px;
    color: white;
    overflow: hidden;
    position: relative;
}

.banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 50%, rgba(255,255,255,0.1) 0%, transparent 50%);
}

.banner-content {
    position: relative;
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    align-items: center;
    gap: 40px;
}

.banner-badge {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    font-size: 12px;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
}

.banner-text h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.3;
}

.banner-text > p {
    font-size: 15px;
    opacity: 0.9;
    margin-bottom: 28px;
}

.banner-stats {
    display: flex;
    gap: 32px;
}

.stat strong {
    display: block;
    font-size: 28px;
    font-weight: 700;
}

.stat span {
    font-size: 12px;
    opacity: 0.85;
}

.banner-visual {
    position: relative;
    height: 180px;
}

.float-card {
    position: absolute;
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.95);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: float 4s ease-in-out infinite;
}

.card-1 { top: 0; left: 10%; animation-delay: 0s; }
.card-2 { top: 20%; right: 5%; animation-delay: 0.6s; }
.card-3 { bottom: 10%; left: 0; animation-delay: 1.2s; }
.card-4 { bottom: 0; right: 25%; animation-delay: 1.8s; }
.card-5 { top: 40%; left: 45%; animation-delay: 2.4s; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-12px) rotate(3deg); }
}

/* ============ 章节 ============ */
.section-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 18px;
    padding-left: 4px;
}

.section-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.section-sub {
    font-size: 13px;
    color: var(--text-light);
}

/* ============ 快捷访问 ============ */
.quick-access {
    margin-bottom: 36px;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.quick-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.quick-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.quick-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.quick-item span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ============ 工具板块 ============ */
.tool-section {
    margin-bottom: 36px;
    scroll-margin-top: 88px;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.category-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.category-title h3 { font-size: 18px; font-weight: 600; }
.category-title p { font-size: 12px; color: var(--text-light); }

.category-count {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-hover);
    padding: 4px 10px;
    border-radius: 20px;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--card-color, var(--primary));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.tool-card:hover {
    border-color: var(--card-color, var(--primary));
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.tool-card:hover::before { transform: scaleX(1); }

.tool-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.tool-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: var(--card-bg, var(--primary-bg));
}

.tool-star {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
    transition: var(--transition);
    line-height: 0;
}

.tool-star:hover { color: var(--warning); transform: scale(1.15); }
.tool-star.active { color: var(--warning); }
.tool-star svg { width: 18px; height: 18px; fill: currentColor; }

.tool-card h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.tool-card p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    min-height: 36px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tool-tag {
    display: inline-block;
    margin-top: 10px;
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 6px;
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.tool-tag.hot { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.tool-tag.new { background: rgba(16, 185, 129, 0.1); color: var(--success); }

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.no-results-icon { font-size: 48px; margin-bottom: 12px; }

/* ============ 页脚 ============ */
.footer {
    text-align: center;
    padding: 40px 0 20px;
    color: var(--text-light);
    font-size: 13px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

.footer-sub { font-size: 12px; margin-top: 6px; opacity: 0.7; }

/* ============ 响应式 ============ */
@media (max-width: 1024px) {
    .main-layout { grid-template-columns: 1fr; padding: 16px; }
    .sidebar { position: static; height: auto; }
    .nav-menu { flex-direction: row; overflow-x: auto; }
    .nav-item { flex-shrink: 0; }
    .sidebar-footer { display: none; }
    .banner-content { grid-template-columns: 1fr; }
    .banner-visual { display: none; }
}

@media (max-width: 768px) {
    .header-container { padding: 12px 16px; gap: 12px; }
    .search-box kbd { display: none; }
    .user-info { display: none; }
    .logo-text span { display: none; }
    .banner { padding: 28px 20px; }
    .banner-text h2 { font-size: 24px; }
    .banner-stats { gap: 20px; }
    .stat strong { font-size: 22px; }
}

/* ============ 滚动条 ============ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }
