/* ============================================
   愈见 - AI 聊天界面样式（v2026-05-28）
   与主站 style.css 完全统一
   ============================================ */

/* ============================================
   小程序环境适配
   ============================================ */
:root {
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --capsule-width: 0px;
}

/* Chat App Layout — 全宽，无侧边栏 */
.chat-app {
    display: flex;
    flex-direction: column;
    margin-top: 64px;
    height: calc(100vh - 64px);
    background: var(--bg-light);
    overflow: hidden;
}

body.has-freemium-banner .chat-app {
    margin-top: calc(64px + 37px);
    height: calc(100vh - 64px - 37px);
}

/* ============================================
   对话历史抽屉（从左侧滑入）
   ============================================ */
.chat-drawer {
    position: fixed;
    left: -300px;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 1000;
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    transition: left 0.25s ease;
    overflow: hidden;
}

.chat-drawer.open {
    left: 0;
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    min-height: 64px;
    /* 小程序适配：避让状态栏 */
    padding-top: calc(16px + var(--status-bar-height, 0));
}

.drawer-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.drawer-header h2 img {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    object-fit: cover;
}

.drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--text-body);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.drawer-close:hover {
    background: var(--bg-light);
    color: var(--primary);
}

/* 抽屉内新对话按钮 */
.chat-drawer .new-chat-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-body);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.chat-drawer .new-chat-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* 抽屉会话列表 */
.sidebar-sessions {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.no-sessions {
    text-align: center;
    padding: 32px 16px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 4px;
}

.session-item:hover {
    background: var(--bg-light);
}

.session-item.active {
    background: var(--primary-light);
}

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

.session-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-time {
    display: block;
    font-size: 0.72rem;
    color: var(--text-light);
    margin-top: 2px;
}

.session-delete {
    background: none;
    border: none;
    padding: 4px;
    color: var(--text-light);
    cursor: pointer;
    opacity: 0;
    transition: var(--transition);
    border-radius: 4px;
    display: flex;
    align-items: center;
}

.session-item:hover .session-delete {
    opacity: 1;
}

.session-delete:hover {
    color: #E53E3E;
    background: #FFF5F5;
}

/* 抽屉底部 */
.drawer-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.drawer-footer .sidebar-stats {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
}

.stat-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-light);
}

.stat-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
}

.clear-all-btn {
    width: 100%;
    padding: 8px;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--radius-sm);
}

.clear-all-btn:hover {
    color: #E53E3E;
    background: #FFF5F5;
}

/* 抽屉遮罩 */
.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: 0;
    background: rgba(0,0,0,0.3);
    z-index: 999;
}

.drawer-overlay.active {
    display: block;
}

/* ============================================
   Chat Main Area
   ============================================ */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-light);
    /* 柔和渐变背景，与主站hero呼应 */
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(124,183,201,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(232,168,124,0.06) 0%, transparent 50%);
}

/* ============================================
   Chat Messages
   ============================================ */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
    min-height: 0;
    /* 柔和滚动 */
    scroll-behavior: smooth;
}

/* ============================================
   Welcome Screen
   ============================================ */
.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
    flex: 1;
    padding: 40px 20px 20px;
    text-align: center;
    overflow-y: auto;
}

.welcome-avatar {
    width: 72px;
    height: 72px;
    margin-bottom: 20px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(74,124,143,0.2);
    /* 与主站logo风格呼应的渐变边框 */
    padding: 3px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
}

.welcome-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.chat-welcome h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.welcome-desc {
    font-size: 0.92rem;
    color: var(--text-light);
    max-width: 380px;
    margin-bottom: 24px;
    line-height: 1.7;
}

.welcome-disclaimer {
    font-size: 0.78rem;
    color: var(--text-light);
    max-width: 400px;
    margin-top: 16px;
    line-height: 1.6;
    padding: 10px 14px;
    background: rgba(255, 193, 7, 0.05);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 193, 7, 0.12);
    text-align: left;
}

