:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --bg-dark: #f8fafc;
    --bg-white: #ffffff;
    --bg-row-odd: #ffffff;
    --bg-row-even: #f8fafc;
    --border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
    --divider-color: #e2e8f0;
}

[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --bg-dark: #1a1a2e;
    --bg-white: rgba(255, 255, 255, 0.03);
    --bg-row-odd: rgba(255, 255, 255, 0.02);
    --bg-row-even: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
    --divider-color: rgba(255, 255, 255, 0.1);
}

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

*:focus {
    outline: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
    transition: all 0.3s ease;
    background: var(--bg-dark);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* 顶部操作栏 */
.top-bar {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 100;
    display: flex;
    gap: 8px;
}

.top-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: var(--bg-white);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

[data-theme="dark"] .top-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .top-btn:hover {
    background: #0ea5e9;
    color: #ffffff;
}

[data-theme="dark"] .search-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .search-btn:hover {
    background: #0ea5e9;
}

.top-btn:hover {
    background: #00bfff;
    color: #ffffff;
}

.theme-btn .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-btn .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-btn .moon-icon {
    display: block;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .top-bar {
        position: absolute;
        top: 0;
        right: 0;
    }
    
    .top-btn {
        width: 36px;
        height: 36px;
    }
}

/* 背景层 */
.background-layer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    --blur: 5px;
}

.bg-image {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(var(--blur));
    transform: scale(1.05);
    display: none;
}

.bg-gradient {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark);
    transition: all 0.3s ease;
}

/* 内容包装器 */
.content-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 12px;
    justify-content: center;
}

/* Logo区域 */
.logo-section {
    text-align: center;
    padding: 70px 0 40px;
    position: relative;
    min-height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-text-wrapper {
    position: relative;
    z-index: 2;
    display: inline-block;
}

.logo-text-white,
.logo-text-dark {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 3px;
    opacity: 0;
    animation: logoFadeIn 1s ease-out forwards;
}

.logo-text-white {
    display: none;
}

.logo-text-dark {
    color: #1e293b;
}

[data-theme="dark"] .logo-text-dark {
    color: #fff;
}

@keyframes logoFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 搜索区域 */
.search-section {
    display: flex;
    justify-content: center;
    padding: 0 12px 82px;
    margin-top: 30px;
}

.search-container {
    display: flex;
    align-items: center;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 4px;
    min-width: 300px;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

[data-theme="dark"] .search-container {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

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

.search-input::placeholder {
    color: var(--text-muted);
}

.search-container:focus-within {
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.2), var(--shadow-lg);
    border-color: var(--primary);
    z-index: 10;
    position: relative;
}

[data-theme="dark"] .search-container:focus-within {
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.3), 0 4px 20px rgba(0, 0, 0, 0.15);
    border-color: var(--primary);
}

.search-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #c8d0db;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-right: 4px;
}

.search-btn:hover {
    background: #00bfff;
}

/* 导航主体 */
.nav-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 965px;
    margin: 0 auto;
    width: 100%;
    padding: 8px 0;
}

/* 一级分类标签 */
.nav-tabs {
    background: var(--bg-white);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 0;
    border: 1px solid var(--border);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

[data-theme="dark"] .nav-tabs {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.nav-tabs-content {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 2px;
}

.nav-tabs-content::-webkit-scrollbar {
    height: 4px;
}

.nav-tabs-content::-webkit-scrollbar-track {
    background: transparent;
}

.nav-tabs-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

.nav-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    margin: 0 5px;
}

.nav-tab:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

[data-theme="dark"] .nav-tab:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-tab.active {
    background: deepskyblue;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 191, 255, 0.3);
}

[data-theme="dark"] .nav-tab.active {
    background: #0ea5e9;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

/* 行对齐容器 */
.nav-container {
    position: relative;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
    background: var(--bg-white);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

[data-theme="dark"] .nav-container {
    border-color: rgba(255, 255, 255, 0.1);
    background: transparent;
    box-shadow: none;
}

/* 分类行底部分隔线 */
.category-row {
    border-bottom: 1px solid var(--border);
}

.category-row:last-child {
    border-bottom: none;
}

/* 分类行 - 核心布局 */
.category-row {
    display: flex;
    align-items: stretch;
    min-height: 60px;
}

/* 单双行背景色 */
.category-row.row-odd {
    background: var(--bg-row-odd);
}

.category-row.row-even {
    background: var(--bg-row-even);
}

[data-theme="dark"] .category-row.row-odd {
    background: var(--bg-row-odd);
}

[data-theme="dark"] .category-row.row-even {
    background: var(--bg-row-even);
}

/* 行悬停效果 */
.category-row:hover {
    background: rgba(59, 130, 246, 0.05);
}

[data-theme="dark"] .category-row:hover {
    background: rgba(59, 130, 246, 0.1);
}

/* 统一分割线 */
.nav-divider-line {
    width: 1px;
    background: var(--border);
    position: absolute;
    left: 130px;
    top: 0;
    bottom: 0;
    z-index: 1;
}

[data-theme="dark"] .nav-divider-line {
    background: rgba(255, 255, 255, 0.1);
}

/* 左侧分类标签 */
.row-label {
    width: 130px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 15px 20px;
    background: transparent;
    min-height: 60px;
}

[data-theme="dark"] .row-label {
    background: transparent;
}

/* 奇偶行交替背景 */
.row-odd {
    background: rgba(0, 0, 0, 0.02);
}

.row-even {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .row-odd {
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .row-even {
    background: rgba(255, 255, 255, 0.04);
}

.label-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.label-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

/* 右侧链接区域 */
.row-links {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    padding: 15px 5px;
}

/* 链接项 */
.link-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14.5px;
    background: transparent;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    height: 36px;
    width: 100%;
    overflow: hidden;
}

.link-item:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.link-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-favicon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.link-name {
    white-space: nowrap;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* 无链接提示 */
.no-links {
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
    margin: 5px;
}

/* 空状态 */
.category-empty,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.category-empty .empty-icon,
.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.category-empty h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.category-empty p {
    font-size: 14px;
}

/* 滚动条样式 */
.nav-container::-webkit-scrollbar {
    width: 6px;
}

.nav-container::-webkit-scrollbar-track {
    background: transparent;
}

.nav-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

[data-theme="dark"] .nav-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

/* 响应式适配 */
@media (max-width: 768px) {
    .content-wrapper {
        padding: 8px;
    }
    
    .logo-section {
        padding: 12px 0;
    }
    
    .logo-text {
        font-size: 24px;
    }
    
    .search-section {
        margin-top: 40px;
        padding: 0 8px 60px;
    }
    
    .search-container {
        min-width: 200px;
    }
    
    .nav-main {
        padding: 4px 0;
    }
    
    .nav-tabs {
        border-radius: 8px;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }
    
    .nav-tab {
        padding: 8px 10px;
        font-size: 12px;
        height: 36px;
    }
    
    .nav-container {
        border-radius: 0 0 8px 8px;
    }
    
    .category-row {
        min-height: 50px;
    }
    
    .row-label {
        width: 100px;
        padding: 10px 8px;
        justify-content: center;
        text-align: center;
    }
    
    .label-icon {
        font-size: 14px;
    }
    
    .label-text {
        font-size: 12px;
    }
    
    .row-links {
        padding: 8px 8px;
        gap: 6px;
        grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
    }
    
    .link-item {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .link-icon {
        font-size: 16px;
        width: 20px;
        height: 20px;
    }
    
    .nav-divider-line {
        left: 100px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .row-links {
        grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    }
}

/* 表单标签样式 */
.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}
