/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    overflow: hidden;
    position: relative;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
}

/* 等比例缩放容器 */
.scale-container {
    position: relative;
    width: 1920px;
    height: 1080px; /* 固定基准高度，配合JavaScript缩放 */
    transform-origin: top left;
    margin: 0 auto;
}

/* 背景图片 */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/bg@3x.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
}

/* 主容器 */
.container {
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 35% 1fr 28%; /* 医生区域宽度增加到35% */
    grid-template-rows: auto 1fr;
    grid-template-areas: 
        "logo . chat-title"
        "doctor report chat";
    gap: 20px;
    padding: 60px 70px 0px 20px; /* 上 右 下 左 - 移除底部padding */
}

/* Logo区域 */
.logo {
    grid-area: logo;
    align-self: start;
    justify-self: start;
    margin-left: 30px; /* 距离左边30px */
}

.logo img {
        max-width: 350px; /* Logo大小设置为300px */
    height: auto;
}

/* 状态显示区域 */
.status-box {
    position: absolute; /* 绝对定位，相对于缩放容器 */
    top: 50px; /* 距离顶部 */
    right: 55px; /* 距离右侧50px，与Logo对称 */
    z-index: 1000; /* 确保在最上层 */
    display: flex;
    align-items: center;
    gap: 20px; /* 增加间距 */
    padding: 20px 30px; /* 增加内边距 */
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 0.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    color: white;
    min-width: 300px; /* 设置最小宽度 */
    max-width: 200px; /* 最大宽度200px */
}

.status-icon img {
    width: 49px; /* 147÷3 = 49px */
    height: auto;
}

.status-text {
    display: flex;
    flex-direction: column;
    gap: 6px; /* 增大10% */
}

.user-name {
    font-size: 18px; /* 增大字体 */
    font-weight: bold;
}

.status {
    font-size: 16px; /* 增大字体 */
    opacity: 0.8;
}

/* 医生区域 */
.doctor-section {
    grid-area: doctor;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end; /* 让内容紧贴底部 */
    z-index: 2000;
    height: 100%; /* 使用父容器的全部高度 */
}

.doctor-image {
    display: flex;
    align-items: flex-end; /* 底部对齐 */
    justify-content: center; /* 水平居中 */
    padding-bottom: 0; /* 移除底部间距 */
    position: relative; /* 为医生名字标签提供定位参考 */
    margin-bottom: 200px;
}

/* 医生信息浮层 */
.doctor-info {
    position: absolute;
    bottom: 560px; /* 距离底部，确保在医生身上 */
    right: 30px; /* 距离右侧，确保不超出屏幕 */
    background: rgba(0, 0, 0, 0.3);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 10000;
    max-width: 180px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateX(-20px); /* 向左偏移，确保在医生身上 */
}

.doctor-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
    color: #fff;
}

.doctor-title {
    font-size: 12px;
    opacity: 0.9;
    line-height: 1.4;
    color: #e0e0e0;
}


.doctor-image video {
	width: 105%; /* 视频宽度 */
	height: 100%; /* 使用父容器的全部高度 */
	object-fit: cover; /* 改为cover确保填满容器 */
	max-width: none;
	margin-bottom: 180px;
	transform: translateX(4%);
	background: transparent;
	display: block;
	pointer-events: none;
	align-self: flex-end; /* 确保视频紧贴底部 */
    margin-left: 70px;
}




/* 报告区域 */
.report-section {
    grid-area: report;
    display: flex;
    align-items: flex-start; /* 改为顶部对齐 */
    justify-content: center;
    padding-top: 10%; /* 距离父容器顶部10% */
}

.report-container {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 0.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 20px;
    color: white;
    height: 90%; /* 与右侧聊天窗口统一 */
    max-height: 820px;
    overflow: hidden;
    padding: 24px 27px 0 27px;
}

.report-title {
    text-align: left;
    margin-bottom: 80px;
    padding: 0;
    width: 100%;
    flex-shrink: 0;
}

.report-title img {
    max-width: 230px;
    width: auto;
    height: auto;
    display: block;
}

.report-image {
    max-width: 701px; /* 2103÷3 = 701px */
    max-height: 800px; /* 容器840px - 内边距40px */
}

.report-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* 聊天区域 */
.chat-section {
    grid-area: chat;
    display: flex;
    flex-direction: column;
    align-items: center; /* 保持水平居中 */
    justify-content: flex-start; /* 改为顶部对齐 */
    padding-top: 12%; /* 距离父容器顶部10% */
}

.chat-container {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 0.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 20px;
    color: white;
    margin-bottom: 20px; /* 让框底部露出来 */
    max-height: 820px; /* 固定最大高度，增加20% */
    height: 90%; /* 固定高度，增加20% */
    position: relative; /* 为绝对定位的输入框提供参考 */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 防止整体滚动 */
    width: 528px;
}