.welcome-disclaimer strong {
    color: #C05621;
}

/* ============================================
   Message Bubbles — IM/微信风格
   ============================================ */
.chat-message {
    display: flex;
    gap: 10px;
    padding: 6px 16px;
    max-width: 100%;
    width: 100%;
}

.user-message {
    flex-direction: row-reverse;
}

/* 消息头像 */
.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), rgba(124,183,201,0.2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    overflow: hidden;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 消息体容器 */
.message-body {
    display: flex;
    flex-direction: column;
    max-width: 88%;
}

/* AI 生成内容标识徽章 */
.ai-generated-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--text-light, #999);
    background: var(--bg-light, #f5f5f5);
    border: 1px solid var(--border, #e0e0e0);
    border-radius: 12px;
    padding: 2px 8px;
    margin-bottom: 6px;
    width: fit-content;
    line-height: 1.4;
    user-select: none;
}

/* 深色模式适配 */
[data-theme="dark"] .ai-generated-badge,
body.dark-mode .ai-generated-badge {
    background: #252545;
    border-color: #3a3a5a;
    color: #a0a0c0;
}

/* ============================================
   两步式回复气泡样式
   ============================================ */
.two-step-message {
    animation: none; /* 禁用淡入动画，避免卡顿 */
}

/* 情绪承接气泡（单气泡模式：含文本+打字指示器） */
.emotion-ack-bubble {
    background: var(--bg-white) !important;
    border: 1px solid var(--border) !important;
    border-left: 3px solid var(--accent) !important;
    border-radius: 18px !important;
    border-top-left-radius: 6px !important;
    font-size: 0.92rem;
    padding: 12px 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    line-height: 1.6;
    color: var(--text-dark);
    max-width: 80%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.emotion-ack-bubble .ack-text {
    line-height: 1.6;
}

/* emotion_ack 内置的打字指示器 */
.emotion-ack-bubble .ack-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 4px;
}

.emotion-ack-bubble .ack-typing i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.6;
    animation: ackTypingBounce 1.2s ease-in-out infinite;
    display: inline-block;
}

.emotion-ack-bubble .ack-typing i:nth-child(2) { animation-delay: 0.15s; }
.emotion-ack-bubble .ack-typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes ackTypingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* 深度回复气泡（单气泡就地替换） */
.deep-reply-bubble {
    background: var(--bg-white) !important;
    border: 1px solid var(--border) !important;
    border-radius: 18px !important;
    border-top-left-radius: 6px !important;
    font-size: 0.92rem;
    padding: 14px 18px;
    line-height: 1.75;
    color: var(--text-dark);
    max-width: 80%;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
    transition: opacity 0.25s ease;
}

/* 用户消息气泡 — 温暖蓝色，更大圆角 */
.user-content {
    background: var(--primary) !important;
    color: white !important;
    border-radius: 18px !important;
    border-top-right-radius: 6px !important;
    padding: 12px 16px !important;
    font-size: 0.92rem;
    line-height: 1.6;
    max-width: 80%;
    box-shadow: 0 2px 8px rgba(74,124,143,0.2);
}

.user-content code {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

/* AI普通消息气泡（非两步式） */
.assistant-message .message-content {
    background: var(--bg-white);
    color: var(--text-dark);
    border: 1px solid var(--border);
    border-radius: 18px;
    border-top-left-radius: 6px;
    padding: 12px 16px;
    font-size: 0.92rem;
    line-height: 1.75;
    max-width: 80%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

/* ============================================
   消息反馈按钮
   ============================================ */
.message-feedback {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    padding-left: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.assistant-message:hover .message-feedback,
.message-feedback:focus-within {
    opacity: 1;
}

.fb-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-white);
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.fb-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.fb-btn.fb-active.fb-up {
    background: #E6F9EE;
    border-color: #48BB78;
    color: #2D8A50;
}

.fb-btn.fb-active.fb-down {
    background: #FFF3E8;
    border-color: #E8A87C;
    color: #C05621;
}

.fb-btn:disabled {
    cursor: default;
}

.fb-reason-box {
    margin-top: 6px;
    width: 100%;
}

.fb-reason-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 0.82rem;
    font-family: inherit;
    resize: none;
    outline: none;
    color: var(--text-dark);
    background: var(--bg-white);
    box-sizing: border-box;
}

.fb-reason-input:focus {
    border-color: var(--primary);
}

.fb-reason-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.fb-reason-actions button {
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.fb-reason-submit {
    background: var(--primary);
    color: white;
    border-color: var(--primary) !important;
}

.fb-reason-submit:hover {
    background: var(--primary-dark);
}

.fb-reason-cancel {
    background: none;
    color: var(--text-light);
}

.fb-reason-cancel:hover {
    background: var(--bg-light);
}

.message-content strong {
    color: var(--primary-dark);
    font-weight: 700;
}

.user-content strong {
    color: white;
}

/* ============================================
   简洁回复中提示（单气泡内）
   ============================================ */
.typing-simple {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-light);
    font-size: 0.88rem;
    opacity: 0.7;
}

.typing-simple::after {
    content: '...';
    animation: dotsPulse 1.4s steps(4, end) infinite;
    width: 1.2em;
    display: inline-block;
    overflow: hidden;
}

@keyframes dotsPulse {
    0%   { width: 0; }
    25%  { width: 0.3em; }
    50%  { width: 0.6em; }
    75%  { width: 0.9em; }
    100% { width: 1.2em; }
}

/* ============================================
   Input Area — 胶囊形，与主站风格统一
   ============================================ */
.chat-input-area {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 12px));
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.input-wrapper {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--bg-light);
    border: 1.5px solid var(--border);
    border-radius: 24px;  /* 胶囊形 */
    padding: 8px 12px 8px 18px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    overflow: hidden;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74,124,143,0.1);
    background: white;
}

