/* ===== 品牌色变量 ===== */
:root {
    --color-primary: #E6E6FA;        /* 淡紫色 - 导航栏/主色 */
    --color-primary-btn: #9880D0;    /* 按钮紫（深色可读） */
    --color-primary-btn-dark: #7D66B8;
    --color-pink: #FFD1DC;           /* 柔和粉 - 用户气泡 */
    --color-blue: #B0E0E6;           /* 清新蓝 - AI气泡 */
    --color-green: #E8F5E9;          /* 淡绿色 - 成功状态 */
    --color-bg: #F5F5F5;             /* 米白色 - 页面底色 */
    --color-text: #333333;
    --color-text-secondary: #666666;
    --color-text-hint: #999999;
    --color-divider: #EEEEEE;
    --color-warning-bg: #FFF8E1;
    --color-warning-text: #FFA000;
    --color-success-bg: #C8E6C9;
    --color-success-text: #2E7D32;
}

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--color-bg);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text);
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    background: var(--color-bg);
    overflow: hidden;
}

/* ===== 个性化问候区 ===== */
.welcome-section {
    padding: 28px 24px 0;
    flex-shrink: 0;
}

.greeting-heading {
    font-size: 30px;
    font-weight: 700;
    color: #333333;
    letter-spacing: -0.75px;
    line-height: 1.25;
    margin: 0;
}

.greeting-name {
    color: #D81B60;
}

.greeting-punct {
    color: #333333;
}

.greeting-subtitle {
    font-size: 14px;
    color: #666666;
    margin: 6px 0 0;
    line-height: 1.5;
}

/* ===== 对话容器 ===== */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    padding-bottom: 148px; /* 为底部浮动区留空间 */
    background: var(--color-bg);
}

.chat-container::-webkit-scrollbar {
    width: 4px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: #D4C5F9;
    border-radius: 2px;
}

/* 时间戳 */
.timestamp {
    text-align: center;
    color: var(--color-text-hint);
    font-size: 12px;
    margin: 16px 0 12px;
    background: rgba(0,0,0,0.04);
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    width: auto;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

/* 消息组 */
.message-group {
    margin-bottom: 12px;
}

/* ===== AI消息（卡片风格） ===== */
.message.ai {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 16px;
}

/* AI 头像圆圈 */
.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(176, 224, 230, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.message.ai .message-content {
    flex: 1;
    min-width: 0;
}

.message.ai .message-bubble {
    background: var(--color-blue);
    padding: 20px;
    border-radius: 4px 20px 20px 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.06);
    font-size: 14px;
    line-height: 1.7;
    color: #2a3a3d;
    word-wrap: break-word;
    box-sizing: border-box;
}

/* AI 卡片图标（欢迎消息） */
.ai-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-bottom: 14px;
}

.ai-card-body {
    margin-bottom: 18px;
}

.ai-card-body p {
    margin: 0 0 2px;
    line-height: 22.75px;
}

.ai-card-question {
    margin: 0;
    line-height: 22.75px;
    color: #1a3a42;
    font-weight: 500;
}

/* AI 回复富文本排版 */
.msg-paragraph {
    margin: 0 0 10px;
    line-height: 1.7;
}
.msg-paragraph:last-child { margin-bottom: 0; }

.msg-list-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 4px 0;
    line-height: 1.6;
}
.msg-list-item .msg-bullet { flex-shrink: 0; }

.msg-divider {
    height: 1px;
    background: rgba(255,255,255,0.4);
    margin: 12px 0;
}

/* ===== 用户消息 ===== */
.message.user {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 16px;
}

.message.user .message-content {
    max-width: 72%;
}

.message.user .message-bubble {
    background: var(--color-pink);
    color: #5a1a2e;
    border-radius: 20px 4px 20px 20px;
    box-shadow: 0 4px 16px -2px rgba(255, 209, 220, 0.5);
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.6;
}

/* 用户头像 */
.message-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F8A8BE, #E91E8C);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    color: white;
    font-weight: 600;
}

