/**
 * 导航精选中心 - 前台样式
 * nav_hub plugin frontend styles
 */

/* ========== 公共基础 ========== */
body {
    background-color: #f3f4f6;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    margin: 0;
}

/* ========== 导航头部 ========== */
.nh-header {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nh-header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex !important;
    align-items: center;
    justify-content: flex-start !important;
    box-sizing: border-box;
}
/* 站点名与导航菜单均在头部内、靠左排列 */
.nh-header-inner .nh-header-logo {
    flex-shrink: 0;
    margin-right: 24px;
}
.nh-header-inner .nh-header-nav {
    display: flex !important;
    align-items: center;
    gap: 20px;
    margin-left: 0 !important;
    flex: 1;
    min-width: 0;
}
.nh-header-nav-left {
    display: flex;
    align-items: center;
    gap: 20px;
}
.nh-header-nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}
.nh-header-logo {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    text-decoration: none;
}
.nh-header-logo:hover {
    color: #2563eb;
}
.nh-header-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}
.nh-header-nav-sep {
    width: 1px;
    height: 14px;
    background: #e2e8f0;
    margin: 0 4px;
}
.nh-header-link {
    font-size: 14px;
    color: #64748b;
    text-decoration: none;
}
.nh-header-link:hover {
    color: #2563eb;
}
.nh-header-link-reg {
    padding: 6px 14px;
    background: #2563eb;
    color: #ffffff !important;
    border-radius: 8px;
    font-weight: 500;
}
.nh-header-link-reg:hover {
    background: #1d4ed8;
    color: #ffffff !important;
}
.nh-header-user {
    font-size: 14px;
    color: #64748b;
    margin-right: 4px;
}

.nh-page {
    max-width: 1280px;
    margin: 24px auto 40px;
}
.nh-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
    padding: 20px 24px;
    margin-bottom: 20px;
}

/* ========== 首页 Home ========== */
.nh-layout {
    display: flex;
    gap: 16px;
}
.nh-sidebar {
    width: 140px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    align-self: flex-start;
}
.nh-main {
    flex: 1;
    min-width: 0;
}
/* 右侧侧边栏：与左侧一致做粘性定位，滚动时保持可见 */
.nh-rightbar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    align-self: flex-start;
}

