/**
 * 导航模板 - 参考深度导航(deepdh.com/ai) 侧边栏 + 主内容 + 右侧栏布局
 */
:root {
    --dh-sidebar-w: 240px;
    --dh-right-w: 280px;
    --dh-topbar-h: 56px;
    --dh-main-padding: 24px;
    --dh-color-primary: #2563eb;
    --dh-color-primary-hover: #1d4ed8;
    --dh-color-text: #1f2937;
    --dh-color-text-muted: #6b7280;
    --dh-color-border: #e5e7eb;
    --dh-bg-sidebar: #fff;
    --dh-bg-main: #f9fafb;
    --dh-bg-card: #fff;
    --dh-shadow: 0 1px 3px rgba(0,0,0,.08);
}

* {
    box-sizing: border-box;
}

body.dh-body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: var(--dh-color-text);
    background: var(--dh-bg-main);
    line-height: 1.6;
}

a {
    color: var(--dh-color-primary);
    text-decoration: none;
}

a:hover {
    color: var(--dh-color-primary-hover);
}

/* ---------- 顶栏 ---------- */
.dh-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--dh-topbar-h);
    background: var(--dh-bg-card);
    border-bottom: 1px solid var(--dh-color-border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 100;
    box-shadow: var(--dh-shadow);
}

.dh-toggle-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-right: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
}

.dh-toggle-sidebar:hover {
    background: rgba(0,0,0,.06);
}

.dh-toggle-icon {
    width: 20px;
    height: 14px;
    border-top: 2px solid var(--dh-color-text);
    border-bottom: 2px solid var(--dh-color-text);
    position: relative;
}

.dh-toggle-icon::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    margin-top: -1px;
    height: 2px;
    background: var(--dh-color-text);
}

.dh-topbar-logo a {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    color: var(--dh-color-text);
    font-weight: 700;
    font-size: 16px;
}

.dh-topbar-logo a:hover {
    color: var(--dh-color-primary);
}

.dh-logo-text {
    line-height: 1.2;
}

.dh-logo-desc {
    font-size: 12px;
    font-weight: 400;
    color: var(--dh-color-text-muted);
}

.dh-logo-img {
    height: 32px;
    width: auto;
    display: block;
}

.dh-topbar-nav {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.dh-topbar-nav a {
    color: var(--dh-color-text-muted);
    font-size: 14px;
}

.dh-topbar-nav a:hover {
    color: var(--dh-color-primary);
}

.dh-topbar-right a {
    color: var(--dh-color-text);
    font-size: 14px;
}

.dh-topbar-right a:hover {
    color: var(--dh-color-primary);
}

/* ---------- 主体布局 ---------- */
.dh-layout {
    display: flex;
    padding-top: var(--dh-topbar-h);
    min-height: 100vh;
}

/* 左侧边栏 */
.dh-sidebar {
    position: fixed;
    left: 0;
    top: var(--dh-topbar-h);
    bottom: 0;
    width: var(--dh-sidebar-w);
    background: var(--dh-bg-sidebar);
    border-right: 1px solid var(--dh-color-border);
    overflow-y: auto;
    z-index: 50;
    transition: transform .2s ease, width .2s ease;
}

.dh-body.dh-sidebar-hidden .dh-sidebar {
    transform: translateX(-100%);
}

.dh-sidebar-inner {
    padding: 16px 0;
}

.dh-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dh-nav-item {
    margin: 0;
}

.dh-nav-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: var(--dh-color-text);
    font-size: 14px;
    transition: background .15s, color .15s;
}

.dh-nav-link:hover {
    background: rgba(37, 99, 235, .08);
    color: var(--dh-color-primary);
}

.dh-nav-link.active {
    background: rgba(37, 99, 235, .1);
    color: var(--dh-color-primary);
    font-weight: 500;
}

.dh-nav-icon {
    width: 24px;
    margin-right: 10px;
    flex-shrink: 0;
    text-align: center;
    color: var(--dh-color-text-muted);
}

.dh-nav-link.active .dh-nav-icon {
    color: var(--dh-color-primary);
}

.dh-nav-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dh-nav-arrow {
    flex-shrink: 0;
    color: var(--dh-color-text-muted);
    font-size: 16px;
}

/* 主内容区包裹 */
.dh-main-wrap {
    flex: 1;
    margin-left: var(--dh-sidebar-w);
    display: flex;
    min-width: 0;
    transition: margin-left .2s ease;
}

.dh-body.dh-sidebar-hidden .dh-main-wrap {
    margin-left: 0;
}

