:root {
    --mountain-primary: #2d6a4f;
    --mountain-secondary: #40916c;
    --mountain-accent: #52b788;
    --mountain-light: #d8f3dc;
    --mountain-dark: #1b4332;
    --mountain-bg: #f0faf4;
}

body {
    background: var(--mountain-bg);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* 导航栏 */
.navbar-custom {
    background: linear-gradient(135deg, var(--mountain-dark), var(--mountain-primary));
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.navbar-custom .navbar-brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.3rem;
}

/* 品牌组合：主标「途启山海」+ 竖线分隔 + 功能副标。
   防回归：brand-sub/brand-divider 为浅色系属设计预期（弱化副标、突出主标），勿当遗漏改回纯白 */
.brand-main { letter-spacing: 2px; }
.brand-divider { margin: 0 .5rem; font-weight: 300; color: rgba(255, 255, 255, 0.45); }
.brand-sub { font-size: 0.78rem; font-weight: 400; letter-spacing: 1px; color: rgba(255, 255, 255, 0.72); }

.navbar-custom .navbar-text {
    color: rgba(255, 255, 255, 0.8);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-ok .status-dot { background: #51cf66; box-shadow: 0 0 6px #51cf66; }
.status-error .status-dot { background: #ff6b6b; box-shadow: 0 0 6px #ff6b6b; }
.status-loading .status-dot { background: #fcc419; animation: pulse 1s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Tab 导航 */
.nav-tabs-custom .nav-link {
    color: var(--mountain-primary);
    border: none;
    padding: 12px 24px;
    font-weight: 500;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s;
}

.nav-tabs-custom .nav-link:hover {
    background: rgba(45, 106, 79, 0.08);
}

.nav-tabs-custom .nav-link.active {
    background: #fff;
    color: var(--mountain-dark);
    font-weight: 600;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}

/* 卡片 */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* 输入区域 */
.query-input {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 12px 16px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.query-input:focus {
    border-color: var(--mountain-accent);
    box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.15);
}

/* 按钮 */
.btn-mountain {
    background: linear-gradient(135deg, var(--mountain-primary), var(--mountain-secondary));
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 24px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-mountain:hover {
    background: linear-gradient(135deg, var(--mountain-dark), var(--mountain-primary));
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 106, 79, 0.3);
}

.btn-mountain:active {
    transform: translateY(0);
}

.btn-mountain:disabled {
    background: #adb5bd;
    transform: none;
    box-shadow: none;
}

/* 结果展示区 */
.result-area {
    background: #fff;
    border-radius: 12px;
    min-height: 300px;
    max-height: 600px;
    overflow-y: auto;
}

.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: #adb5bd;
}

.result-placeholder i {
    font-size: 3rem;
    margin-bottom: 12px;
}

/* Markdown 渲染样式 */
.markdown-body {
    padding: 24px;
    font-size: 0.95rem;
    line-height: 1.7;
}

.markdown-body h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--mountain-dark);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--mountain-light);
}

.markdown-body h2 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--mountain-primary);
    margin-top: 24px;
    margin-bottom: 12px;
}

.markdown-body h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--mountain-secondary);
    margin-top: 20px;
    margin-bottom: 10px;
}

.markdown-body p {
    margin-bottom: 10px;
}

.markdown-body ul, .markdown-body ol {
    padding-left: 24px;
    margin-bottom: 12px;
}

.markdown-body li {
    margin-bottom: 4px;
}

.markdown-body strong {
    color: var(--mountain-dark);
}

.markdown-body blockquote {
    border-left: 4px solid var(--mountain-accent);
    padding: 8px 16px;
    margin: 12px 0;
    background: var(--mountain-light);
    border-radius: 0 8px 8px 0;
}

.markdown-body code {
    background: #f1f3f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.markdown-body pre {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
}

.markdown-body pre code {
    background: none;
    padding: 0;
}

.markdown-body hr {
    border: none;
    border-top: 2px solid var(--mountain-light);
    margin: 20px 0;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

.markdown-body th, .markdown-body td {
    border: 1px solid #dee2e6;
    padding: 8px 12px;
    text-align: left;
}

.markdown-body th {
    background: var(--mountain-light);
    font-weight: 600;
}

/* ===== 发现结果排版（仅作用于发现页，不影响攻略页） =====
   景点条目是"加粗标题段 + 详情无序列表"的 Markdown 结构（见
   discover_orchestrator._format_spot）。标题维持正文字号承担强调，
   详情行缩小字号、弱化颜色并放宽行距，避免大批量结果（约50条）时
   整页等宽等距、行贴行显得拥挤 */
#discoverResult p {
    margin-bottom: 4px;
}

#discoverResult ul,
#discoverResult ol {
    padding-left: 20px;
    margin-bottom: 18px;
}

#discoverResult li {
    font-size: 0.88em;
    line-height: 1.8;
    color: #5b6570;
    margin-bottom: 4px;
}