.input-wrapper textarea {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px; /* iOS防止自动缩放 */
    color: var(--text-dark);
    line-height: 1.5;
    resize: none;
    font-family: inherit;
    padding: 6px 0;
    max-height: 120px;
    min-height: 24px;
    overflow-y: auto;
}

.input-wrapper textarea:focus {
    outline: none;
}

.input-wrapper textarea::placeholder {
    color: var(--text-light);
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.char-count {
    font-size: 0.7rem;
    color: var(--text-light);
    white-space: nowrap;
}

/* 发送按钮 — 圆形，与主站按钮风格统一 */
.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(74,124,143,0.25);
}

.send-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.send-btn:active {
    transform: scale(0.95);
    opacity: 0.85;
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.send-btn svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   错误/提示消息
   ============================================ */
.error-message {
    color: #E53E3E;
    padding: 8px 0;
    font-size: 0.88rem;
}

.two-step-error {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(229, 62, 62, 0.08);
    border-radius: 8px;
    font-size: 0.8rem;
}

.two-step-error .error-text {
    color: #C53030;
    flex: 1;
}

.two-step-error .retry-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.two-step-error .retry-btn:hover {
    background: var(--primary-dark);
}

/* ============================================
   消息内代码块
   ============================================ */
.message-content code {
    background: var(--bg-light);
    color: var(--primary-dark);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.message-content ul, .message-content ol {
    margin: 6px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 4px 0;
    line-height: 1.6;
}

.message-content pre {
    background: var(--bg-section);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 8px 0;
}

.message-content pre code {
    background: none;
    padding: 0;
    font-size: 0.85rem;
}

/* ============================================
   Settings Panel（保留兼容，已隐藏）
   ============================================ */
.settings-panel {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    animation: slideDown 0.15s ease;
}

@keyframes slideDown {
    from { opacity: 0; }
    to { opacity: 1; }
}

.settings-content {
    max-width: 560px;
    margin: 0 auto;
    padding: 24px 32px;
}

.settings-content h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.settings-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 20px;
}

.settings-form .form-group {
    margin-bottom: 16px;
}

.settings-form .form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.settings-form .form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--text-dark);
    background: var(--bg-light);
    font-family: monospace;
    transition: var(--transition);
}