/* 右侧热门网站榜单样式（蓝灰配色与主内容一致） */
.nh-rightcard {
    background: linear-gradient(145deg, #f0f9ff, #e0f2fe);
    padding: 14px 14px 16px;
}
.nh-rightcard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.nh-rightcard-title {
    font-size: 14px;
    font-weight: 600;
    color: #0369a1;
}
.nh-rightcard-tabs {
    display: flex;
    gap: 12px;
    font-size: 13px;
}
.nh-right-tab {
    border: none;
    background: transparent;
    padding: 2px 0;
    cursor: pointer;
    color: #64748b;
    position: relative;
    font-size: 13px;
}
.nh-right-tab.active {
    color: #0369a1;
    font-weight: 600;
}
.nh-right-tab.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -3px;
    height: 2px;
    border-radius: 999px;
    background: #0ea5e9;
}
.nh-rightcard-body {
    margin-top: 4px;
}
.nh-right-list {
    margin-top: 4px;
}
.nh-right-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    margin-bottom: 6px;
}
.nh-right-item:hover {
    background: #e0f2fe;
}
.nh-right-rank {
    width: 20px;
    text-align: center;
    font-size: 13px;
    color: #0ea5e9;
    margin-right: 4px;
}
.nh-right-icon {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: #e0f2fe;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-right: 8px;
}
.nh-right-icon img {
    max-width: 100%;
    max-height: 100%;
}
.nh-right-meta {
    flex: 1;
    min-width: 0;
}
.nh-right-title {
    font-size: 13px;
    font-weight: 500;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nh-right-desc {
    margin-top: 2px;
    font-size: 12px;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nh-right-latest {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #bae6fd;
}
.nh-right-latest-title {
    font-size: 13px;
    font-weight: 600;
    color: #0369a1;
    margin-bottom: 6px;
}
.nh-right-latest-item {
    display: flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    margin-bottom: 4px;
}
.nh-right-latest-item:hover {
    background: #e0f2fe;
}
.nh-hero-search {
    width: 100%;
    margin: 0 auto 20px;
    padding: 20px 24px;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-sizing: border-box;
}
.nh-hero-title {
    margin: 0 auto 6px;
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
    text-align: center;
}
.nh-hero-searchbar {
    display: flex;
    align-items: center;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    padding: 4px 4px 4px 18px;
    max-width: 560px;
    width: 100%;
    margin: 0 auto 10px;
    box-sizing: border-box;
}
.nh-hero-searchbar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    color: #111827;
    background: transparent;
}
.nh-hero-searchbar input::placeholder {
    color: #9ca3af;
}
.nh-hero-search-btn {
    border-radius: 999px;
    background: #2563eb;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.nh-hero-search-btn:hover {
    background: #1d4ed8;
}
.nh-hero-search-btn:focus {
    outline: none;
}
.nh-hero-engines {
    display: flex;
    gap: 10px;
    font-size: 12px;
    justify-content: center;
}
.nh-hero-engine {
    padding: 4px 12px;
    border-radius: 999px;
    background: #f3f4ff;
    color: #4b5563;
    cursor: pointer;
    user-select: none;
    border: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    background-image: none !important;
    -webkit-appearance: none;
    appearance: none;
}
.nh-hero-engine:focus,
.nh-hero-engine:active {
    outline: none !important;
    box-shadow: none !important;
}
.nh-hero-engine.active {
    background: #111827;
    color: #ffffff;
}
.nh-cat-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.nh-cat-item a {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    margin-bottom: 4px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 14px;
    color: #4b5563;
}
.nh-cat-item a.active,
.nh-cat-item a.nh-cat-link.active {
    background: #2563eb;
    color: #ffffff;
}
.nh-cat-section {
    scroll-margin-top: 12px;
}
.nh-cat-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 12px 0;
}
.nh-group-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 10px;
    margin-top: 4px;
}
.nh-group-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.nh-group-tab {
    padding: 4px 10px;
    border-radius: 999px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 12px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.nh-group-tab:hover {
    background: #f3f4f6;
    color: #374151;
}
.nh-group-tab.active {
    background: #e5f0ff;
    color: #1f2937;
}
.nh-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
}
/* 卡片为整块链接，强制去掉链接及内部文字的下划线（覆盖主题全局 a 样式） */
a.nh-item,
a.nh-item:hover,
a.nh-item:focus,
a.nh-item:focus-visible,
a.nh-item *,
a.nh-item:hover *,
a.nh-item:focus * {
    text-decoration: none !important;
}
.nh-item {
    display: block;
    text-decoration: none;
    border-radius: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    transition: all 0.15s ease-in-out;
    height: 100%;
    position: relative;
    overflow: visible;
    z-index: 1;
    min-width: 0;
}
.nh-item:hover {
    background: #e5f0ff;
    transform: translateY(-1px);
    text-decoration: none;
    border-bottom: none;
}
.nh-item:focus,
.nh-item:focus-visible {
    text-decoration: none;
    border-bottom: none;
}
.nh-item:hover,
.nh-item:focus-within {
    z-index: 20;
}
.nh-item,
.nh-item .nh-item-title,
.nh-item .nh-item-desc,
.nh-item .nh-item-tags {
    text-decoration: none !important;
}
.nh-item:hover .nh-item-title,
.nh-item:hover .nh-item-desc,
.nh-item:focus .nh-item-title,
.nh-item:focus .nh-item-desc {
    text-decoration: none !important;
}
.nh-item-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.nh-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.nh-item-icon img {
    max-width: 100%;
    max-height: 100%;
}
.nh-item-title {
    font-size: 12px;
    font-weight: 600;
    color: #0f172a;
    text-decoration: none;
}
.nh-item-title a {
    color: inherit;
    text-decoration: none;
}
.nh-item-title a:hover,
.nh-item-title a:focus {
    color: inherit;
    text-decoration: none;
}
.nh-item-desc {
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.4;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.nh-item-tags {
    margin-top: 4px;
    font-size: 11px;
    color: #9ca3af;
}

/* 选中 / 悬停时的浮层描述（参考示例样式） */
.nh-item-pop {
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    margin-top: 8px;
    background: rgba(15, 23, 42, 0.96);
    color: #f9fafb;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.5;
    /* 悬浮描述比卡片略宽一些 */
    min-width: 220px;
    max-width: 340px;
    max-height: none;
    overflow: visible;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease-in-out;
    z-index: 10;
}
.nh-item:hover .nh-item-pop,
.nh-item:focus-within .nh-item-pop {
    opacity: 1;
}

/* ========== 详情页 Detail ========== */
.nh-detail-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.nh-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}
.nh-detail-meta {
    flex: 1;
    min-width: 0;
}
.nh-logo {
    width: 56px;
    height: 56px;
    min-width: 56px;
    border-radius: 16px;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nh-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}
