/* 基础样式 */
:root {
    --primary-color: #1a73e8;
    --secondary-color: #f8f9fa;
    --user-bubble: #7e9bed;
    --assistant-bubble: #fff;
    --system-bubble: #fff;
}

body {
    background-color: #f5f7fb;
    color: #202124;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 聊天消息样式 */
#chat-messages {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    width: calc(100% - 4px);
    max-width: 90%;
    align-self: flex-start;
    padding: 0.5rem 0;
}

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

.message .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #e8eaed;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;

    > img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

.message.user-message .avatar {
    background-color: var(--primary-color);
    color: white;
    margin-left: 12px;
}
.message.robot-message .avatar {
    margin-right: 12px;
}

.message .content {
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    max-width: calc(100% - 64px);
    overflow-wrap: break-word;
}

.user-message .content {
    color: #fff;
    background-color: var(--user-bubble);
    border-top-right-radius: 0;
}

.user-message .content p {
    margin-top: 0;
    margin-bottom: 0;
}

.assistant-message .avatar {
    margin-right: 12px;
}

.assistant-message .content {
    background-color: var(--assistant-bubble);
    border-top-left-radius: 0;
}

.assistant-message .content p {
    margin-top: 0;
    margin-bottom: 0;
}

.system-message .avatar {
    margin-right: 12px;
}

.system-message .content {
    background-color: var(--system-bubble);
    border-radius: 8px;
    max-width: 100%;
}

.system-message .content p {
    margin-top: 0;
    margin-bottom: 0;
}

/* Markdown 内容样式 */
.markdown-body {
    font-size: 16px;
    line-height: 1.6;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.markdown-body p {
    margin-bottom: 1em;
}

.markdown-body ul, .markdown-body ol {
    margin-bottom: 1em;
    padding-left: 2em;
}

.markdown-body code {
    background-color: rgba(175, 184, 193, 0.2);
    border-radius: 6px;
    padding: 0.2em 0.4em;
    font-size: 85%;
}

.markdown-body pre {
    background-color: #f6f8fa;
    border-radius: 6px;
    padding: 16px;
    overflow: auto;
    margin: 1em 0;
}

/* 思考指示器 */
.thinking-container {
    display: flex;
    align-items: center;
    padding: 8px;
}

.thinking-indicator {
    display: flex;
    margin-right: 10px;
}

.thinking-indicator span {
    width: 8px;
    height: 8px;
    background-color: #5f6368;
    border-radius: 50%;
    display: inline-block;
    margin: 0 3px;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1.0);
    }
}

.thinking-text {
    color: #5f6368;
    font-size: 14px;
}

/* 结果卡片 */
.result-card {
    border-top: 1px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-top: 1rem;
}

.result-card .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    padding: 8px 16px;
}

.result-card .card-header h6 {
    color: #495057;
    font-weight: 600;
    font-size: 0.9rem;
}

.result-card .nav-tabs {
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

.result-card .nav-tabs .nav-link {
    border: none;
    color: #6c757d;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 0;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.result-card .nav-tabs .nav-link:hover {
    color: var(--primary-color);
    background-color: #e9ecef;
}

.result-card .nav-tabs .nav-link.active {
    color: var(--primary-color);
    background-color: white;
    border-bottom: 2px solid var(--primary-color);
}

.result-card .tab-content {
    background-color: white;
}

.result-card .tab-pane {
    padding: 12px;
}

/* 科室和医生卡片样式 */
.department-results .card,
.doctor-results .card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin-bottom: 12px;
}

.department-results .card:hover,
.doctor-results .card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.department-results .card-title,
.doctor-results .card-title {
    color: #212529;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 1rem;
}

.department-results .card-text,
.doctor-results .card-text {
    color: #6c757d;
    line-height: 1.4;
    margin-bottom: 12px;
    font-size: 0.875rem;
}

/* 科室卡片特殊样式 */
.dept-card .card-body {
    padding: 0.75rem !important;
}

