/* --- 全局重置 --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* AI 科技风配色方案 */
    --bg-body: #0b0c10;       /* 极深的灰黑色背景 */
    --bg-card: #1f2833;       /* 卡片背景色 */
    --text-primary: #66fcf1;  /* 霓虹青色 - 主文字/强调 */
    --text-secondary: #c5c6c7;/* 浅灰色 - 次要文字 */
    --accent-color: #45a29e;  /* 科技绿松石色 - 悬停/边框 */
    --border-color: #2d3436;  /* 暗边框 */
    --gradient-main: linear-gradient(135deg, #66fcf1 0%, #45a29e 100%); /* 渐变主色 */
    --gradient-text: linear-gradient(to right, #66fcf1, #a29bfe); /* 标题渐变 */
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-secondary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { text-decoration: none; color: inherit; transition: all 0.3s ease; }
ul { list-style: none; }

/* --- 布局容器 --- */
.main-wrapper {
    display: flex;
    gap: 25px;
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

/* --- 侧边栏 --- */
aside {
    width: 280px;
    flex-shrink: 0;
    background: var(--bg-card);
    padding: 25px;
    border-radius: 16px;
    height: fit-content;
    position: sticky;
    top: 30px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.page-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 25px;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

/* --- 搜索框 --- */
.search-container {
    margin-bottom: 25px;
}

#search-input {
    width: 100%;
    padding: 14px 18px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: 0.3s;
}

#search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(102, 252, 241, 0.2);
}

/* --- 导航菜单 --- */
.nav-menu ul {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-menu a {
    display: block;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    border-left: 3px solid transparent;
}

.nav-menu a:hover, .nav-menu a.active {
    background: rgba(69, 162, 158, 0.1);
    color: var(--text-primary);
    border-left: 3px solid var(--accent-color);
}

/* --- 主内容区 --- */
main {
    flex: 1;
    min-width: 0;
}

.category-section {
    margin-bottom: 50px;
}

.category-title {
    font-size: 1.5rem;
    margin-bottom: 25px;
    padding-left: 15px;
    border-left: 4px solid var(--accent-color);
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- 网格布局 --- */
.site-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

/* --- 卡片样式 --- */
.site-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 25px;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* 卡片顶部装饰线 */
.site-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--gradient-main);
    opacity: 0;
    transition: 0.3s;
}

.site-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-color: var(--accent-color);
}

.site-card:hover::before {
    opacity: 1;
}

.site-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.site-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    margin-right: 15px;
    background: #fff;
    padding: 2px;
}

.site-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.site-domain {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-family: monospace;
    opacity: 0.7;
}

.site-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.site-link {
    display: inline-block;
    text-align: center;
    background: rgba(69, 162, 158, 0.15);
    color: var(--text-primary);
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    margin-top: auto;
    border: 1px solid rgba(69, 162, 158, 0.3);
}

.site-link:hover {
    background: var(--accent-color);
    color: var(--bg-body);
    box-shadow: 0 0 15px rgba(69, 162, 158, 0.4);
}

/* --- 页脚 --- */
.site-footer {
    text-align: center;
    padding: 30px 0;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: auto;
}

/* --- 移动端适配 --- */
@media (max-width: 768px) {
    body {
        padding: 0;
        background-color: var(--bg-body);
    }

    .main-wrapper {
        flex-direction: column;
        padding: 20px;
        gap: 20px;
    }
    
    /* 侧边栏全宽 */
    aside { 
        width: 100%; 
        position: relative; 
        top: 0; 
        padding: 20px;
        box-shadow: none;
    }

    .page-title { 
        text-align: left; 
        margin-bottom: 20px; 
        font-size: 1.5rem;
    }

    .search-container { 
        margin-bottom: 20px; 
    }

    /* 导航菜单：自适应宽度胶囊样式 */
    .nav-menu { 
        background: transparent; 
        border: none; 
        padding: 0; 
    }
    
    .nav-menu ul { 
        display: flex;
        flex-wrap: wrap;      /* 允许换行，形成多列 */
        gap: 12px;            /* 按钮之间的间距 */
        padding: 0;           /* 去掉默认内边距 */
        margin: 0;            /* 去掉默认外边距 */
    }
    
    .nav-menu li { 
        flex: 0 0 auto;       /* 不拉伸，不压缩 */
        width: auto;          /* 宽度由内容决定 */
    }
    
    .nav-menu a { 
        padding: 10px 18px;   /* 调整内边距，形成胶囊形状 */
        background: var(--bg-card); 
        border: 1px solid var(--border-color); 
        border-radius: 50px;  /* 大圆角，胶囊形状 */
        font-size: 0.9rem;
        white-space: nowrap;  /* 文字不换行 */
        display: inline-block;
    }

    /* 网格布局：移动端单列 */
    .site-grid {
        grid-template-columns: 1fr;
    }
}