.chat-title {
    text-align: left; /* 左对齐 */
    margin-bottom: 20px;
    padding: 0; /* 移除内边距 */
    width: 100%; /* 确保容器宽度 */
    flex-shrink: 0; /* 防止标题被压缩 */
}

.chat-title img {
    max-width: 272px; /* 816÷3 = 272px */
    width: auto; /* 改为auto */
    height: auto;
    display: block; /* 确保图片正确显示 */
}

/* 聊天消息滚动容器 */
.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px; /* 为滚动条留出空间 */
    margin-bottom: 80px; /* 为输入框留出空间 */
    scroll-behavior: smooth; /* 平滑滚动 */
    min-height: 0; /* 允许flex子元素收缩 */
    max-height: 720px; /* 固定最大高度：840px - 120px(标题+输入框) */
    height: 720px; /* 固定高度 */
}

/* 自定义滚动条样式 */
.chat-messages-container::-webkit-scrollbar {
    width: 6px;
}

.chat-messages-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.chat-messages-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.chat-messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* 聊天输入区域 */
.chat-input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0; /* 防止输入区域被压缩 */
    height: 100px; /* 增加输入区域高度 */
}

.input-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mic-icon {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s;
}

.mic-icon:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-input-field {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 15px 20px; /* 增加内边距 */
    color: white;
    font-size: 16px;
    outline: none;
    min-height: 50px; /* 设置最小高度 */
}

.chat-input-field::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.send-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    color: white;
    cursor: pointer;
    transition: background 0.3s;
}

.send-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
}

.send-btn:disabled {
    background: rgba(128, 128, 128, 0.3);
    cursor: not-allowed;
    opacity: 0.5;
}

.chat-input-field:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.mute-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 20px;
    padding: 10px 15px;
    color: white;
    cursor: pointer;
    transition: background 0.3s;
    font-size: 16px;
    margin-right: 10px;
}

.mute-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mute-btn.muted {
    background: rgba(255, 107, 107, 0.6);
    color: #fff;
}

.mute-btn.muted:hover {
    background: rgba(255, 107, 107, 0.8);
}

/* TTS控制按钮样式 */
.tts-controls {
    position: absolute;
    top: -40px;
    right: 0;
    display: flex;
    gap: 10px;
}

.tts-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 8px 15px;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.tts-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.tts-btn.active {
    background: rgba(76, 175, 80, 0.6);
    border-color: rgba(76, 175, 80, 0.8);
}

.tts-btn.active:hover {
    background: rgba(76, 175, 80, 0.8);
}

.tts-btn.ws-mode {
    background: rgba(255, 107, 107, 0.6);
    border-color: rgba(255, 107, 107, 0.8);
}

.tts-btn.ws-mode:hover {
    background: rgba(255, 107, 107, 0.8);
}

.tts-btn.sse-mode {
    background: rgba(78, 205, 196, 0.6);
    border-color: rgba(78, 205, 196, 0.8);
}

.tts-btn.sse-mode:hover {
    background: rgba(78, 205, 196, 0.8);
}

/* Markdown样式 */
.message-text h1, .message-text h2, .message-text h3, .message-text h4, .message-text h5, .message-text h6 {
    margin: 10px 0 8px 0;
    color: #ffffff;
    font-weight: bold;
}

.message-text h1 { font-size: 24px; }
.message-text h2 { font-size: 22px; }
.message-text h3 { font-size: 20px; }
.message-text h4 { font-size: 19px; }
.message-text h5 { font-size: 18px; }
.message-text h6 { font-size: 17px; }

.message-text p {
    margin: 8px 0;
    line-height: 1.5;
}

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

.message-text li {
    margin: 0;
    padding: 2px 0;
    line-height: 1.2;
}

.message-text strong, .message-text b {
    font-weight: bold;
    color: #1e3a8a;
    font-size: 18px;
}

.message-text em, .message-text i {
    font-style: italic;
}

.message-text code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
}

.message-text pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.message-text pre code {
    background: none;
    padding: 0;
    color: #ffffff;
}

.message-text blockquote {
    border-left: 4px solid rgba(255, 255, 255, 0.3);
    margin: 10px 0;
    padding-left: 15px;
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
}

.message-text a {
    color: #4CAF50;
    text-decoration: underline;
}

.message-text a:hover {
    color: #45a049;
}

.message-text table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
}

.message-text th, .message-text td {
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    text-align: left;
}

.message-text th {
    background: rgba(255, 255, 255, 0.1);
    font-weight: bold;
}

.message-text tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.05);
}

/* 聊天消息样式 - 气泡样式 */
.chat-message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    animation: messageSlideIn 0.3s ease-out;
}

.user-message {
    justify-content: flex-end;
}

.doctor-message {
    justify-content: flex-start;
}

.message-content {
    display: flex;
    align-items: flex-start;
    max-width: 80%;
}

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

.doctor-message .message-content {
    flex-direction: row;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1976d2; /* 蓝色背景，去掉渐变 */
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    margin: 0 10px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    align-self: flex-end; /* 头像对齐到气泡底部 */
}

