/* --- 全局变量定义 --- */
:root {
    --bg-color: #0b1120;       /* 深空蓝黑 */
    --card-bg: rgba(30, 41, 59, 0.7); /* 半透明卡片 */
    --primary: #0ea5e9;        /* 科技蓝 */
    --accent: #10b981;         /* 电路绿 */
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --font-code: 'Consolas', 'Monaco', monospace;
}



/* --- 顶部区域 --- */
.archive-header {
    background: rgba(11, 17, 32, 0.95);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 10%;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

/* --- 顶部区域 (Top Bar) --- */

.header-top {
    display: flex;
    align-items: center;
    /* 修改点 1：改为两端对齐/自动分配空间，防止重叠 */
    justify-content: space-between; 
    margin-bottom: 1.5rem;
    position: relative;
    min-height: 40px;
    /* 修改点 2：增加 gap，确保两个元素至少有 20px 的安全距离 */
    gap: 20px; 
}

/* 返回按钮 */
.back-home-btn {
    /* 修改点 3：删除 position: absolute; 和 left: 0; */
    position: relative; /* 恢复到正常的文档流中 */
    
    text-decoration: none;
    color: var(--primary);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.3s;
    z-index: 10;
    
    /* 修改点 4：防止按钮被压缩换行 */
    white-space: nowrap;
    flex-shrink: 0; 
}

.back-home-btn:hover {
    color: #fff;
    text-shadow: 0 0 10px var(--primary);
}

/* --- 搜索框 --- */
.search-container {
    position: relative;
    width: 400px;
    
    /* 修改点 5：保留 margin: 0 auto; 
       在 Flex 布局中，这会让搜索框尽可能居中，
       但因为左边有了实体按钮占位，它会自动向右让位，不会重叠 */
    margin: 0 auto; 
}

.back-home-btn:hover {
    color: #fff;
    text-shadow: 0 0 10px var(--primary);
}

/* --- 高端搜索框 --- */
.search-container {
    position: relative;
    width: 400px;
    margin: 0 auto; /* <--- 新增这一行：自动均分左右边距，实现居中 */
}

#search-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    padding: 12px 20px 12px 45px;
    border-radius: 50px;
    color: #fff;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    transition: 0.3s;
    outline: none;
}

#search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.2);
    background: rgba(14, 165, 233, 0.05);
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* --- 分类按钮组 --- */
.category-filter {
    display: flex;
    gap: 15px;
    overflow-x: auto; /* 移动端可横滑 */
    padding-bottom: 5px;
}

.cat-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    transition: 0.3s;
    white-space: nowrap;
}

.cat-btn:hover, .cat-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(16, 185, 129, 0.1);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

/* --- 列表容器 --- */
.archive-container {
    padding: 2rem 10%;
    min-height: 80vh;
}

.result-count {
    color: var(--text-muted);
    font-family: 'Fira Code', monospace;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    text-align: right;
}

/* --- 长条形文档卡片 (Long Strip Card) --- */
.doc-item {
    display: flex;
    align-items: center;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-decoration: none; /* 去掉a标签下划线 */
}

/* 悬停效果：左移+发光 */
.doc-item:hover {
    transform: translateX(10px);
    border-color: var(--primary);
    box-shadow: -5px 5px 20px rgba(0, 0, 0, 0.5);
    background: rgba(30, 41, 59, 0.8);
}

/* 左侧装饰条 */
.doc-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--text-muted);
    transition: 0.3s;
}

.doc-item:hover::before {
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

/* 图标区域 */
.doc-icon {
    font-size: 2rem;
    color: var(--text-muted);
    margin-right: 2rem;
    width: 50px;
    text-align: center;
    transition: 0.3s;
}

.doc-item:hover .doc-icon {
    color: var(--primary);
    transform: scale(1.1);
}

/* 内容区域 */
.doc-content {
    flex: 1; /* 撑满剩余空间 */
}

.doc-title {
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.doc-desc {
    color: var(--text-muted);
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* 标签组 */
.doc-tags {
    margin-top: 0.8rem;
    display: flex;
    gap: 10px;
}

.doc-tag {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-family: 'Fira Code', monospace;
}

/* 链接箭头 */
.doc-arrow {
    color: var(--border);
    font-size: 1.2rem;
    transition: 0.3s;
}

.doc-item:hover .doc-arrow {
    color: var(--accent);
    transform: translateX(5px);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .header-top { flex-direction: column; gap: 15px; }
    .search-container { width: 100%; }
    .doc-item { flex-direction: column; align-items: flex-start; }
    .doc-icon { margin-bottom: 1rem; }
    .doc-arrow { display: none; }
}
