/* =============================================
   互联网医院在线客服 - 样式文件
   ============================================= */

/* --- 基础重置 --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-tap-highlight-color: transparent; /* 去掉移动端点击高亮 */
}

/* 去掉所有可点击元素的默认效果 */
button, a, .service-item, .qa-item, .try-btn, .quick-tag, .action-btn, .retry-btn, .send-btn, .back-btn, .refresh-btn, .mic-icon {
    -webkit-tap-highlight-color: transparent;
    outline: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body {
    background-color: #f0f2f5;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* --- 主容器 --- */
.app-container {
    width: 100%;
    height: 100vh;
    background: linear-gradient(180deg, #e6eeff 0%, #f7f9fc 30%, #f7f9fc 100%);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* --- 头部区域 --- */
.header {
    padding: 20px 20px 0 20px;
    display: flex;
    align-items: center;
}

.avatar-wrapper {
    width: 100px;
    height: 120px;
    margin-right: 15px;
    position: relative;
    flex-shrink: 0;
}

.header-text h1 {
    font-size: 22px !important;
    color: #1a2a44;
    margin-bottom: 16px;
    font-weight: 700;
}

.header-text p {
    font-size: 13px !important;
    margin-left: 8px !important;
    color: #3e3f41;
}

/* --- 主要内容区域 (可滚动) --- */
.content {
    flex: 1;
    padding: 0 15px 10px 15px;
    overflow-y: auto;
    /* 隐藏滚动条但保留功能 */
    scrollbar-width: none; 
}

.content::-webkit-scrollbar { 
    display: none; 
}

/* --- 通用卡片样式 --- */
.card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(230, 235, 245, 0.6);
}

/* 标题行：图标+文字 */
.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.section-icon {
    width: 24px;
    height: 24px;
    margin-right: 8px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* --- 服务网格布局 --- */
.services-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.service-item {
    background-color: #eff6ff; 
    border-radius: 12px;
    padding: 16px;
    width: calc(50% - 6px);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex-grow: 1;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.service-item:hover {
    box-shadow: 0 4px 12px rgba(74, 144, 255, 0.15);
}

.service-item:active {
    transform: scale(0.98);
}

.service-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
    color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.service-title {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.service-desc {
    font-size: 11px;
    color: #7f8fa4;
    line-height: 1.3;
}

/* --- 常见问题列表 --- */
.qa-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.refresh-btn {
    font-size: 14px;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.refresh-btn:hover {
    color: #4a90ff;
}

.qa-item {
    background-color: #f5f8fc;
    border-radius: 10px;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    transition: background-color 0.2s;
}

.qa-item:hover {
    background-color: #eef3fa;
}

.qa-text {
    font-size: 14px;
    color: #333;
}

.try-btn {
    background: linear-gradient(90deg, #6ecfff, #4a90ff);
    color: white;
    font-size: 12px;
    padding: 6px 16px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(74, 144, 255, 0.3);
    white-space: nowrap;
    transition: transform 0.2s, box-shadow 0.2s;
}

.try-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(74, 144, 255, 0.4);
}

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

/* --- 底部输入框 --- */
.footer {
    background: #fff;
    padding: 15px;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.03);
    position: relative;
    z-index: 10;
}

.chat-input-row {
    display: flex;
    align-items: center;
    width: 100%;
}

.mic-icon {
    width: 24px;
    height: 24px;
    margin-right: 12px;
    fill: #00b4ff;
    cursor: pointer;
    transition: fill 0.2s;
    flex-shrink: 0;
}
}

.mic-icon:hover {
    fill: #0096d6;
}

.input-box {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    color: #333;
    background: transparent;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    line-height: 1.5;
    font-family: inherit;
    overflow-y: auto;
}

.input-box::placeholder {
    color: #999;
}

.send-btn {
    background: linear-gradient(90deg, #66b5ff, #4089ff);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(64, 137, 255, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(64, 137, 255, 0.4);
    border: none;
    border-radius: 20px;
    color: white;
}

/* .send-btn:active {
    transform: translateY(0);
} */

/* --- 悬浮按钮 (右侧头像) --- */
.floating-icon {
    position: absolute;
    right: 15px;
    bottom: 100px;
    width: 50px;
    height: 50px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
    border: 2px solid #eef5ff;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.floating-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.floating-icon img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
}

/* --- 动画效果 --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.3s ease-out;
}

/* =============================================
   聊天消息列表样式
   ============================================= */

/* 聊天模式下隐藏首页内容 */
.app-container.chat-mode .home-content {
    display: none;
}

.app-container.chat-mode .header {
    display: none;
}

/* 聊天消息容器 */
.chat-container {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.app-container.chat-mode .chat-container {
    display: flex;
}

/* 聊天消息列表 */
.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    scrollbar-width: none;
}

.chat-messages::-webkit-scrollbar {
    display: none;
}

/* 消息项基础样式 */
.message-item {
    display: flex;
    margin-bottom: 20px;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 用户消息 - 右侧 */
.message-item.user {
    justify-content: flex-end;
}

.message-item.user .message-bubble {
    background: linear-gradient(135deg, #4a9fff, #2d7be5);
    color: white;
    border-radius: 20px 20px 4px 20px;
    padding: 12px 18px;
    max-width: 75%;
    font-size: 15px;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(74, 159, 255, 0.3);
}

/* AI 消息 - 左侧 */
.message-item.ai {
    justify-content: flex-start;
    flex-direction: column;
    align-items: flex-start;
}

.message-item.ai .message-bubble {
    background: #fff;
    color: #333;
    border-radius: 20px 20px 20px 4px;
    padding: 16px 18px;
    max-width: 100%;
    font-size: 15px;
    line-height: 1.6;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

/* 系统消息 - 左侧，无免责声明 */
.message-item.system {
    justify-content: flex-start;
    flex-direction: column;
    align-items: flex-start;
}

.message-item.system .message-bubble {
    background: #fff;
    color: #333;
    border-radius: 20px 20px 20px 4px;
    padding: 16px 18px;
    max-width: 100%;
    font-size: 15px;
    line-height: 1.6;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

.message-item.ai .message-content {
    margin-bottom: 10px;
}

/* Markdown 样式 */
.message-bubble h2,
.message-bubble h3,
.message-bubble h4 {
    margin: 8px 0 4px 0;
    font-weight: 600;
}

.message-bubble h2 {
    font-size: 16px;
}

.message-bubble h3 {
    font-size: 15px;
}

.message-bubble h4 {
    font-size: 14px;
}

.message-bubble strong {
    font-weight: 600;
}

.message-bubble em {
    font-style: italic;
}

.message-bubble a {
    color: #4a90ff;
    text-decoration: none;
}

.message-bubble a:hover {
    text-decoration: underline;
}

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

.message-bubble li {
    margin: 4px 0;
    line-height: 1.5;
}

.message-bubble pre {
    background: #f5f7fa;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    font-size: 13px;
}

.message-bubble code {
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
}

.message-bubble .inline-code {
    background: #f0f4f8;
    padding: 2px 6px;
    border-radius: 4px;
    color: #e83e8c;
}

.message-bubble hr {
    border: none;
    border-top: 1px solid #e8e8e8;
    margin: 12px 0;
}

.message-item.user .message-bubble a {
    color: #fff;
    text-decoration: underline;
}

.message-item.user .message-bubble .inline-code {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* 加载动画 */
.loading-bubble {
    padding: 16px 24px;
}

.loading-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: #4a90ff;
    border-radius: 50%;
    animation: loadingBounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes loadingBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* AI 提示文字 */
.message-item.ai .ai-disclaimer {
    font-size: 12px;
    color: #aaa;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

/* 点赞/点踩按钮 */
.message-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    gap: 4px;
}

.action-btn {
    background: #fff;
    border: none;
    padding: 6px 10px;
    border-radius: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.2s;
}

.action-btn:hover {
    background: #f5f5f5;
    color: #666;
}

.action-btn.active {
    color: #4a90ff;
}

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

/* 重新提问按钮 */
.retry-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #e8e8e8;
    padding: 10px 24px;
    border-radius: 25px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    margin: 15px auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.retry-btn:hover {
    background: #f9f9f9;
    border-color: #ddd;
}

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

/* 悬浮头像 - 聊天模式 */
.chat-floating-avatar {
    position: absolute;
    right: 15px;
    bottom: 180px;
    width: 60px;
    height: 60px;
    z-index: 20;
}

.chat-floating-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* 快捷入口标签 */
.quick-tags {
    display: flex;
    gap: 10px;
    padding: 10px 15px 10px 70px;
    overflow-x: auto;
    scrollbar-width: none;
}

.quick-tags::-webkit-scrollbar {
    display: none;
}

.quick-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    padding: 10px 16px;
    border-radius: 25px;
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    transition: all 0.2s;
}

.quick-tag:hover {
    background: #f5f9ff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.quick-tag svg {
    width: 20px;
    height: 20px;
}

.quick-tag.ai-service svg {
    fill: #4a90ff;
}

.quick-tag.guide svg {
    fill: #2ecc71;
}

/* 底部小头像 */
.footer-avatar {
    position: absolute;
    left: -5px;
    bottom: 60px;
    width: 90px;
    height: 90px;
    z-index: 15;
    pointer-events: none;
}

.footer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50% 50% 0 0;
    filter: drop-shadow(2px 2px 8px rgba(0,0,0,0.1));
}

/* 聊天模式下的底部栏调整 */
.app-container.chat-mode .footer {
    flex-direction: column;
    padding: 10px 15px 15px;
    border-radius: 0;
}

.footer-wrapper {
    position: relative;
    width: 100%;
}

.chat-input-row {
    display: flex;
    align-items: center;
    width: 100%;
}

/* --- 响应式适配 --- */
@media screen and (max-width: 768px) {
    .header-text h1 {
        font-size: 18px;
    }
    
    .header-text p {
        font-size: 12px;
    }
}