.doctor-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 10px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 2px solid #fff;
    align-self: flex-end; /* 头像对齐到气泡底部 */
}

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

.message-text {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 20px;
    color: #333;
    font-size: 18px;
    line-height: 1.5;
    word-wrap: break-word;
    max-width: calc(100% - 60px);
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
}

.user-message .message-text {
    background: rgba(25, 118, 210, 0.6); /* 深蓝色背景，60%透明度 */
    color: white;
    border-radius: 20px 20px 0px 20px; /* 移除尾巴，使用完整圆角 */
}

.doctor-message .message-text {
    background: rgba(255, 255, 255, 0.7); /* 白色背景，70%透明度 */
    color: #333;
    border-radius: 20px 20px 20px 0; /* 移除尾巴，使用完整圆角 */
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* 移除气泡尾巴效果 */

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

/* 快捷提问样式 */
.quick-questions {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px 20px;
    margin: 20px 0;
    backdrop-filter: blur(5px);
}

.quick-questions-title {
    font-size: 16px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-questions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-question-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 12px 16px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-question-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.quick-question-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* 推荐问题样式 */
.suggested-questions {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 15px;
    padding: 15px 20px;
    margin: 15px 0 20px 0;
    backdrop-filter: blur(5px);
    animation: fadeInUp 0.4s ease-out;
}

.suggested-questions-title {
    font-size: 16px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggested-questions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.suggested-question-btn {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 10px;
    padding: 12px 16px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggested-question-btn:hover {
    background: rgba(76, 175, 80, 0.25);
    border-color: rgba(76, 175, 80, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.suggested-question-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(76, 175, 80, 0.2);
}

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

/* 适配小屏幕的响应式设计 */
@media (max-width: 1024px) {
    .quick-questions-list,
    .suggested-questions-list {
        gap: 6px;
    }
    
    .quick-question-btn,
    .suggested-question-btn {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .quick-questions-title,
    .suggested-questions-title {
        font-size: 15px;
        margin-bottom: 10px;
    }
}

/* 响应式设计 - 由JavaScript控制缩放 */

/* Markdown内容样式 */
.markdown-content {
    line-height: 1.6;
    word-wrap: break-word;
}

.markdown-content strong {
    font-weight: bold;
    color: #1e3a8a;
}

.markdown-content em {
    font-style: italic;
    color: #87ceeb;
}

.markdown-content code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #98fb98;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.markdown-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
}

.markdown-content pre code {
    background: none;
    padding: 0;
    border: none;
    color: #e6e6fa;
}

.markdown-content a {
    color: #87ceeb;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.markdown-content a:hover {
    color: #98fb98;
}

.markdown-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.markdown-content li {
    margin: 0;
    padding: 2px 0;
    line-height: 1.2;
    list-style-type: disc;
    color: #f0f8ff;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    margin: 15px 0 10px 0;
    color: #ffd700;
    font-weight: bold;
}

.markdown-content h1 {
    font-size: 1.4em;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    padding-bottom: 5px;
}

.markdown-content h2 {
    font-size: 1.2em;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    padding-bottom: 3px;
}

.markdown-content h3 {
    font-size: 1.1em;
    color: #ffb6c1;
}

.markdown-content br {
    margin: 5px 0;
}

/* 调整message-text中列表项间距 */
.message-text br {
    display: block;
    margin: 0;
    line-height: 0.2em; /* 控制br的高度，提供适当的间距 */
}

.message-text li {
    margin: 0;
    padding: 4px 0; /* 增加列表项的上下内边距 */
    line-height: 1.4;
}

/* 隐藏列表项后多余的br标签 */
.message-text li + br,
.message-text ul br {
    display: none;
}

/* 为列表项添加更好的间距控制 */
.message-text ul {
    margin: 10px 0;
    padding-left: 20px;
}

.message-text ul li {
    margin: 2px 0; /* 控制列表项间距 */
    padding: 2px 0;
    line-height: 1.4;
    list-style-type: disc;
}

/* 确保强调文本在列表项中的样式 */
.message-text ul li strong {
    font-weight: bold;
    color: #1e3a8a;
    font-size: inherit; /* 继承列表项的字体大小 */
}

/* 动态省略号/打点动画（通用：用于“医生正在思考中”、“报告解读中”） */
.typing-indicator,
.status .dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 4px;
    vertical-align: baseline;
}

.typing-indicator span,
.status .dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor; /* 跟随文本颜色 */
    opacity: 0.25;
    animation: typingDot 1.2s infinite ease-in-out;
}

/* 三个点的交错延时 */
.typing-indicator span:nth-child(1),
.status .dots span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2),
.status .dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3),
.status .dots span:nth-child(3) { animation-delay: 0.4s; }

/* 打点关键帧 */
@keyframes typingDot {
    0%, 80%, 100% {
        opacity: 0.25;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-1px);
    }
}