.nh-title {
    font-size: 20px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}
.nh-detail-tool-card {
    margin-top: 16px;
}
.nh-detail-tool-body {
    margin-top: 8px;
}
.nh-desc {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
    line-height: 1.5;
}
.nh-tags {
    margin-top: 6px;
    font-size: 12px;
    color: #94a3b8;
}
.nh-detail-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding-top: 4px;
    border-top: 1px solid #f1f5f9;
}
.nh-detail-actions .nh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nh-detail-actions .nh-btn-primary {
    background: #2563eb;
    color: #ffffff;
}
.nh-detail-actions .nh-btn-primary:hover {
    background: #1d4ed8;
    color: #ffffff;
}
.nh-detail-actions .nh-btn-outline {
    border: 1px solid #e2e8f0;
    color: #475569;
    background: #ffffff;
}
.nh-detail-actions .nh-btn-outline:hover {
    border-color: #cbd5e1;
    color: #0f172a;
    background: #f8fafc;
}
.nh-detail-actions .nh-btn-fav-warm {
    background: #f59e0b; /* 暖色琥珀，饱和度适中 */
    color: #ffffff;
    border: 1px solid #f59e0b;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.25);
}
.nh-detail-actions .nh-btn-fav-warm:hover {
    background: #d97706;
    border-color: #d97706;
    color: #ffffff;
    box-shadow: 0 6px 14px rgba(217, 119, 6, 0.35);
}
.nh-actions a {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    text-decoration: none;
    margin-left: 8px;
}
.nh-btn-primary {
    background: #2563eb;
    color: #ffffff;
}
.nh-btn-outline {
    border: 1px solid #e2e8f0;
    color: #0f172a;
    background: #ffffff;
}
/* 详情页扫码：在「手机扫码查看」按钮下方弹出 */
.nh-qr-wrap {
    position: relative;
    display: inline-block;
}
.nh-qr-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    z-index: 100;
}
.nh-qr-box {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid #e2e8f0;
    min-width: 260px;
}
.nh-qr-title {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 16px;
}
.nh-qr-img-wrap {
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px;
    display: inline-block;
    margin-bottom: 12px;
}
.nh-qr-img-wrap img {
    display: block;
    width: 200px;
    height: 200px;
}
.nh-qr-tip {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 16px 0;
}
.nh-qr-close {
    padding: 8px 20px;
    border-radius: 10px;
    font-size: 14px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    cursor: pointer;
}
.nh-qr-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.nh-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 12px;
}
#nh-chart {
    width: 100%;
    height: 260px;
}
.nh-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.nh-related-item {
    border-radius: 12px;
    background: #f8fafc;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #0f172a;
    transition: all 0.15s ease-in-out;
}
.nh-related-item:hover {
    background: #e5f0ff;
    transform: translateY(-1px);
}
.nh-related-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 10px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.nh-related-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.nh-related-icon span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.nh-related-title {
    font-size: 13px;
    font-weight: 500;
    color: #0f172a;
}
.nh-related-desc {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

/* ========== 工具页 Tool ========== */
.nh-tool-back {
    display: inline-flex;
    align-items: center;
    color: #64748b;
    text-decoration: none;
    font-size: 13px;
    margin-bottom: 8px;
}
.nh-tool-back:hover {
    color: #2563eb;
}
.nh-tool-title {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 6px 0;
}
.nh-card .nh-tool-card { padding: 0; }
.nh-card .nh-tool-desc {
    font-size: 13px;
    line-height: 1.5;
    color: #64748b;
    margin: 0 0 12px 0;
}
.nh-card .nh-tool-card .row {
    margin-left: -8px;
    margin-right: -8px;
}
.nh-card .nh-tool-card .row > [class*="col-"] {
    padding-left: 8px;
    padding-right: 8px;
}
.nh-card .nh-tool-card .form-group { margin-bottom: 10px; }
.nh-card .nh-tool-card .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    margin-bottom: 4px;
}
.nh-card .nh-tool-card .form-control {
    height: 36px;
    padding: 6px 10px;
    font-size: 14px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    width: 100%;
    box-sizing: border-box;
}
.nh-card .nh-tool-card .form-control:focus {
    border-color: #3b82f6;
    outline: 0;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
.nh-card .nh-tool-card select.form-control { cursor: pointer; }
.nh-card .nh-tool-card .btn {
    margin-top: 4px;
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 6px;
    font-weight: 500;
}
.nh-card .nh-tool-result {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    margin-top: 6px;
}
.nh-card .nh-tool-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
}
.nh-card .nh-tool-result-item:last-child { border-bottom: none; }
.nh-card .nh-tool-result-label { color: #64748b; }
.nh-card .nh-tool-result-value {
    font-weight: 600;
    color: #0f172a;
    font-size: 15px;
}
.nh-card .nh-tool-card .border-top {
    border-color: #e2e8f0 !important;
    padding-top: 12px;
    margin-top: 12px;
}
.nh-card .nh-tool-card .text-muted.small {
    margin-top: 8px !important;
    font-size: 12px;
}

/* 工具页独立页面尺寸 */
.nh-page.nh-tool-page {
    max-width: 800px;
    margin: 12px auto 24px;
    padding: 0 12px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    /* 手机版头部：收紧内边距，导航横向滚动、不换行，避免挤在一起 */
    .nh-header-inner {
        padding: 10px 12px;
        gap: 12px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nh-header-inner::-webkit-scrollbar {
        display: none;
    }
    .nh-header-inner .nh-header-logo {
        margin-right: 12px;
        flex-shrink: 0;
        white-space: nowrap;
    }
    .nh-header-nav {
        flex: 1;
        min-width: 0;
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 12px !important;
    }
    .nh-header-nav::-webkit-scrollbar {
        display: none;
    }
    .nh-header-nav-left,
    .nh-header-nav-right {
        flex-shrink: 0 !important;
        display: flex;
        flex-wrap: nowrap;
        gap: 12px !important;
    }
    .nh-header-link,
    .nh-header-user {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        font-size: 13px;
    }
    .nh-header-nav-sep {
        flex-shrink: 0 !important;
    }
    .nh-page {
        margin: 12px auto 24px;
        padding: 0 10px;
    }
    .nh-card {
        padding: 16px 14px;
    }
    .nh-layout {
        flex-direction: column;
    }
    .nh-sidebar,
    .nh-rightbar {
        width: 100%;
    }
    /* 左侧导航在移动端改为横向滚动的标签栏，减少占高 */
    .nh-sidebar .nh-card {
        padding: 10px 10px;
        margin-bottom: 10px;
    }
    .nh-cat-list {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
    }
    .nh-cat-item {
        flex: 0 0 auto;
        margin-right: 6px;
    }
    .nh-cat-item a {
        padding: 6px 10px;
        margin-bottom: 0;
        font-size: 13px;
        white-space: nowrap;
    }
    .nh-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    #nh-chart {
        height: 220px;
    }
    .nh-page.nh-tool-page {
        margin: 8px auto 16px;
        padding: 0 10px;
    }
    .nh-tool-title { font-size: 17px; margin-bottom: 4px; }
    .nh-card .nh-tool-desc { margin-bottom: 10px; font-size: 12px; }
    .nh-card .nh-tool-card .form-group { margin-bottom: 8px; }
    .nh-card .nh-tool-card .form-group label { font-size: 12px; margin-bottom: 3px; }
    .nh-card .nh-tool-card .form-control { height: 34px; padding: 5px 8px; font-size: 16px; }
    .nh-card .nh-tool-card .btn { margin-top: 2px; padding: 8px 14px; }
    .nh-card .nh-tool-result { padding: 10px 12px; margin-top: 8px; }
    .nh-card .nh-tool-result-item { padding: 5px 0; font-size: 13px; }
    .nh-card .nh-tool-result-value { font-size: 14px; }
    .nh-card .nh-tool-card .border-top { padding-top: 10px; margin-top: 10px; }
}