.dh-main {
    flex: 1;
    padding: var(--dh-main-padding);
    min-width: 0;
}

/* 右侧边栏 */
.dh-right-sidebar {
    width: var(--dh-right-w);
    flex-shrink: 0;
    padding: var(--dh-main-padding);
    padding-left: 0;
    border-left: 1px solid var(--dh-color-border);
    background: var(--dh-bg-main);
}

/* ---------- 内容区 ---------- */
.dh-content {
    max-width: 100%;
}

.dh-breadcrumb {
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--dh-color-text-muted);
}

.dh-breadcrumb a {
    color: var(--dh-color-text-muted);
}

.dh-breadcrumb a:hover {
    color: var(--dh-color-primary);
}

.dh-breadcrumb-sep {
    margin: 0 6px;
}

/* 卡片列表 */
.dh-card-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dh-card {
    background: var(--dh-bg-card);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--dh-color-border);
    box-shadow: var(--dh-shadow);
}

.dh-card-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
}

.dh-card-title a {
    color: var(--dh-color-text);
}

.dh-card-title a:hover {
    color: var(--dh-color-primary);
}

.dh-card-meta {
    font-size: 13px;
    color: var(--dh-color-text-muted);
    margin-bottom: 10px;
}

.dh-card-meta a {
    color: var(--dh-color-text-muted);
}

.dh-card-meta a:hover {
    color: var(--dh-color-primary);
}

.dh-card-excerpt {
    font-size: 14px;
    color: var(--dh-color-text-muted);
    line-height: 1.6;
}

.dh-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--dh-color-text-muted);
}

.dh-pagination {
    margin-top: 24px;
    text-align: center;
}

/* 文章详情 */
.dh-article {
    background: var(--dh-bg-card);
    border-radius: 8px;
    padding: 24px;
    border: 1px solid var(--dh-color-border);
    box-shadow: var(--dh-shadow);
}

.dh-article-title {
    margin: 0 0 12px;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
}

.dh-article-meta {
    font-size: 13px;
    color: var(--dh-color-text-muted);
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--dh-color-border);
}

.dh-article-meta a {
    color: var(--dh-color-text-muted);
}

.dh-article-body {
    font-size: 15px;
    line-height: 1.8;
}

.dh-article-body img {
    max-width: 100%;
    height: auto;
}

.dh-article-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--dh-color-border);
}

.dh-prev,
.dh-next {
    font-size: 14px;
}

/* 右侧挂件 */
.dh-widgets {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dh-widget {
    background: var(--dh-bg-card);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid var(--dh-color-border);
}

.dh-widget-title {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--dh-color-text);
}

.dh-widget-body {
    font-size: 13px;
    color: var(--dh-color-text-muted);
}

/* 底部登录提醒条（深度导航风格） */
.dh-login-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99;
    background: linear-gradient(90deg, #1e40af 0%, #2563eb 50%, #3b82f6 100%);
    color: #fff;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s ease;
}

.dh-login-bar.dh-login-bar-hidden {
    transform: translateY(100%);
}

.dh-login-bar-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px 56px 12px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.dh-login-bar-text {
    font-size: 14px;
    flex: 1;
    text-align: center;
}

.dh-login-bar-btn {
    display: inline-block;
    padding: 8px 24px;
    background: rgba(255, 255, 255, 0.95);
    color: #1e40af;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
}

.dh-login-bar-btn:hover {
    background: #fff;
    color: #1d4ed8;
}

.dh-login-bar-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
}

.dh-login-bar-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.dh-body.dh-has-login-bar {
    padding-bottom: 56px;
}

/* 页脚 */
.dh-footer {
    margin-top: auto;
    padding: 16px 24px;
    border-top: 1px solid var(--dh-color-border);
    background: var(--dh-bg-card);
    font-size: 13px;
    color: var(--dh-color-text-muted);
}

.dh-footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.dh-footer a {
    color: var(--dh-color-text-muted);
}

.dh-footer a:hover {
    color: var(--dh-color-primary);
}

/* 响应式：小屏隐藏侧边栏为抽屉 */
@media (max-width: 768px) {
    .dh-sidebar {
        transform: translateX(-100%);
    }

    .dh-body:not(.dh-sidebar-hidden) .dh-sidebar {
        transform: translateX(0);
    }

    .dh-main-wrap {
        margin-left: 0;
    }

    .dh-right-sidebar {
        display: none;
    }

    .dh-topbar-nav {
        display: none;
    }
}