.settings-form .form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(74,124,143,0.1);
}

.settings-form .form-group small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 4px;
}

.settings-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.settings-info {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.6;
}

.settings-info code {
    background: var(--primary-light);
    color: var(--primary);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.78rem;
}

/* ============================================
   导航栏右侧动作按钮（对话历史抽屉触发器）
   ============================================ */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.drawer-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(74,124,143,0.06);
    border: 1.5px solid rgba(74,124,143,0.15);
    border-radius: 10px;
    color: var(--text-body);
    cursor: pointer;
    transition: var(--transition);
}

.drawer-toggle:hover {
    background: rgba(74,124,143,0.1);
    border-color: var(--primary);
    color: var(--primary);
}

/* ============================================
   Responsive — Mobile
   ============================================ */
@media (max-width: 768px) {
    body.has-freemium-banner .chat-app {
        margin-top: calc(64px + 37px);
        height: calc(100vh - 64px - 37px);
    }

    .chat-app {
        margin-top: 64px;
        height: calc(100vh - 64px);
    }

    /* 移动端抽屉占满屏幕宽度 */
    .chat-drawer {
        width: 85%;
        max-width: 300px;
    }

    .chat-message {
        padding: 6px 12px;
    }

    .message-body {
        max-width: 92%;
    }

    .emotion-ack-bubble,
    .deep-reply-bubble,
    .assistant-message .message-content {
        max-width: 85%;
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .user-content {
        max-width: 85%;
        padding: 10px 14px !important;
        font-size: 0.9rem;
    }

    .chat-input-area {
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 10px));
    }

    .input-wrapper {
        border-radius: 22px;
        padding: 6px 8px 6px 14px;
    }

    .chat-messages {
        padding: 16px 0;
    }

    .chat-welcome {
        padding: 32px 16px 16px;
    }

    .welcome-avatar {
        width: 56px;
        height: 56px;
    }

    .chat-welcome h2 {
        font-size: 1.2rem;
    }

    .welcome-desc {
        font-size: 0.88rem;
    }

    .send-btn {
        width: 38px;
        height: 38px;
    }

    /* 移动端隐藏导航栏内的抽屉按钮（用汉堡菜单代替） */
    .nav-actions {
        display: none;
    }
}

@media (max-width: 480px) {
    .emotion-ack-bubble,
    .deep-reply-bubble,
    .assistant-message .message-content,
    .user-content {
        max-width: 90%;
    }
}

/* ============================================
   心理评估问卷样式（保留兼容）
   ============================================ */
.assessment-intro {
    padding: 8px 0;
}

.assessment-intro-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.assessment-intro-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.assessment-intro-desc {
    font-size: 0.88rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 16px;
}

.assessment-scale-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.assessment-scale-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 18px;
    background: var(--bg-light);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.assessment-scale-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.assessment-scale-btn-both {
    border-color: rgba(74, 124, 143, 0.3);
    background: linear-gradient(135deg, var(--bg-light) 0%, rgba(74,124,143,0.05) 100%);
}

.scale-btn-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.scale-btn-desc {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Question Card */
.assessment-question {
    padding: 4px 0;
}

.aq-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.aq-progress {
    font-size: 0.78rem;
    color: var(--primary);
    font-weight: 700;
}

.aq-scale-name {
    font-size: 0.75rem;
    color: var(--text-light);
    background: var(--bg-light);
    padding: 2px 10px;
    border-radius: 20px;
}

.aq-progress-bar {
    height: 4px;
    background: var(--bg-light);
    border-radius: 2px;
    margin-bottom: 14px;
    overflow: hidden;
}

.aq-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #7CB7C9);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.aq-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 14px;
    line-height: 1.6;
}

