/* css/style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
}

/* ========== 第一行：菜单栏 ========== */
.menubar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 0 30px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Logo 容器（包含 logo 和收藏按钮）*/
.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;  /* 控制文字和按钮的间距 */
}

.logo {
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    text-decoration: none;
    white-space: nowrap;
}
/* 收藏按钮样式 - 简化版 */
.favorite-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0.9;
}

.favorite-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    opacity: 1;
}
.menu-items {
    display: flex;
    gap: 30px;
}

.menu-items a {
    color: #fff;
    text-decoration: none;
    font-size: 15px;
    padding: 8px 16px;
    border-radius: 20px;
    transition: background 0.2s;
}

.menu-items a:hover {
    background: rgba(255,255,255,0.2);
}

/* 第二行：搜索行  */
.search-row {
    background: #fff;
    padding: 4px 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
/* 购物搜索行 */
.shopping-search-row {
    background: linear-gradient(135deg, rgba(255,107,107,0.05) 0%, rgba(238,82,82,0.05) 100%);
    border-top: 1px solid #ffe0e0;
}

.shopping-select {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5252 100%);
}
.search-container {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.search-box {
    display: flex;
    align-items: center;
    background: #f0f2f5;
    border-radius: 30px;
    padding: 5px 20px;
    border: 2px solid rgba(255, 255, 255, 0.8);
}
.search-box:hover {
    border-color: rgba(255, 255, 255, 0.6);
}
/* 搜索引擎下拉菜单 */
.engine-select {
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    margin-right: 10px;
    min-width: 90px;
}

.engine-select option {
    background: #fff;
    color: #333;
    padding: 8px;
}
.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 15px;
    font-size: 16px;
    outline: none;
}
.search-box button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 10px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 15px;
}

/* 搜索结果下拉 */
.search-results {
    position: absolute;
    top: 100%;
    left: 20px;
    right: 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.search-results.show {
    display: block;
}
.search-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    text-decoration: none;
    color: #333;
}
.search-item span {
    font-size: 14px;
}

.search-item .category-tag {
    margin-left: auto;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    color: #666;
}
/* AI 搜索行 */
.ai-search-row {
    background: linear-gradient(135deg, rgba(102,226,162,0.05) 0%, rgba(75,192,162,0.05) 100%);
    border-top: 1px solid #d0f0e0;
}

