/* navigation.css - 快速导航、滚动到底部、滚动条样式 */

/* ===== Quick Nav - 一体化问题导航 ===== */
/* 默认收缩为小圆点列，悬浮展开显示问题文本 */

.quick-nav-wrapper {
    position: fixed;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 11;
}

.quick-nav-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    padding: 6px;
    background: transparent;
    border: 1.5px solid transparent;
    border-radius: 10px;
    transition: all 0.25s ease;
    overscroll-behavior: contain;
    scrollbar-width: none;
}

.quick-nav-list::-webkit-scrollbar {
    width: 0;
    display: none;
}

/* 悬浮时展开：显示背景边框 */
.quick-nav-wrapper:hover .quick-nav-list {
    background: var(--bg-secondary);
    border-color: var(--border-sketch);
    box-shadow: -2px 3px 0px rgba(60, 50, 30, 0.08);
    padding: 6px 8px;
    gap: 1px;
    scrollbar-width: thin;
    scrollbar-color: rgba(178, 168, 148, 0.35) transparent;
}

.quick-nav-wrapper:hover .quick-nav-list::-webkit-scrollbar {
    width: 4px;
    display: block;
}

.quick-nav-wrapper:hover .quick-nav-list::-webkit-scrollbar-track {
    background: transparent;
}

.quick-nav-wrapper:hover .quick-nav-list::-webkit-scrollbar-thumb {
    background: rgba(178, 168, 148, 0.35);
    border-radius: 999px;
}

/* 空状态 */
.quick-nav-empty {
    padding: 8px 4px;
    text-align: center;
    color: var(--text-tertiary);
    font-family: var(--font-hand);
    font-size: 12px;
    white-space: nowrap;
}

/* 单个导航项 */
.quick-nav-item {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 4px 2px;
    flex: 0 0 auto;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    white-space: nowrap;
}

.quick-nav-item:hover {
    background: var(--accent-light);
}

/* 圆点指示器 */
.quick-nav-dot {
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-color);
    opacity: 0.5;
    transition: all 0.2s ease;
}

.quick-nav-item:hover .quick-nav-dot,
.quick-nav-item.active .quick-nav-dot {
    background: var(--accent-primary);
    opacity: 1;
}

/* 问题文本（默认隐藏） */
.quick-nav-text {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.3;
    color: var(--text-primary);
    transition: all 0.25s ease;
    padding-left: 0;
}

/* 悬浮展开时显示文本 */
.quick-nav-wrapper:hover .quick-nav-text {
    max-width: 180px;
    opacity: 1;
    padding-left: 8px;
}

/* 序号标记 */
.quick-nav-index {
    flex-shrink: 0;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    font-size: 10px;
    font-family: var(--font-hand);
    font-weight: 600;
    color: var(--text-tertiary);
    transition: all 0.25s ease;
    padding-left: 0;
}

.quick-nav-wrapper:hover .quick-nav-index {
    max-width: 20px;
    opacity: 1;
    padding-left: 6px;
}

/* Scroll to bottom */
.scroll-to-bottom {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(calc(-50% + var(--sidebar-width) / 2)) translateY(0);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-sketch);
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sketch);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
    z-index: 10;
    opacity: 0;
}

.scroll-to-bottom.sidebar-collapsed {
    transform: translateX(-50%) translateY(0) !important;
}

.scroll-to-bottom:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: translateX(calc(-50% + var(--sidebar-width) / 2)) translateY(-2px);
    box-shadow: 3px 4px 0px rgba(60, 50, 30, 0.15);
}

.scroll-to-bottom.sidebar-collapsed:hover {
    transform: translateX(-50%) translateY(-2px) !important;
}

.scroll-to-bottom svg {
    width: 16px;
    height: 16px;
}

/* ===== 滚动条 - 浅色手绘素描风格 ===== */
/* 设计理念：纤细温暖、若隐若现、圆润柔和 */

/* 全局默认滚动条 */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(178, 168, 148, 0.3);
    border-radius: 100px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(158, 149, 133, 0.5);
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* 主内容区滚动条 - 稍宽，提供更好的操控感 */
.main-content::-webkit-scrollbar {
    width: 6px;
}

