/* =====================================================
   网址导航站前台样式
   默认深色主题，支持切换亮色
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ---------- CSS 变量 / 主题 ---------- */
:root {
    --bg:           #0a0a0f;
    --bg-nav:       rgba(10,10,18,0.96);
    --bg-card:      #13131f;
    --bg-card-h:    #1a1a2e;
    --bg-sub:       #0f0f1a;
    --accent:       #4ade80;
    --accent-dim:   rgba(74,222,128,0.12);
    --accent-glow:  rgba(74,222,128,0.25);
    --text:         #e2e8f0;
    --text-muted:   #64748b;
    --text-sub:     #94a3b8;
    --border:       rgba(255,255,255,0.07);
    --border-h:     rgba(74,222,128,0.35);
    --announce-bg:  #0f0f1a;
    --shadow:       0 4px 24px rgba(0,0,0,0.4);
    --radius:       12px;
    --radius-sm:    8px;
    --tab-active-bg:#1e293b;
    --tab-active-c: #ffffff;
}

[data-theme="light"] {
    --bg:           #f1f5f9;
    --bg-nav:       rgba(255,255,255,0.97);
    --bg-card:      #ffffff;
    --bg-card-h:    #f8faff;
    --bg-sub:       #f8faff;
    --accent:       #7c3aed;
    --accent-dim:   rgba(124,58,237,0.08);
    --accent-glow:  rgba(124,58,237,0.2);
    --text:         #1e293b;
    --text-muted:   #64748b;
    --text-sub:     #475569;
    --border:       rgba(0,0,0,0.08);
    --border-h:     rgba(124,58,237,0.35);
    --announce-bg:  #ffffff;
    --shadow:       0 4px 24px rgba(0,0,0,0.08);
    --tab-active-bg:#ffffff;
    --tab-active-c: #1e293b;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    width: 100vw;
}
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background .3s, color .3s;
    line-height: 1.6;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { display: block; }

/* ---------- 公告栏 ---------- */
.announce-bar {
    background: var(--announce-bg);
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 40px;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 200;
}
.announce-icon {
    font-size: 16px;
    flex-shrink: 0;
}
.announce-scroll {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 40px;
    display: flex;
    align-items: center;
}
.announce-track {
    display: flex;
    gap: 60px;
    white-space: nowrap;
    animation: scrollLeft 28s linear infinite;
    font-size: 13px;
    color: var(--text-sub);
}
.announce-track:hover { animation-play-state: paused; }
.announce-item::before { content: "📢 "; }

@keyframes scrollLeft {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* 主题切换按钮 */
.theme-toggle {
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 10px;
    cursor: pointer;
    color: var(--text-sub);
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all .2s;
    height: 26px;
}
.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.theme-toggle svg { width: 14px; height: 14px; fill: currentColor; }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
#themeLabel { display: inline-block; vertical-align: middle; line-height: 1; }

/* ---------- 顶部导航 ---------- */
.main-nav {
    background: var(--bg-nav);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 40px;
    z-index: 100;
}
.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    height: 52px;
}
.nav-brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
    letter-spacing: -0.5px;
}
.nav-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
    padding: 5px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-sub);
    white-space: nowrap;
    transition: all .2s;
    border: 1px solid transparent;
}
.nav-tab:hover,
.nav-tab.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent-glow);
}

/* ---------- 主内容区 ---------- */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* ---------- 每个大分类块 ---------- */
.cat-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px 24px;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}
.section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background: var(--accent);
    border-radius: 2px;
    margin-right: 8px;
    vertical-align: middle;
}
.cat-section:first-child .section-header {
    display: none;
}

/* ---------- 子分类 Tabs ---------- */
.sub-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.sub-tab {
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-sub);
    transition: all .18s;
}
.sub-tab:hover {
    border-color: var(--accent-glow);
    color: var(--accent);
}
.sub-tab.active {
    background: var(--tab-active-bg);
    color: var(--tab-active-c);
    border-color: var(--border-h);
    box-shadow: 0 0 0 1px var(--accent-glow);
}

/* ---------- 网站卡片网格 ---------- */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}
.sites-grid.hidden { display: none; }

.site-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-sub);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .18s;
    user-select: none;
    min-width: 0;
    overflow: hidden;
}
.site-card:hover {
    background: var(--bg-card-h);
    border-color: var(--border-h);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.site-card:active {
    transform: translateY(0);
}

.site-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
}
.site-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.site-icon-letter {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
}

.site-info { overflow: hidden; flex: 1; min-width: 0; }
.site-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.site-desc {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.no-sites {
    color: var(--text-muted);
    font-size: 13px;
    padding: 24px 0;
    text-align: center;
}

/* ---------- 友情链接 ---------- */
.friend-links {
    border-top: 1px solid var(--border);
    padding: 14px 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}
.friend-links-inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 16px;
    font-size: 12px;
    color: var(--text-muted);
}
.friend-links-inner a {
    color: var(--text-muted);
    transition: color .18s;
}
.friend-links-inner a:hover { color: var(--accent); }
.fl-label { font-weight: 600; }

/* ---------- 页脚 ---------- */
.footer {
    border-top: 1px solid var(--border);
    padding: 16px 20px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* ---------- 加载蒙版 ---------- */
.loading-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.loading-mask.hidden { display: none; }
.spinner {
    width: 36px; height: 36px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .nav-brand { font-size: 15px; }
    .nav-inner { gap: 12px; }
    .main-content { padding: 16px 12px 32px; gap: 20px; }
    .cat-section { padding: 14px 14px 18px; }
    .sites-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
}
@media (max-width: 480px) {
    .sites-grid { grid-template-columns: 1fr 1fr; }
}
