/* Ant Design X 风格样式 */

/* 全局重置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #f5f5f5;
    color: #1f2937;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
}

/* Flash 消息 */
.flash-messages {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flash-message {
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
}

.flash-success {
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    color: #389e0d;
}

.flash-error {
    background: #fff2f0;
    border: 1px solid #ffccc7;
    color: #cf1322;
}

.flash-info {
    background: #e6f7ff;
    border: 1px solid #91d5ff;
    color: #0958d9;
}

.flash-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    margin-left: 12px;
}

.flash-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 主页面布局 - 专业医疗风格 */
.antx-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #f8fafc 100%);
    position: relative;
}

/* 专业医疗风格背景装饰 */
.antx-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 15% 25%, rgba(24, 144, 255, 0.02) 0%, transparent 40%),
        radial-gradient(circle at 85% 75%, rgba(82, 196, 26, 0.02) 0%, transparent 40%),
        linear-gradient(180deg, transparent 0%, rgba(24, 144, 255, 0.01) 100%);
    pointer-events: none;
    z-index: 0;
}

/* 主容器 - 专业布局 */
.antx-container {
    flex: 1;
    display: flex;
    gap: 20px;
    padding: 28px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* 对话区域 */
.antx-chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.antx-chat-panel {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.06),
        0 2px 8px rgba(24, 144, 255, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
    overflow: hidden;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}

.antx-chat-header {
    padding: 20px 28px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.antx-chat-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.antx-chat-actions a {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.antx-chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: #1e40af;
    letter-spacing: 0.2px;
    text-shadow: 0 1px 2px rgba(30, 64, 175, 0.1);
}

.antx-chat-title .antx-chat-icon {
    font-size: 24px;
    filter: drop-shadow(0 2px 4px rgba(24, 144, 255, 0.15));
    line-height: 1;
}

.antx-chat-icon {
    font-size: 18px;
}

/* 对话窗口 - 专业医疗风格 */
.antx-chat-window {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    scroll-behavior: smooth;
    /* 确保内容始终在底部 */
    scroll-padding-bottom: 28px;
}

.antx-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

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

.antx-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.antx-avatar-ai {
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    color: #ffffff;
    box-shadow: 
        0 4px 12px rgba(24, 144, 255, 0.25),
        0 2px 4px rgba(24, 144, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.9);
    font-weight: 600;
    font-size: 13px;
}

.antx-avatar-user {
    background: linear-gradient(135deg, #52c41a 0%, #389e0d 100%);
    color: #ffffff;
    box-shadow: 
        0 4px 12px rgba(82, 196, 26, 0.25),
        0 2px 4px rgba(82, 196, 26, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.9);
    font-weight: 600;
    font-size: 13px;
}

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

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

.antx-message-bubble {
    padding: 14px 18px;
    border-radius: 14px;
    max-width: 72%;
    word-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.7;
    font-size: 14px;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.06),
        0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.antx-bubble-ai {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(226, 232, 240, 0.8);
    color: #1f2937;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.04),
        0 0 0 1px rgba(24, 144, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.antx-bubble-ai::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: linear-gradient(180deg, 
        #1890ff 0%, 
        #40a9ff 50%,
        #1890ff 100%);
    border-radius: 0 2px 2px 0;
    box-shadow: 
        0 0 6px rgba(24, 144, 255, 0.25),
        inset 0 0 3px rgba(255, 255, 255, 0.3);
    z-index: 1;
    opacity: 0.85;
}

.antx-bubble-ai::after {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.8) 0%, 
        transparent 30%,
        transparent 70%,
        rgba(255, 255, 255, 0.8) 100%);
    z-index: 2;
    pointer-events: none;
}

.antx-bubble-user {
    background: linear-gradient(135deg, #1890ff 0%, #40a9ff 100%);
    color: #fff;
    box-shadow: 0 2px 12px rgba(24, 144, 255, 0.2);
}

.antx-message-user .antx-message-bubble {
    background: linear-gradient(135deg, #52c41a 0%, #73d13d 100%);
    color: #fff;
    box-shadow: 0 2px 12px rgba(82, 196, 26, 0.2);
}

/* 流式输入光标 */
.antx-message-bubble.streaming::after {
    content: '▊';
    animation: blink-cursor 1s infinite;
    margin-left: 2px;
    color: inherit;
}

@keyframes blink-cursor {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 流式输出样式 */
.streaming-message {
    animation: streamingAppear 0.3s ease-out;
}

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

.streaming-title {
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 14px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.2px;
    text-shadow: 0 1px 2px rgba(30, 64, 175, 0.1);
}

.streaming-title::before {
    content: '🏥';
    font-size: 18px;
    animation: pulse 1.5s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(24, 144, 255, 0.15));
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

.streaming-content {
    color: #1f2937;
    white-space: pre-wrap;
    line-height: 1.75;
    min-height: 20px;
    word-wrap: break-word;
    font-size: 14px;
}

.streaming-message.streaming-reasoning .streaming-content {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    background: rgba(24, 144, 255, 0.06);
    padding: 14px 16px;
    border-radius: 12px;
    border-left: 4px solid rgba(24, 144, 255, 0.6);
    color: #1f2937;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    position: relative;
}

.streaming-message.streaming-reasoning .streaming-content::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #1890ff 0%, #096dd9 100%);
    border-radius: 12px 0 0 12px;
}

.streaming-message.streaming-content .streaming-content {
    color: #1f2937;
    font-size: 14px;
    line-height: 1.75;
}

.streaming-cursor {
    display: inline-block;
    color: #1890ff;
    animation: blink 1s step-end infinite;
    margin-left: 3px;
    font-weight: 700;
    font-size: 16px;
    vertical-align: middle;
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

/* 快捷提示 - 医疗风格 */
.antx-quick-prompts {
    padding: 16px 28px;
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: linear-gradient(to bottom, #ffffff 0%, #fafbfc 100%);
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.8) inset;
}

.antx-quick-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.antx-tag {
    padding: 8px 16px;
    border-radius: 16px;
    border: 1.5px solid rgba(226, 232, 240, 0.8);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    color: #1e40af;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    letter-spacing: 0.2px;
}

.antx-tag:hover {
    border-color: #1890ff;
    background: linear-gradient(135deg, #f0f7ff 0%, #e6f7ff 100%);
    color: #1890ff;
    transform: translateY(-2px);
    box-shadow: 
        0 4px 12px rgba(24, 144, 255, 0.15),
        0 2px 4px rgba(24, 144, 255, 0.1);
}

/* 输入区域 - 专业医疗风格 */
.antx-input-section {
    padding: 20px 28px;
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    background: linear-gradient(to bottom, #ffffff 0%, #fafbfc 100%);
    border-radius: 0 0 20px 20px;
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.8) inset;
}

.antx-input-wrapper {
    margin-bottom: 12px;
}

.antx-textarea {
    width: 100%;
    padding: 16px 18px;
    border: 1.5px solid rgba(226, 232, 240, 0.8);
    border-radius: 14px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    color: #1f2937;
    line-height: 1.7;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.antx-textarea:focus {
    outline: none;
    border-color: #1890ff;
    background: #ffffff;
    box-shadow: 
        0 0 0 4px rgba(24, 144, 255, 0.08),
        0 4px 12px rgba(24, 144, 255, 0.12),
        0 1px 3px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.antx-textarea::placeholder {
    color: #8c8c8c;
}

.antx-textarea:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.antx-input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.antx-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #595959;
    cursor: pointer;
}

.antx-checkbox input {
    cursor: pointer;
}

.antx-input-actions {
    display: flex;
    gap: 8px;
}

/* 按钮样式 - 专业设计 */
.antx-btn-primary,
.antx-btn-ghost {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1.5px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.2px;
}

.antx-btn-primary {
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    color: #fff;
    border-color: #1890ff;
    box-shadow: 
        0 4px 12px rgba(24, 144, 255, 0.25),
        0 2px 4px rgba(24, 144, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.antx-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #40a9ff 0%, #1890ff 100%);
    border-color: #40a9ff;
    box-shadow: 
        0 6px 16px rgba(24, 144, 255, 0.35),
        0 2px 6px rgba(24, 144, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.antx-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.antx-btn-ghost {
    background: #ffffff;
    color: #64748b;
    border-color: rgba(226, 232, 240, 0.8);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    font-weight: 500;
}

.antx-btn-ghost:hover:not(:disabled) {
    color: #1890ff;
    border-color: #1890ff;
    background: linear-gradient(135deg, #f8fafc 0%, #f0f7ff 100%);
    box-shadow: 
        0 4px 12px rgba(24, 144, 255, 0.12),
        0 2px 4px rgba(24, 144, 255, 0.08);
    transform: translateY(-1px);
}

.antx-btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 8px;
}

.antx-btn-loading {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.d-none {
    display: none !important;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 侧边栏 */
.antx-sidebar {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.antx-card {
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 
        0 4px 24px rgba(0, 0, 0, 0.06),
        0 2px 8px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(226, 232, 240, 0.8);
    overflow: hidden;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.antx-card:hover {
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
}

.antx-card-header {
    padding: 20px 26px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.antx-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e40af;
    margin: 0;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 2px rgba(30, 64, 175, 0.1);
}

.antx-card-subtitle {
    font-size: 12px;
    color: #64748b;
    font-weight: 400;
    letter-spacing: 0.1px;
}

.antx-card-body {
    padding: 20px 26px;
}

/* 状态徽章 */
.antx-status-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.antx-status-success {
    background: linear-gradient(135deg, #f6ffed 0%, #d9f7be 100%);
    color: #52c41a;
    border: 1px solid #b7eb8f;
    box-shadow: 0 1px 3px rgba(82, 196, 26, 0.2);
}

/* 提示词列表 */
.antx-prompt-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.antx-prompt-item {
    width: 100%;
    padding: 16px 18px;
    border: 1.5px solid rgba(226, 232, 240, 0.8);
    border-radius: 14px;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    gap: 16px;
    align-items: flex-start;
    text-align: left;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.antx-prompt-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #1890ff 0%, #096dd9 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 14px 0 0 14px;
}

.antx-prompt-item:hover {
    border-color: #1890ff;
    background: linear-gradient(135deg, #f0f7ff 0%, #e6f7ff 100%);
    box-shadow: 
        0 4px 16px rgba(24, 144, 255, 0.12),
        0 2px 6px rgba(24, 144, 255, 0.08);
    transform: translateX(3px) translateY(-1px);
}

.antx-prompt-item:hover::before {
    opacity: 1;
}

.antx-prompt-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.antx-prompt-content {
    flex: 1;
    min-width: 0;
}

.antx-prompt-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.antx-prompt-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.65;
    font-weight: 400;
}

.antx-prompt-item:hover .antx-prompt-title {
    color: #1890ff;
}

/* 统计网格 */
.antx-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.antx-stat-item {
    padding: 16px;
    border: 1.5px solid rgba(226, 232, 240, 0.8);
    border-radius: 14px;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.antx-stat-item:hover {
    border-color: rgba(24, 144, 255, 0.3);
    box-shadow: 
        0 4px 12px rgba(24, 144, 255, 0.1),
        0 2px 4px rgba(24, 144, 255, 0.06);
    transform: translateY(-2px);
    background: linear-gradient(135deg, #f8fafc 0%, #f0f7ff 100%);
}

.antx-stat-label {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 6px;
    font-weight: 500;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    font-size: 11px;
}

.antx-stat-value {
    font-size: clamp(11px, 1.1rem, 18px);
    font-weight: 700;
    color: #1e293b;
    letter-spacing: 0.3px;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .antx-container {
        flex-direction: column;
    }

    .antx-sidebar {
        width: 100%;
    }

    .antx-chat-panel {
        height: auto;
        min-height: 600px;
    }
}

@media (max-width: 768px) {
    .antx-container {
        padding: 16px;
    }

    .antx-message-bubble {
        max-width: 85%;
    }
}
