/**
 * 网址导航 - 前端样式
 */

/* 基础重置 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #6366f1;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部 */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.logo a {
    color: #fff;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.search-box {
    flex: 1;
    max-width: 500px;
}

.search-box form {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.95);
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    position: relative;
}

.search-icon {
    position: absolute;
    left: 24px;
    font-size: 20px;
    color: var(--text-muted);
    z-index: 1;
}

.search-box input {
    flex: 1;
    padding: 14px 24px 14px 54px;
    border: none;
    font-size: 16px;
    outline: none;
    background: transparent;
}

.search-box button {
    padding: 14px 28px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-box button:hover {
    background: var(--primary-hover);
}

.header-nav a {
    color: rgba(255,255,255,0.9);
    padding: 10px 20px;
    border-radius: 25px;
    background: rgba(255,255,255,0.1);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-nav a:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* 侧边导航 */
.sidebar-nav {
    position: fixed;
    left: 0;
    top: 100px;
    width: 180px;
    padding: 20px;
    z-index: 50;
}

.sidebar-nav-inner {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.sidebar-nav h3 {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 8px;
}

.sidebar-nav a {
    display: block;
    padding: 10px 15px;
    color: var(--text-color);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    font-size: 14px;
}

.sidebar-nav a:hover {
    background: var(--primary-color);
    color: #fff;
    transform: translateX(5px);
}

/* 主内容 */
.main-content {
    margin-left: 200px;
    padding: 30px 0;
    min-height: calc(100vh - 200px);
}

/* 分类区块 */
.category-section {
    margin-bottom: 40px;
    scroll-margin-top: 100px;
}

.category-header {
    margin-bottom: 25px;
}

.category-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--primary-color);
}

.cat-icon, .sub-icon {
    font-size: 22px;
    color: var(--primary-color);
}

/* 小分类区块 */
.subcategory-block {
    margin-bottom: 30px;
}

.subcategory-block h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 站点网格 */
.site-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* 站点卡片 */
.site-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all 0.3s;
    border: 1px solid transparent;
}

.site-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.site-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f4ff, #e8ecff);
    border-radius: 12px;
    overflow: hidden;
}

.site-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.icon-default {
    font-size: 26px;
    color: var(--primary-color);
}

.site-info {
    flex: 1;
    min-width: 0;
}

.site-info h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-info p {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 搜索结果 */
.search-results h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text-color);
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 16px;
}

.back-link {
    margin-top: 30px;
    text-align: center;
}

.back-link a {
    display: inline-block;
    padding: 12px 30px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 25px;
    transition: all 0.2s;
}

.back-link a:hover {
    background: var(--primary-hover);
    color: #fff;
}

/* 页脚 */
.footer {
    background: var(--card-bg);
    padding: 30px 0;
    text-align: center;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-left: 200px;
}

/* 返回顶部 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    box-shadow: var(--shadow-lg);
    z-index: 99;
}

.back-to-top:hover {
    background: var(--primary-hover);
    color: #fff;
    transform: translateY(-3px);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .sidebar-nav {
        display: none;
    }
    
    .main-content,
    .footer {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
    }
    
    .logo {
        width: 100%;
        text-align: center;
        margin-bottom: 15px;
    }
    
    .search-box {
        max-width: none;
        width: 100%;
    }
    
    .header-nav {
        position: absolute;
        top: 15px;
        right: 20px;
    }
    
    .header-nav a {
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .site-grid {
        grid-template-columns: 1fr;
    }
    
    .category-header h2 {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .search-box form {
        flex-direction: column;
        border-radius: var(--radius);
    }
    
    .search-box input {
        padding: 12px 20px;
    }
    
    .search-box button {
        padding: 12px 20px;
    }
    
    .site-card {
        padding: 15px;
    }
    
    .site-icon {
        width: 40px;
        height: 40px;
    }
    
    .site-icon img {
        width: 24px;
        height: 24px;
    }
}
