/* ============================================
   叶斌兵导航 - 现代风格样式表
   nav-modern.css v20240929
   ============================================ */

/* ---------- CSS 变量 ---------- */
:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --bg: #f7f8fc;
    --bg-card: #ffffff;
    --text-primary: #1a202c;
    --text-secondary: #718096;
    --text-muted: #a0aec0;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --header-h: 60px;
    --transition: all 0.25s ease;
}

/* ---------- 基础重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.page-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

img {
    max-width: 100%;
    height: auto;
}

/* ---------- 顶部栏 ---------- */
.top-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 24px;
}

.logo-section {
    flex-shrink: 0;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
}

.site-logo img {
    height: 32px;
    width: auto;
    border-radius: 6px;
}

.logo-text {
    background: linear-gradient(135deg, var(--primary), #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ---------- 搜索框 ---------- */
.search-section {
    flex: 1;
    max-width: 480px;
    margin: 0 auto;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    height: 38px;
    padding: 0 16px 0 38px;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    background: var(--bg);
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* ---------- 导航操作 ---------- */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary);
    background: rgba(102, 126, 234, 0.06);
}

.theme-toggle {
    width: 36px;
    height: 36px;
    border: 1.5px solid var(--border);
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(102, 126, 234, 0.06);
}

/* ---------- 分类导航 ---------- */
.category-nav {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.category-nav::-webkit-scrollbar {
    height: 0;
}

.category-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 48px;
    white-space: nowrap;
}

.category-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.category-item:hover {
    color: var(--primary);
    background: rgba(102, 126, 234, 0.06);
}

.category-item.active {
    color: var(--primary);
    background: rgba(102, 126, 234, 0.1);
    font-weight: 600;
}

.category-item.hidden-cat {
    display: none !important;
}

.category-sub {
    font-size: 12px;
    padding: 4px 10px;
    opacity: 0.8;
}

.category-sub:hover {
    opacity: 1;
}

/* ---------- 更多分类下拉 ---------- */
.category-more-wrapper {
    position: relative;
    display: none;
}

.category-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: 1.5px dashed var(--border);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.category-more-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.category-more-btn[data-count]:after {
    content: attr(data-count);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    margin-left: 2px;
}

.category-more-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 100;
}

.category-more-wrapper.open .category-more-dropdown {
    display: flex;
}

.category-more-dropdown .category-item {
    display: flex;
    width: 100%;
    justify-content: flex-start;
}

/* ---------- 主内容区 ---------- */
.main-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 48px;
}

/* ---------- Hero 区域 ---------- */
.hero-section {
    text-align: center;
    padding: 40px 0 32px;
}

.hero-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.stats-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.stat-item {
    font-size: 14px;
    color: var(--text-secondary);
}

.stat-item strong {
    color: var(--primary);
    font-weight: 700;
    font-size: 16px;
}

/* ---------- 链接区块 ---------- */
.link-section {
    margin-bottom: 36px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.section-title i {
    color: var(--primary);
    font-size: 16px;
}

.section-count {
    font-size: 13px;
    color: var(--text-muted);
}

/* ---------- 链接网格 ---------- */
.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

/* ---------- 链接卡片 ---------- */
.link-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
    display: block;
}

.link-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: rgba(102, 126, 234, 0.2);
}

.link-card:active {
    transform: translateY(-1px);
}

.card-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
}

.card-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(102, 126, 234, 0.05);
}

.card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.icon-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #764ba2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
}

.card-content {
    flex: 1;
    min-width: 0;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.card-arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 12px;
    opacity: 0;
    transition: var(--transition);
}

.link-card:hover .card-arrow {
    opacity: 1;
    transform: translateX(2px);
}

.link-card.clicked {
    transform: scale(0.97);
}

/* ---------- 无结果 ---------- */
.no-results {
    text-align: center;
    padding: 60px 20px;
}

.no-results-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.no-results h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.no-results p {
    font-size: 14px;
    color: var(--text-muted);
}

/* ---------- 返回顶部按钮 ---------- */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 44px;
    height: 44px;
    border: 1.5px solid var(--border);
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 999;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ---------- 页脚 ---------- */
.site-footer {
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.6);
    padding: 24px 0;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    text-align: center;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.footer-links a:hover {
    color: var(--primary);
}

.separator {
    color: var(--text-muted);
}

.footer-copyright {
    font-size: 13px;
    color: var(--text-muted);
}

.footer-copyright a {
    color: var(--text-muted);
    margin-left: 8px;
}

.footer-copyright a:hover {
    color: var(--primary);
}

/* ---------- 深色主题 ---------- */
body.dark-theme {
    --bg: #1a1d23;
    --bg-card: #252830;
    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    --border: #3a3f4b;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
}

body.dark-theme .top-header {
    background: rgba(37, 40, 48, 0.92);
    border-bottom-color: var(--border);
}

body.dark-theme .category-nav {
    background: rgba(37, 40, 48, 0.88);
    border-bottom-color: var(--border);
}

body.dark-theme .icon-placeholder {
    background: linear-gradient(135deg, #4c5aaf, #5a3d8a);
}

body.dark-theme .card-icon {
    background: rgba(102, 126, 234, 0.1);
}

body.dark-theme .site-footer {
    background: rgba(37, 40, 48, 0.6);
}

body.dark-theme .search-box input {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

body.dark-theme .search-box input:focus {
    background: rgba(255, 255, 255, 0.06);
}

body.dark-theme .back-to-top,
body.dark-theme .theme-toggle {
    background: var(--bg-card);
    border-color: var(--border);
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .header-container {
        gap: 12px;
        padding: 0 16px;
    }

    .search-section {
        max-width: none;
    }

    .nav-link span {
        display: none;
    }

    .main-wrapper {
        padding: 20px 16px 32px;
    }

    .hero-title {
        font-size: 24px;
    }

    .hero-subtitle {
        font-size: 14px;
    }

    .link-grid {
        grid-template-columns: 1fr;
    }

    .category-container {
        padding: 0 16px;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .logo-text {
        font-size: 16px;
    }

    .hero-section {
        padding: 24px 0 20px;
    }

    .stats-bar {
        gap: 16px;
    }
}

/* ---------- 滚动条美化 ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}