.main-content::-webkit-scrollbar-track {
    background: transparent;
    margin: 12px 0;
}

.main-content::-webkit-scrollbar-thumb {
    background: rgba(178, 168, 148, 0.25);
    border-radius: 100px;
    border: 1px solid transparent;
    background-clip: content-box;
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: rgba(158, 149, 133, 0.45);
    border: 0;
}

/* 侧边栏会话列表 - 极细，不抢视线 */
.sidebar-sessions::-webkit-scrollbar {
    width: 2px;
}

.sidebar-sessions::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-sessions::-webkit-scrollbar-thumb {
    background: rgba(178, 168, 148, 0.25);
    border-radius: 100px;
}

.sidebar-sessions::-webkit-scrollbar-thumb:hover {
    background: rgba(158, 149, 133, 0.45);
}

/* 弹窗内部滚动条 */
.history-modal-body::-webkit-scrollbar {
    width: 4px;
}

.history-modal-body::-webkit-scrollbar-track {
    background: transparent;
    margin: 8px 0;
}

.history-modal-body::-webkit-scrollbar-thumb {
    background: rgba(178, 168, 148, 0.28);
    border-radius: 100px;
}

.history-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(158, 149, 133, 0.48);
}

/* 代码块滚动条 - 最细，融入代码背景 */
pre::-webkit-scrollbar {
    width: 3px;
    height: 3px;
}

pre::-webkit-scrollbar-track {
    background: transparent;
}

pre::-webkit-scrollbar-thumb {
    background: rgba(178, 168, 148, 0.22);
    border-radius: 100px;
}

pre::-webkit-scrollbar-thumb:hover {
    background: rgba(158, 149, 133, 0.4);
}

/* 建议弹窗滚动条（@ 和 #） */
.agent-suggestions::-webkit-scrollbar,
.file-suggestions::-webkit-scrollbar {
    width: 3px;
}

.agent-suggestions::-webkit-scrollbar-track,
.file-suggestions::-webkit-scrollbar-track {
    background: transparent;
}

.agent-suggestions::-webkit-scrollbar-thumb,
.file-suggestions::-webkit-scrollbar-thumb {
    background: rgba(178, 168, 148, 0.28);
    border-radius: 100px;
}

.agent-suggestions::-webkit-scrollbar-thumb:hover,
.file-suggestions::-webkit-scrollbar-thumb:hover {
    background: rgba(158, 149, 133, 0.48);
}

/* Firefox 滚动条 */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(178, 168, 148, 0.25) transparent;
}

.main-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(178, 168, 148, 0.25) transparent;
}

/* ===== Mobile Toolbar ===== */
.mobile-toolbar {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 0 0 8px;
}

.mobile-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 12px;
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.mobile-tool-btn:active {
    background: var(--accent-light);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.mobile-tool-btn svg {
    width: 14px;
    height: 14px;
}

.mobile-nav-btn {
    margin-left: auto;
    gap: 4px;
}

.mobile-nav-btn .nav-count {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
}

/* 移动端智能体标签 — 嵌入工具栏一行展示 */
.mobile-agent-tag {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 32px;
    padding: 0 10px;
    background: var(--warning-light);
    border: 1.5px solid var(--warning);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--warning);
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
}

.mobile-agent-tag-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100px;
}

.mobile-agent-tag-dismiss {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0;
    flex-shrink: 0;
}

.mobile-agent-tag-dismiss svg {
    width: 10px;
    height: 10px;
}

/* Mobile quick nav popup */
.mobile-nav-popup {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 6px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-sketch);
    border-radius: 10px;
    box-shadow: 0 -2px 12px rgba(60, 50, 30, 0.1);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 200px;
    max-width: calc(100vw - 40px);
    max-height: 240px;
    overflow-y: auto;
    z-index: 12;
    animation: mobileNavIn 0.15s ease;
}

@keyframes mobileNavIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.1s ease;
}

.mobile-nav-item:active {
    background: var(--accent-light);
}

.mobile-nav-index {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.mobile-nav-text {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-nav-empty {
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
}
