/**
 * 导航网格样式
 * 参考图片排版，自适应响应式布局
 * 适配全局主题CSS变量
 */

/* 导航容器 */
.navigation-grid-container {
    width: 100%;
    margin: 0;
    padding: 0 20px;
}

/* 导航包装 - 居中对齐 */
.navigation-grid-wrapper {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: flex-start;
}

/* 加载/错误状态 */
.navigation-loading,
.navigation-error {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    width: 100%;
}

.navigation-retry-btn {
    margin-top: 10px;
    padding: 8px 20px;
    font-size: 14px;
    color: var(--text-color);
    background: var(--button-bg);
    border: 1px solid var(--button-border);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.navigation-retry-btn:hover {
    background: var(--hover-bg);
    border-color: var(--bg-highlight);
    box-shadow: var(--shadow-sm), 0 0 0 1px var(--bg-highlight);
    transform: translateY(-1px);
}

.navigation-retry-btn:active {
    background: var(--active-bg);
    transform: translateY(0);
}

/* 分类小方块容器 - 固定高度 */
.nav-category {
    padding: 8px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 220px; /* 固定高度：标题(26px) + 5行按钮(28px*5) + 间距(5px*4) + padding(8px*2) = 214px，取220px */
}

/* 分类标题 - 第一行居中 */
.category-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-heading);
    margin: 0 0 6px 0;
    text-align: center;
    letter-spacing: 0.5px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--bg-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 链接网格 - 固定每行3个，超出滚动 */
.nav-links-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    /* 自定义滚动条样式 */
    scrollbar-width: thin;
    scrollbar-color: var(--bg-border) transparent;
}

/* Webkit浏览器滚动条样式 */
.nav-links-grid::-webkit-scrollbar {
    width: 6px;
}

.nav-links-grid::-webkit-scrollbar-track {
    background: transparent;
}

.nav-links-grid::-webkit-scrollbar-thumb {
    background: var(--bg-border);
    border-radius: 3px;
}

.nav-links-grid::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* 链接卡片 */
.nav-link-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    min-height: 28px;
    background: var(--bg-primary);
    border: 1px solid var(--bg-border);
    border-radius: calc(var(--border-radius) - 2px);
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.nav-link-card:hover {
    background: var(--hover-bg);
    border-color: var(--bg-highlight);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm), 0 0 0 1px var(--bg-highlight);
}

.nav-link-card:active {
    background: var(--active-bg);
    transform: translateY(0);
}

/* 链接名称 - 单行显示，不换行 */
.nav-link-name {
    font-size: 12px;
    color: var(--text-color);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    line-height: 1.3;
}

.nav-link-card:hover .nav-link-name {
    color: var(--link-color);
}

/* 响应式 */
@media (max-width: 1200px) {
    .navigation-grid-wrapper {
        gap: 10px;
    }
    
    .nav-category {
        height: 200px;
    }
}

@media (max-width: 768px) {
    .navigation-grid-container {
        padding: 0 10px;
    }
    
    .navigation-grid-wrapper {
        gap: 8px;
    }
    
    .nav-category {
        padding: 7px;
        height: 180px;
    }
    
    .category-title {
        font-size: 13px;
        margin-bottom: 5px;
    }
    
    .nav-links-grid {
        gap: 4px;
    }
    
    .nav-link-card {
        padding: 5px 3px;
        min-height: 26px;
    }
    
    .nav-link-name {
        font-size: 11px;
    }
}

@media (max-width: 576px) {
    .navigation-grid-wrapper {
        gap: 8px;
        justify-content: center;
    }
    
    .nav-category {
        padding: 6px;
        width: 100%;
        height: 160px;
    }
    
    .nav-links-grid {
        gap: 4px;
    }
    
    .nav-link-card {
        padding: 5px 2px;
        min-height: 24px;
    }
    
    .nav-link-name {
        font-size: 11px;
    }
}