/* 意图信息卡片 */
.intent-card {
    background: linear-gradient(135deg, var(--mountain-light), #fff);
    border-left: 4px solid var(--mountain-accent);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.intent-card .intent-label {
    font-size: 0.8rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.intent-card .intent-value {
    font-weight: 600;
    color: var(--mountain-dark);
}

/* 聊天界面 */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.chat-bubble {
    max-width: 80%;
    padding: 10px 16px;
    border-radius: 16px;
    margin-bottom: 12px;
    word-wrap: break-word;
    line-height: 1.6;
}

.chat-bubble.user {
    background: linear-gradient(135deg, var(--mountain-primary), var(--mountain-secondary));
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.chat-bubble.assistant {
    background: #fff;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
}

.chat-bubble .role-label {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-bottom: 4px;
}

.chat-input-area {
    border-top: 1px solid #e9ecef;
    padding: 12px 16px;
    background: #fff;
    border-radius: 0 0 12px 12px;
}

/* SSE 进度 */
.sse-progress {
    padding: 16px;
}

.sse-event {
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    font-size: 0.85rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.sse-event.intent_parsed { background: #d3f9d8; color: #2b8a3e; }
.sse-event.progress { background: #fff3bf; color: #e67700; }
.sse-event.tool_call { background: #d0ebff; color: #1971c2; }
.sse-event.plan_complete { background: #d3f9d8; color: #2b8a3e; }
.sse-event.error { background: #ffe3e3; color: #c92a2a; }

/* 提供商选择 */
.provider-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    padding: 6px 12px;
}

.provider-select:focus {
    border-color: var(--mountain-accent);
    box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.15);
}

/* 加载动画 */
.spinner-overlay {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    color: var(--mountain-primary);
}

.spinner-overlay.active {
    display: flex;
}

/* 发现页单行动态进度状态行：固定一行高，新步骤从底部滑入把上一条
   （标记 ✓ 后）向上顶出裁掉，完成时定格「搜索并处理完成」 */
.discover-status {
    padding: 0 20px 16px;
    margin-top: -8px;
    color: var(--mountain-primary);
    font-size: 0.95rem;
}

.discover-status-window {
    position: relative;
    height: 1.6em;
    overflow: hidden;
}

.discover-status-step {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    transform: translateY(100%);
    opacity: 1;
    transition: transform 0.35s ease, opacity 0.35s ease;
}

.discover-status-step.entered {
    transform: translateY(0);
}

.discover-status-step.leaving {
    transform: translateY(-100%);
    opacity: 0;
}

.discover-status-step.done,
.discover-status-step.final {
    color: #198754;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
}

/* 响应式 */
@media (max-width: 768px) {
    .chat-bubble {
        max-width: 90%;
    }
}

/* 滚动条美化 */
.result-area::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.result-area::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.result-area::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 3px;
}

.result-area::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

/* 快捷查询标签 */
.quick-tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--mountain-light);
    color: var(--mountain-primary);
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.quick-tag:hover {
    background: var(--mountain-accent);
    color: #fff;
    border-color: var(--mountain-secondary);
}

/* Session info */
.session-info {
    font-size: 0.75rem;
    color: #868e96;
    padding: 4px 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

/* 出行方式选择器 */
.transport-mode-group .btn-outline-primary {
    font-size: 0.82rem;
    padding: 4px 12px;
    border-color: #dee2e6;
    color: #495057;
    transition: all 0.2s;
}

.transport-mode-group .btn-outline-primary:hover {
    background: var(--mountain-light);
    border-color: var(--mountain-accent);
    color: var(--mountain-primary);
}

.transport-mode-group .btn-check:checked + .btn-outline-primary {
    background: var(--mountain-primary);
    border-color: var(--mountain-primary);
    color: #fff;
}

.transport-mode-group .btn-check:checked + .btn-outline-primary:hover {
    background: var(--mountain-dark);
    border-color: var(--mountain-dark);
}

.mode-hint {
    font-size: 0.75rem;
    color: var(--mountain-secondary);
    font-style: italic;
}

/* ─── 会话侧栏 ─── */

.session-sidebar {
    position: fixed;
    left: 0;
    top: 56px; /* navbar height */
    bottom: 0;
    width: 280px;
    background: #fff;
    border-right: 1px solid #dee2e6;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.08);
}

.session-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
    background: var(--mountain-light);
}

.session-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.session-item:hover {
    background: var(--mountain-light);
    border-color: #e9ecef;
}

.session-item.active {
    background: #fff;
    border-color: var(--mountain-accent);
    box-shadow: 0 2px 8px rgba(82, 183, 136, 0.15);
}

.session-item-main {
    flex: 1;
    min-width: 0;
}

.session-item-title {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--mountain-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-item.active .session-item-title {
    color: var(--mountain-primary);
}

.session-item-meta {
    font-size: 0.75rem;
    color: #868e96;
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.session-item-actions {
    display: none;
    gap: 2px;
    margin-left: 8px;
}

.session-item:hover .session-item-actions {
    display: flex;
}

.session-item-actions .btn {
    padding: 2px 4px;
    font-size: 0.75rem;
}

.session-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1045;
}

/* 移动端会话侧栏全屏 */
@media (max-width: 768px) {
    .session-sidebar {
        width: 100%;
    }
}

/* ─── 反馈按钮 ─── */

.feedback-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.feedback-bar .btn-feedback {
    padding: 4px 10px;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    background: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.feedback-bar .btn-feedback:hover {
    background: var(--mountain-light);
    border-color: var(--mountain-accent);
}

.feedback-bar .btn-feedback.active-positive {
    background: #d3f9d8;
    border-color: #51cf66;
    color: #2b8a3e;
}

.feedback-bar .btn-feedback.active-negative {
    background: #ffe3e3;
    border-color: #ff6b6b;
    color: #c92a2a;
}

.feedback-correction {
    display: none;
    margin-top: 8px;
}

.feedback-correction.show {
    display: block;
}

.feedback-correction textarea {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 8px;
    font-size: 0.85rem;
    resize: vertical;
}

/* ─── 图片上传 ─── */

.image-upload-area {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.image-upload-area .btn-upload {
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.85rem;
}

.image-preview {
    position: relative;
    display: inline-block;
    max-width: 120px;
    max-height: 80px;
    border-radius: 8px;
    border: 2px solid var(--mountain-accent);
    overflow: hidden;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview .btn-remove-image {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
