/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --bg-color: #f7fafc;
    --card-bg: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    display: flex;
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0;
}

/* 侧边栏 */
.sidebar {
    width: 180px;
    background: linear-gradient(180deg, #1a202c 0%, #2d3748 100%);
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.sidebar-header {
    padding: 20px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
    justify-content: flex-start;
}

.sidebar .logo h1 {
    color: white;
    font-size: 18px;
    font-weight: 700;
}

.logo-icon {
    font-size: 32px;
}

.nav {
    padding: 15px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    color: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 6px;
    font-size: 14px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.nav-item .icon {
    font-size: 22px;
}

/* 内容包装器 */
.content-wrapper {
    flex: 1;
    margin-left: 180px;
    padding: 30px;
    min-height: 100vh;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

/* 搜索选项卡 */
.search-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-tab {
    padding: 8px 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.search-tab:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
}

.search-tab.active {
    background: white;
    color: var(--primary-color);
    border-color: white;
    font-weight: 600;
}

/* 搜索框 */
.search-box {
    display: flex;
    gap: 10px;
    max-width: 100%;
}

.search-box input {
    flex: 1;
    padding: 15px 25px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
    background: white;
}

.search-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    font-size: 20px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.search-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

/* 主要内容区域 */
.main-content {
    display: grid;
    gap: 30px;
}

/* 分类样式 */
.category {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.category:hover {
    box-shadow: var(--shadow-md);
}

.category-header h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

/* 链接网格 */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

/* 链接卡片 */
.link-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 15px 10px;
    background: var(--bg-color);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
    border: 2px solid transparent;
}

.link-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
    background: white;
}

.link-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.link-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.link-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    word-break: break-word;
}

.link-desc {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* 页脚样式 */
.footer {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* 搜索结果高亮 */
.search-highlight {
    display: block !important;
}

.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .content-wrapper {
        margin-left: 0;
        padding: 20px;
    }
    
    .header {
        padding: 25px 20px;
    }
    
    .search-tabs {
        gap: 8px;
    }
    
    .search-tab {
        padding: 6px 16px;
        font-size: 13px;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .search-btn {
        width: 100%;
    }
    
    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .category {
        padding: 20px;
    }
    
    .category-header h2 {
        font-size: 20px;
    }
    
    /* 添加菜单按钮 */
    .menu-toggle {
        display: flex !important;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 20px 15px;
    }
    
    .search-tabs {
        gap: 6px;
    }
    
    .search-tab {
        padding: 5px 12px;
        font-size: 12px;
    }
    
    .search-box input {
        font-size: 14px;
        padding: 12px 20px;
    }
    
    .links-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .link-card {
        padding: 15px 10px;
    }
    
    .link-icon {
        font-size: 28px;
    }
    
    .link-title {
        font-size: 13px;
    }
    
    .link-desc {
        font-size: 11px;
    }
}

/* 菜单切换按钮（移动端） */
.menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 200;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.menu-toggle:hover {
    transform: scale(1.1);
}

/* 遮罩层（移动端） */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

.overlay.active {
    display: block;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* 管理入口 */
.admin-entry {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.admin-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.admin-link:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* 重新配置按钮 */
.reconfig-btn {
    background: none;
    border: none;
    color: #718096;
    font-size: 12px;
    cursor: pointer;
    padding: 5px 10px;
    margin-top: 10px;
    transition: all 0.3s;
}

.reconfig-btn:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category {
    animation: fadeIn 0.6s ease forwards;
}

.category:nth-child(1) {
    animation-delay: 0.1s;
}

.category:nth-child(2) {
    animation-delay: 0.2s;
}

.category:nth-child(3) {
    animation-delay: 0.3s;
}

.category:nth-child(4) {
    animation-delay: 0.4s;
}

.category:nth-child(5) {
    animation-delay: 0.5s;
}