.aq-sensitive-banner {
    padding: 10px 14px;
    background: rgba(255, 193, 7, 0.08);
    border: 1px solid rgba(255, 193, 7, 0.15);
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: 0.82rem;
    color: #744210;
    line-height: 1.6;
}

.aq-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aq-option-btn {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-dark);
    line-height: 1.5;
}

.aq-option-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.aq-option-btn.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.aq-option-label {
    display: block;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 2px;
}

.aq-option-text {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
}

.aq-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.aq-btn {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    cursor: pointer;
    transition: var(--transition);
    border: 1.5px solid var(--border);
    background: var(--bg-white);
    color: var(--text-body);
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aq-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.aq-btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.aq-btn-primary:hover {
    background: var(--primary-dark);
}

/* Assessment Result */
.assessment-result {
    padding: 8px 0;
}

.ar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.ar-icon {
    font-size: 1.5rem;
}

.ar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
}

.ar-score {
    font-size: 0.92rem;
    color: var(--text-body);
    margin-bottom: 8px;
    padding: 10px 14px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
}

.ar-score strong {
    color: var(--primary);
}

.ar-interpretation {
    font-size: 0.9rem;
    color: var(--text-body);
    line-height: 1.7;
    margin-bottom: 16px;
}

.ar-suggestion {
    padding: 12px 16px;
    background: rgba(72, 187, 120, 0.06);
    border: 1px solid rgba(72, 187, 120, 0.15);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: #2D8A50;
    line-height: 1.6;
}

.ar-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

/* ============================================
   深色模式适配
   ============================================ */
@media (prefers-color-scheme: dark) {
    .chat-app {
        background: #1a1a2e;
    }

    .chat-main {
        background: #1f1f3a;
        background-image:
            radial-gradient(ellipse at 20% 50%, rgba(74,124,143,0.1) 0%, transparent 50%),
            radial-gradient(ellipse at 80% 20%, rgba(124,183,201,0.06) 0%, transparent 50%);
    }

    .chat-drawer {
        background: #1f1f3a;
        border-color: #3a3a5a;
    }

    .drawer-header {
        border-color: #3a3a5a;
    }

    .emotion-ack-bubble,
    .deep-reply-bubble,
    .assistant-message .message-content {
        background: #252545 !important;
        border-color: #3a3a5a !important;
        color: #e0e0e0 !important;
    }

    .emotion-ack-bubble {
        background: linear-gradient(135deg, #1f1f3a, #252545) !important;
    }

    .user-content {
        background: var(--primary-dark) !important;
    }

    .input-wrapper {
        background: #2a2a4a;
        border-color: #3a3a5a;
    }

    .input-wrapper:focus-within {
        background: #2a2a4a;
    }

    .chat-input-area {
        background: #1f1f3a;
        border-color: #3a3a5a;
    }
}

/* ============================================
   小程序特定适配
   ============================================ */
@media screen and (max-height: 600px) {
    .chat-app {
        height: calc(100vh - 60px);
        margin-top: 60px;
    }

    .chat-messages {
        padding: 16px 0;
    }

    .chat-welcome {
        padding: 24px 16px;
    }

    .welcome-avatar {
        width: 48px;
        height: 48px;
        margin-bottom: 12px;
    }

    .chat-input-area {
        padding: 10px 16px 16px;
    }
}

/* 微信小程序胶囊按钮避让 */
.floating-action-btns {
    position: fixed;
    right: 16px;
    bottom: calc(90px + env(safe-area-inset-bottom, 16px));
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 50;
}

.fab-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(74,124,143,0.3);
    cursor: pointer;
    transition: var(--transition);
}

.fab-btn:active {
    opacity: 0.85;
}

.fab-btn svg {
    width: 20px;
    height: 20px;
}