.dept-card .avatar-sm {
    width: 32px !important;
    height: 32px !important;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%) !important;
}

.dept-card .avatar-sm i {
    font-size: 16px;
    color: white !important;
}

/* 医生卡片特殊样式 */
.doctor-card .card-body {
    padding: 0.75rem !important;
}

.doctor-card .avatar-md {
    width: 45px !important;
    height: 45px !important;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%) !important;
    border: 2px solid #e3f2fd;
}

.doctor-card .avatar-md i {
    color: var(--primary-color) !important;
    font-size: 18px;
}

/* 徽章样式优化 */
.badge {
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 0.75rem;
}

.badge.bg-primary {
    background-color: var(--primary-color) !important;
}

.badge.bg-light {
    background-color: #f8f9fa !important;
    color: #495057 !important;
    border: 1px solid #dee2e6;
}

/* 按钮样式优化 */
.btn-sm {
    padding: 3px 5px;
    font-size: 0.875rem;
    border-radius: 10px;
}

.btn-outline-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transition: all 0.3s ease;
    font-size: 0.8rem;
    padding: 4px 12px;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.btn-outline-secondary {
    border-color: #6c757d;
    color: #6c757d;
    transition: all 0.3s ease;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

/* 结果卡片容器 */
#result-cards-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 20px;
    margin: 20px;
    border: 1px solid #dee2e6;
}

/* 加载状态样式 */
.spinner-border.text-primary {
    color: var(--primary-color) !important;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .message {
        max-width: 95%;
    }

    .message .avatar {
    }

    .message .content {
        padding: 8px 12px;
        max-width: calc(100% - 4px);
    }

    .result-card {
        margin-top: 1rem;
        border-radius: 6px;
    }

    .result-card .card-header {
        padding: 6px 12px;
    }

    .result-card .card-header h6 {
        font-size: 0.85rem;
    }

    .result-card .nav-tabs .nav-link {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .result-card .tab-pane {
        padding: 8px;
    }

    #result-cards-container {
        margin: 15px;
        padding: 15px;
    }

    .dept-card .card-body,
    .doctor-card .card-body {
        padding: 0.5rem !important;
    }

    .dept-card .avatar-sm,
    .doctor-card .avatar-md {
        width: 35px !important;
        height: 35px !important;
    }

    .dept-card .avatar-sm i {
        font-size: 14px;
    }

    .doctor-card .avatar-md i {
        font-size: 16px;
    }

    .badge {
        font-size: 0.7rem;
        padding: 3px 6px;
    }

    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }

    .card-title {
        font-size: 0.9rem !important;
    }

    .card-text {
        font-size: 0.8rem !important;
        line-height: 1.4;
    }
}

/* 医生卡片交互样式 */
.doctor-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    border-radius: 8px;
}

.doctor-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 6px 16px rgba(26, 115, 232, 0.15);
    transform: translateY(-3px);
}

.doctor-card:active {
    transform: translateY(-1px);
}

/* 模态框样式 */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    border-radius: 12px 12px 0 0;
}

.modal-title {
    color: var(--primary-color);
    font-weight: 600;
}

.avatar-lg {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%) !important;
    border: 3px solid #e3f2fd;
}

.avatar-lg i {
    color: var(--primary-color) !important;
}

/* 标签页切换动画 */
.tab-pane.fade {
    transition: opacity 0.3s ease;
}

.tab-pane.fade.show {
    opacity: 1;
}

/* 加载状态优化 */
.spinner-border {
    width: 2rem;
    height: 2rem;
}

/* 医生卡片内容布局优化 */
.doctor-card .card-body {
    padding: 1rem;
}

.doctor-card .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.5rem;
}

.doctor-card .card-text {
    font-size: 0.9rem;
    line-height: 1.4;
}

.doctor-card .badge {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
}

/* 预约按钮样式 */
.btn-outline-primary:focus {
    box-shadow: 0 0 0 0.2rem rgba(26, 115, 232, 0.25);
}

/* 结果卡片容器阴影效果 */
#result-cards-container {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}