/* ===== 卡片 ===== */
.card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 8px;
    box-shadow: 0 2px 8px rgba(152, 128, 208, 0.12);
    max-width: 280px;
    border: 1px solid var(--color-divider);
}

.card-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-divider);
    font-weight: 600;
    color: #3D2D7A;
    font-size: 15px;
    background: linear-gradient(135deg, #F8F5FF 0%, #ffffff 100%);
}

.card-body {
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
}

.card-footer {
    padding: 10px 14px;
    border-top: 1px solid var(--color-divider);
    text-align: center;
    background: #FAFAFA;
}

.card-link {
    color: var(--color-primary-btn);
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
}

/* ===== 底部浮动区 ===== */
.bottom-floating {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: linear-gradient(to top, #F5F5F5 50%, rgba(245,245,245,0.95) 75%, transparent 100%);
    z-index: 100;
}

/* 快捷功能胶囊行 */
.quick-pills-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}

.quick-pills-row::-webkit-scrollbar {
    display: none;
}

.quick-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 13px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(238, 238, 238, 0.5);
    box-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.04);
    white-space: nowrap;
    cursor: pointer;
    font-size: 11px;
    color: #333333;
    flex-shrink: 0;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    transition: all 0.2s;
}

.quick-pill:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 1);
}

.pill-icon-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

/* 胶囊输入栏 */
.input-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 9999px;
    border: 1px solid #EEEEEE;
    padding: 7px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.input-bar-field {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 14px;
    color: var(--color-text);
    padding: 0 12px;
    height: 44px;
    min-width: 0;
}

.input-bar-field::placeholder {
    color: rgba(102, 102, 102, 0.5);
}

.input-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.input-btn:active {
    transform: scale(0.9);
}

.input-btn-attach {
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-btn-mic {
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-btn-send {
    background: var(--color-primary);
    color: #5C4A9A;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.input-right-btns {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* 兼容旧选择器（动态消息用） */
.input-container { display: none; }
.quick-actions-container { display: none; }

/* ===== 打字指示器 ===== */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 10px 14px;
    background: var(--color-blue);
    border-radius: 0 10px 10px 10px;
}

.typing-dot {
    width: 7px;
    height: 7px;
    background: #5BA3AE;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.6;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ===== 知识库项目 ===== */
.knowledge-item {
    background: #F8F5FF;
    padding: 10px 12px;
    border-radius: 8px;
    margin: 6px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #E8E0F8;
}

.knowledge-item:hover {
    background: var(--color-primary);
    border-color: #C8B8F0;
}

.knowledge-icon {
    font-size: 20px;
}

.knowledge-info {
    flex: 1;
}

.knowledge-title {
    font-size: 14px;
    font-weight: 600;
    color: #3D2D7A;
    margin-bottom: 2px;
}

.knowledge-meta {
    font-size: 12px;
    color: var(--color-text-hint);
}

/* ===== 提醒项目 ===== */
.reminder-item {
    background: var(--color-warning-bg);
    padding: 10px 12px;
    border-radius: 8px;
    margin: 6px 0;
    border-left: 3px solid var(--color-warning-text);
}

.reminder-time {
    font-size: 12px;
    color: #F57C00;
    font-weight: 600;
    margin-bottom: 4px;
}

.reminder-content {
    font-size: 13px;
    color: var(--color-text);
    line-height: 1.5;
}

/* ===== 响应式 ===== */
@media (max-width: 767px) {
    #app {
        width: 100%;
    }

    .chat-container {
        padding: 20px 16px 148px;
    }

    .welcome-section {
        padding: 24px 16px 0;
    }

    .greeting-heading {
        font-size: 26px;
    }
}

@media (min-width: 1024px) {
    body {
        display: flex;
        justify-content: center;
        background: #EDE8F8;
    }

    #app {
        max-width: 500px;
        margin: 0 auto;
        box-shadow: 0 0 24px rgba(152, 128, 208, 0.18);
        position: relative;
    }

    .bottom-floating {
        max-width: 500px;
        left: 50%;
        transform: translateX(-50%);
    }
}
