/* ============ 导航信息站 样式 ============ */

* {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f0f2f5;
}

/* 统一内容宽度（主流网站 1200px） */
.content-wrap {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== 整体布局：左侧边栏 + 右侧内容 ===== */
.layout-wrapper {
    display: flex;
    margin-top: 56px;
    min-height: calc(100vh - 56px);
}

/* 左侧分类侧边栏 */
.sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #e8e8e8;
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    overflow-y: auto;
    padding: 16px 0;
}

.sidebar .nav-item-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: #555;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar .nav-item-link:hover {
    background: #f5f7fa;
    color: #1a73e8;
}

.sidebar .nav-item-link.active {
    background: #e8f0fe;
    color: #1a73e8;
    border-left-color: #1a73e8;
    font-weight: 600;
}

.sidebar .nav-item-link i {
    width: 20px;
    margin-right: 10px;
    text-align: center;
    font-size: 16px;
}

/* 左侧二级分类浮动面板 */
.nav-item-wrapper {
    position: relative;
}

.submenu-panel {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    padding: 16px;
    min-width: 280px;
    z-index: 1000;
}

.nav-item-wrapper:hover .submenu-panel {
    display: block;
}

.submenu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.submenu-item {
    display: block;
    padding: 10px 14px;
    background: #f5f7fa;
    border-radius: 8px;
    text-decoration: none;
    color: #555;
    font-size: 13px;
    text-align: center;
    transition: all 0.15s;
}

.submenu-item:hover {
    background: #e8f0fe;
    color: #1a73e8;
}

/* 二级分类标签栏 */
.subgroup-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    flex: 1;
    padding-top: 4px;
}

.subgroup-tab {
    border: none;
    background: transparent;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: #999;
    cursor: pointer;
    transition: all 0.15s;
}

.subgroup-tab:hover {
    color: #333;
}

.subgroup-tab.active {
    background: #ff4757;
    color: #fff;
    font-weight: 600;
}

/* 右侧内容区 */
.main-content {
    flex: 1;
    padding: 20px;
    min-width: 0;
}

/* ===== 分类区块卡片 ===== */
.category-section {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    scroll-margin-top: 76px;
}

.category-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 16px;
}

.category-title {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin: 0;
    display: flex;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 32px;
}

.category-title i {
    margin-right: 8px;
    color: #1a73e8;
}

.more-btn {
    font-size: 13px;
    color: #888;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 32px;
}
    border: 1px solid #ddd;
    padding: 3px 12px;
    border-radius: 6px;
    transition: all 0.15s;
}

.more-btn:hover {
    color: #1a73e8;
    border-color: #1a73e8;
}

/* ===== 网站卡片网格 ===== */
.links-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
}

@media (max-width: 1400px) {
    .links-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1200px) {
    .links-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 992px) {
    .links-grid { grid-template-columns: 1fr; }
    .sidebar { display: none; }
}
@media (max-width: 576px) {
    .links-grid { grid-template-columns: 1fr; }
}

/* 单个网站卡片 */
.site-card {
    background: #f8f9fb;
    border-radius: 10px;
    padding: 14px 36px 14px 14px;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    min-width: 0;
    overflow: hidden;
    min-height: 110px;
}

.site-card:hover {
    background: #eef4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.1);
}

.site-card .card-top {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    min-width: 0;
}

.site-card .site-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    margin-right: 10px;
    flex-shrink: 0;
    background: #fff;
    object-fit: contain;
}

.site-card .site-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.site-card .site-desc {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-card .card-tags {
    margin-top: auto;
    padding-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    min-height: 28px;
}

.site-card .tag {
    font-size: 11px;
    color: #999;
    background: #fff;
    padding: 2px 6px;
    border-radius: 4px;
}

.site-card .card-arrow {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e8e8e8;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all 0.2s;
}

.site-card:hover .card-arrow {
    background: #1a73e8;
    color: #fff;
}

/* ===== 顶部搜索横幅 ===== */
.hero-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 24px 32px;
    margin-bottom: 20px;
    color: #fff;
}

.hero-bar h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.hero-bar p {
    opacity: 0.9;
    margin-bottom: 16px;
    font-size: 14px;
}

/* ===== 详情页 ===== */
.detail-hero {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.detail-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: #f5f7fa;
    padding: 8px;
    object-fit: contain;
}

.detail-content {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    line-height: 1.8;
    font-size: 15px;
    color: #444;
}

.long-desc-content {
    overflow-x: auto;
}
.long-desc-content p {
    margin-bottom: 12px;
    word-wrap: break-word;
}
.long-desc-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 16px 0;
}
.long-desc-content ul, .long-desc-content ol {
    margin-bottom: 12px;
    padding-left: 24px;
}
.long-desc-content h2, .long-desc-content h3 {
    margin: 20px 0 12px;
    font-weight: 600;
}

/* ===== 榜单侧边栏 ===== */
.ranking-widget {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    position: sticky;
    top: 76px;
}

.ranking-tabs {
    border-bottom: 2px solid #f0f0f0;
    padding: 0 16px;
}

.ranking-tabs .nav-link {
    border: none;
    color: #888;
    font-size: 15px;
    font-weight: 600;
    padding: 14px 16px;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.ranking-tabs .nav-link.active {
    color: #e74c3c;
    border-bottom-color: #e74c3c;
    background: transparent;
}

.ranking-body {
    padding: 12px;
}

.rank-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
    margin-bottom: 4px;
}

.rank-item:hover {
    background: #f8f9fb;
}

.rank-num {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
    background: #f0f0f0;
    color: #999;
}

.rank-num.rank-1 { background: #ff4757; color: #fff; }
.rank-num.rank-2 { background: #ff6b81; color: #fff; }
.rank-num.rank-3 { background: #ffa502; color: #fff; }

.rank-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    margin-right: 10px;
    flex-shrink: 0;
    background: #f5f7fa;
    object-fit: contain;
}

.rank-info {
    flex: 1;
    min-width: 0;
}

.rank-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-desc {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 文章内容排版 */
.post-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #333;
}

.post-content img { max-width: 100%; border-radius: 8px; }
.post-content pre { background: #f5f7fa; padding: 16px; border-radius: 8px; overflow-x: auto; }

.navbar-brand { font-size: 1.1rem; }

/* ===== 侧边栏分隔线和badge ===== */
.sidebar-divider {
    height: 1px;
    background: #e8e8e8;
    margin: 8px 16px;
}

.sidebar .nav-item-link .badge {
    font-size: 11px;
    font-weight: normal;
    padding: 2px 6px;
}

.sidebar .nav-item-link.active {
    background: #e7f1ff;
    color: #0d6efd;
    border-left-color: #0d6efd;
}

/* ===== 卡片hover效果 ===== */
.site-card {
    transition: all 0.2s ease;
    border: 1px solid #e8e8e8;
}
.site-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #0d6efd;
}

/* ===== 返回顶部按钮 ===== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #0d6efd;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 999;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.back-to-top.show {
    opacity: 1;
    visibility: visible;
}
.back-to-top:hover {
    background: #0b5ed7;
    transform: translateY(-2px);
}

/* ===== 搜索框样式 ===== */
.search-box {
    position: relative;
    margin-bottom: 20px;
}
.search-box input {
    padding-left: 40px;
    border-radius: 20px;
}
.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
    .layout-wrapper {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        max-height: 200px;
        overflow-y: auto;
    }
    .main-content {
        margin-left: 0;
    }
    .links-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 10px;
    }
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }
}