.ai-select {
    background: linear-gradient(135deg, #66e2a2 0%, #4bc0a2 100%);
}

/* 视频搜索行 */
.video-search-row {
    background: linear-gradient(135deg, rgba(255,107,162,0.05) 0%, rgba(238,82,162,0.05) 100%);
    border-top: 1px solid #ffe0f0;
}

.video-select {
    background: linear-gradient(135deg, #ff6ba2 0%, #ee52a2 100%);
}

/* 代码搜索行 */
.code-search-row {
    background: linear-gradient(135deg, rgba(102,162,226,0.05) 0%, rgba(75,132,192,0.05) 100%);
    border-top: 1px solid #d0e0f0;
}

.code-select {
    background: linear-gradient(135deg, #66a2e2 0%, #4b84c0 100%);
}

/* 新闻搜索行 */
.news-search-row {
    background: linear-gradient(135deg, rgba(255,192,107,0.05) 0%, rgba(238,162,82,0.05) 100%);
    border-top: 1px solid #fff0d0;
}

.news-select {
    background: linear-gradient(135deg, #ffc06b 0%, #eea252 100%);
}

/* 🆕 站内搜索行 */
.site-search-row {
    background: linear-gradient(135deg, rgba(90, 153, 182, 0.08) 10%, rgba(118,75,162,0.08) 100%);
    border-top: 1px solid #e0e4f0;
    padding: 8px 30px;
}

.site-search-icon {
    font-size: 16px;
    margin-right: 10px;
    color: #667eea;
}

/* 🆕 站内搜索结果显示区域（独立区域）*/
.site-search-results-area {
    background: #fff;
    border-top: 1px solid #e0e4f0;
    border-bottom: 1px solid #e0e4f0;
    min-height: 100px;
    max-height: 600px;
    overflow-y: auto;
}

/* 站内搜索结果容器 */
.site-search-results {
    max-width: 800px;
    margin: 0 auto;
    padding: 15px 30px;
}

/* 搜索结果头部信息 */
.site-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    margin-bottom: 15px;
    border-bottom: 2px solid #f0f2f5;
}

.site-search-header .search-info {
    font-size: 14px;
    color: #666;
}

.site-search-header .search-info .keyword {
    color: #667eea;
    font-weight: 600;
}

.site-search-header .search-count {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
}

/* 站内搜索结果项 */
.site-search-item {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: #333;
    border: 1px solid #e8ecf1;
    border-radius: 8px;
    margin-bottom: 12px;
    background: #fff;
}

.site-search-item:hover {
    background: linear-gradient(135deg, rgba(102,126,234,0.05) 0%, rgba(118,75,162,0.05) 100%);
    border-color: #667eea;
}

.site-search-item .site-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-search-item .site-name .icon {
    font-size: 18px;
}

.site-search-item .site-url {
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
    word-break: break-all;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.site-search-item .site-category {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    padding: 5px 12px;
    background: linear-gradient(135deg, rgba(102,126,234,0.1) 0%, rgba(118,75,162,0.1) 100%);
    border-radius: 15px;
    color: #667eea;
}

.site-search-item .site-category .parent-cat {
    font-weight: 500;
}

.site-search-item .site-category .separator {
    color: #aaa;
}

.site-search-item .site-category .child-cat {
    font-weight: 500;
}

/* 无结果提示 */
.site-search-no-result {
    padding: 50px 20px;
    text-align: center;
    color: #888;
}

.site-search-no-result .icon {
    font-size: 50px;
    margin-bottom: 15px;
    display: block;
}

.site-search-no-result p {
    font-size: 14px;
    margin: 5px 0;
}

/* 空状态（未搜索时）*/
.site-search-empty {
    padding: 40px 20px;
    text-align: center;
    color: #aaa;
    font-size: 14px;
}

.site-search-empty .icon {
    font-size: 40px;
    margin-bottom: 10px;
    display: block;
}

/* 滚动条样式 */
.site-search-results-area::-webkit-scrollbar {
    width: 6px;
}

.site-search-results-area::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.site-search-results-area::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.site-search-results-area::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}
/* ========== 主体内容区 ========== */
.main-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
    gap: 30px;
    height: calc(100vh - 280px);
    overflow: hidden;
}

/* ========== 左侧：导航分类 ========== */
.sidebar {
    width: 300px;
    flex-shrink: 0;
    height: 100%;
    overflow: hidden;
}

.category-list {
    background: #fff;
    border-radius: 12px;
    padding: 15px 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    height: 100%;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* 滚动条样式 */
.category-list::-webkit-scrollbar {
    width: 6px;
}

.category-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.category-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.category-list::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.category-item {
    padding: 12px 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-left: 3px solid transparent;
    font-size: 15px;
    color: #555;
}

.category-item:hover {
    background: #f5f7fa;
    color: #667eea;
}

.category-item .icon {
    margin-right: 12px;
    font-size: 18px;
}

.category-item .count {
    margin-left: auto;
    background: #e8ecf1;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    color: #888;
}
/* 全部链接项 */
.category-list > .category-item-all {
    padding: 12px 20px;
    margin: 4px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: 8px;
    font-size: 14px;
    color: #555;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(102,126,234,0.1) 0%, rgba(118,75,162,0.1) 100%);
    border-left: 4px solid #667eea;
}

.category-list > .category-item-all:hover {
    background: linear-gradient(135deg, rgba(102,126,234,0.2) 0%, rgba(118,75,162,0.2) 100%);
    color: #667eea;
}

.category-list > .category-item-all.active {
    background: linear-gradient(135deg, rgba(102,126,234,0.25) 0%, rgba(118,75,162,0.25) 100%);
    box-shadow: 0 3px 10px rgba(102,126,234,0.2);
    color: #667eea;
}

.category-list > .category-item-all .icon {
    margin-right: 10px;
    font-size: 18px;
}

.category-list > .category-item-all .count {
    margin-left: auto;
    background: linear-gradient(135deg, rgba(102,126,234,0.2) 0%, rgba(118,75,162,0.2) 100%);
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    color: #667eea;
    font-weight: 600;
}

/* 树形分类容器 */
.category-tree-item {
    position: relative;
}

/* 分类项样式 */
.category-tree-item .category-item {
    padding: 8px 16px;
    margin: 2px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: 6px;
    font-size: 13px;
    color: #555;
    position: relative;
    font-family: 'Consolas', 'Monaco', monospace;
}

.category-tree-item .category-item:hover {
    background: linear-gradient(135deg, rgba(102,126,234,0.08) 0%, rgba(118,75,162,0.08) 100%);
    color: #667eea;
}

.category-tree-item .category-item.active {
    background: linear-gradient(135deg, rgba(102,126,234,0.2) 0%, rgba(118,75,162,0.2) 100%);
    color: #667eea;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(102,126,234,0.15);
}

/* 树形连接线容器 */
.category-tree-item .tree-line {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* 垂直连接线 */
.category-tree-item .tree-line::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 50%;
    width: 1px;
    background: #d0d7de;
    transform: translateX(-50%);
}

/* 水平连接线 */
.category-tree-item .tree-line::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 1px;
    background: #d0d7de;
    transform: translateY(-50%);
}

/* 最后一个子项的特殊处理 */
.category-tree-item.last-child .tree-line::before {
    bottom: 0;
    height: 50%;
}

/* 展开/收起图标 */
.category-tree-item .toggle-icon {
    margin-right: 4px;
    font-size: 10px;
    color: #888;
    cursor: pointer;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    flex-shrink: 0;
    font-family: 'Consolas', 'Monaco', monospace;
}

.category-tree-item .toggle-icon.expanded {
    transform: rotate(90deg);
}

/* 分类图标 */
.category-tree-item .category-item .icon {
    margin-right: 8px;
    font-size: 15px;
    flex-shrink: 0;
}

/* 分类名称 */
.category-tree-item .category-item .name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 链接数量标签 */
.category-tree-item .category-item .count {
    margin-left: 8px;
    background: #f0f2f5;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 11px;
    color: #888;
    font-weight: 500;
    flex-shrink: 0;
    min-width: 20px;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.category-tree-item .category-item.active .count {
    background: rgba(102,126,234,0.2);
    color: #667eea;
}

.category-tree-item .category-item:hover .count {
    background: rgba(102,126,234,0.15);
    color: #667eea;
}
/* 子分类默认隐藏 */
.category-children {
    margin-left: 30px;
    display: none;
}

/* 子分类展开时显示 */
.category-children.show {
    display: block;
}

/* 隐藏箭头（无子分类时） */
.toggle-icon.hidden {
    visibility: hidden;
}
/* 子分类容器 */
.category-tree-item .category-children {
    display: block;
    overflow: hidden;
}

.category-tree-item .category-children.collapsed {
    display: none;
}

/* 层级缩进 */
.category-tree-item[data-level="0"] {
    margin-left: 0;
}

.category-tree-item[data-level="1"] {
    margin-left: 20px;
}

.category-tree-item[data-level="2"] {
    margin-left: 40px;
}

.category-tree-item[data-level="3"] {
    margin-left: 60px;
}

.category-tree-item[data-level="4"] {
    margin-left: 80px;
}

/* 顶级分类特殊样式 */
.category-tree-item[data-level="0"] .category-item {
    font-weight: 600;
    font-size: 14px;
    padding: 10px 16px;
}

.category-tree-item[data-level="0"] .category-item .icon {
    font-size: 16px;
}

/* 子分类特殊样式 */
.category-tree-item[data-level]:not([data-level="0"]) .category-item {
    font-size: 13px;
    padding: 6px 12px;
}

/* 响应式 */
@media (max-width: 1200px) {
    .sidebar {
        width: 260px;
    }
    
    .category-tree-item[data-level="1"] {
        margin-left: 16px;
    }
    
    .category-tree-item[data-level="2"] {
        margin-left: 32px;
    }
    
    .category-tree-item[data-level="3"] {
        margin-left: 48px;
    }
}
.category-item.active {
    background: linear-gradient(135deg, rgba(102,126,234,0.1) 0%, rgba(118,75,162,0.1) 100%);
    color: #667eea;
    border-left-color: #667eea;
    font-weight: 600;
}
/* ========== 右侧：链接内容 ========== */
.content-area {
    flex: 1;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.category-header {
    background: #fff;
    padding: 20px 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.category-header h2 {
    font-size: 22px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-header .icon {
    font-size: 28px;
    margin-right: 12px;
    flex-shrink: 0;
}

.category-header .desc {
    margin-left: auto;
    color: #888;
    font-size: 14px;
    flex-shrink: 0;
}
/* 链接网格容器 - 添加滚动 */
.links-grid-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}
/* 链接网格 */
.links-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-content: flex-start;
}
/* 滚动条样式 */
.links-grid-container::-webkit-scrollbar {
    width: 6px;
}

.links-grid-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.links-grid-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.links-grid-container::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}
.link-card {
    background: #fff;
    border-radius: 8px;
    padding: 12px 15px;
    display: block;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid #eee;
    width: 140px;
    height: 80px;
    overflow: hidden;
}

.link-card:hover {
    box-shadow: 0 4px 15px rgba(102,126,234,0.15);
    border-color: #667eea;
}

.link-card .info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

.link-card .name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    
    /* ✅ 新增/修改以下属性以支持换行 */
    white-space: normal;           /* 允许正常换行 */
    word-break: break-word;        /* 防止长单词溢出 */
    overflow: hidden;              /* 保持隐藏超出部分（以防超过 2 行）*/
    text-overflow: ellipsis;       /* 如果超过容器高度，末尾显示省略号 */
    
    /* ✅ 调整行高，让两行文字更紧凑美观 */
    line-height: 1.4; 
    height: auto;                  /* 高度随内容自适应 */
    min-height: 18px;              /* 保证至少有一行的高度 */
}

.link-card .url {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 3px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 12px;
    color: #888;
}

.empty-state .icon {
    font-size: 60px;
    margin-bottom: 20px;
}
/* 页脚 */
.footer {
    text-align: center;
    padding: 30px;
    color: #888;
    font-size: 14px;
    background: #fff;
    margin-top: 0;
}
/* 响应式 */
@media (max-width: 768px) {
    .engine-select {
        min-width: 70px;
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .search-box input {
        font-size: 14px;
        padding: 10px 12px;
    }
}
/*  联系邮箱模态框  */
.contact-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.contact-modal.show {
    display: flex;
}

.modal-content {
    background: #fff;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.3s ease;
}
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #888;
    transition: color 0.3s;
}

.modal-close:hover {
    color: #333;
}

.modal-icon {
    font-size: 50px;
    margin-bottom: 15px;
}

.modal-content h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 22px;
}

.modal-content p {
    color: #666;
    margin-bottom: 20px;
    font-size: 14px;
}
/* ========== 关于页面模态框 (复用联系模态框样式) ========== */
.about-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.about-modal.show {
    display: flex;
}

/* 复用 modal-content 样式，如果需要微调可以单独写 .about-modal .modal-content */
.about-modal .modal-content {
    /* 如果内容较多，可以增加最大宽度或高度 */
    max-width: 500px; 
}

.about-modal .modal-icon {
    font-size: 40px; /* 可以换一个图标，比如 ℹ️ */
}

.about-modal .about-text {
    text-align: left;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    line-height: 1.6;
    color: #444;
    font-size: 15px;
    white-space: pre-line; /* 允许文本中的换行符生效 */
}

.about-modal .about-text h4 {
    margin-top: 0;
    color: #667eea;
    font-size: 16px;
}

.about-modal .about-text p {
    margin-bottom: 15px;
}

.about-modal .about-text p:last-child {
    margin-bottom: 0;
}
/* 邮箱文本显示（不可点击） */
.email-text {
    display: block;
    background: #f0f2f5;
    color: #333;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 16px;
    margin-bottom: 15px;
    font-family: monospace;
    user-select: all;
    cursor: default;
}

.copy-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.copy-btn:hover {
    box-shadow: 0 4px 15px rgba(102,126,234,0.3);
}
