/* GWASMind Flask - CSS Styles */
/* Based on original React version */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Plot Loading Spinner */
.plot-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px 50px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.plot-loading p {
    color: #6b7280;
    font-size: 14px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.App {
    height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eaed 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', 'Roboto', sans-serif;
    overflow: hidden; /* Disable App scroll */
    display: flex;
    flex-direction: column;
}

.App > main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden; /* Disable global scroll */
}

/* Header */
.App-header {
    background: rgba(255, 255, 255, 0.98);
    padding: 20px 40px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
    z-index: 200;
    position: relative;
}

.App-header h1 {
    color: #1f2937;
    font-size: 1.75em;
    margin: 0;
    font-weight: 600;
}

.App-header p {
    color: #6b7280;
    font-size: 0.9em;
    margin: 5px 0 0 0;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Buttons */
.upload-button, .clear-button, .toggle-chat-button, .settings-button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-button {
    background: #5a7a9a;
    color: white;
}

.upload-button:hover {
    background: #4a6a8a;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(90, 122, 154, 0.3);
}

.auto-analysis-button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    background: #5a7a9a;
    color: white;
    text-decoration: none;
    display: inline-block;
}

.auto-analysis-button:hover {
    background: #4a6a8a;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(90, 122, 154, 0.4);
}

.settings-button {
    background: #6c757d;
    color: white;
}

.settings-button:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

.clear-button {
    background: #b8636f;
    color: white;
}

.clear-button:hover {
    background: #a85360;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(184, 99, 111, 0.3);
}

.toggle-chat-button {
    background: #5a8a6a;
    color: white;
}

.toggle-chat-button:hover {
    background: #4a7a5a;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(90, 138, 106, 0.3);
}

/* Home Container - 两列布局 */
.home-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    padding: 40px;      /* 适中边距 */
    max-width: 1500px;
    margin: 0 auto;
    align-items: stretch; /* 关键 1: 强制左右卡片等高 */
}

.home-container > div {
    display: flex;
    flex-direction: column;
}

/* Upload Container */
.upload-container {
    display: flex;
    justify-content: center;
    align-items: stretch;
    height: 100%;
}

.home-container .upload-box {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Demo Container */
.demo-container {
    display: flex;
    justify-content: center;
    align-items: stretch;
    height: 100%;
}

.demo-box {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    padding: 35px;
    width: 100%;
    height: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    box-sizing: border-box;
}

.demo-box h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 2em;
    margin-top: 0;
}

.demo-box .subtitle {
    color: #666;
    margin: 0;
    font-size: 1em;
}

.demo-box .subtitle-hint {
    color: #888;
    margin: 5px 0 15px 0;
    font-size: 0.85em;
}

.demo-box > p {
    color: #333;
    margin-bottom: 40px;
    font-size: 1.1em;
}

.demo-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 30px; /* 统一间距 */
}

.demo-item {
    display: flex;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
}

.demo-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-color: #5a7a9a;
    background: #f0f4f8;
}

.demo-icon {
    font-size: 2.5em;
    margin-right: 15px;
}

.demo-info {
    flex: 1;
}

.demo-info h3 {
    color: #333;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.demo-info p {
    color: #555;
    font-size: 0.85em;
    margin: 0;
}

.demo-arrow {
    color: #5a7a9a;
    font-size: 1.5em;
    font-weight: bold;
}

/* 统一底部灰色框样式 */
.help-text, .demo-features {
    margin-top: 25px;
    text-align: left;
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    height: 200px;        /* 固定高度确保对齐 */
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.help-text p, .demo-features > p:first-child {
    font-weight: 500 !important;  /* 统一字重：中等 */
    margin-bottom: 15px;
    font-size: 1.1em;
    color: #333 !important;      /* 统一颜色：深灰/黑 */
    margin-top: 0;
}

.help-text ul, .demo-features ul {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.help-text li, .demo-features li {
    padding: 10px 0;
    color: #444;
    font-size: 0.95em;
    border-bottom: 1px solid #e9ecef;
    line-height: 1.4;
}

.help-text li:last-child, .demo-features li:last-child {
    border-bottom: none;
}

/* 响应式布局 */
@media (max-width: 1000px) {
    .home-container {
        flex-direction: column;
        align-items: center;
    }
    
    .demo-container {
        flex: none;
        width: 100%;
        max-width: 600px;
    }
}

.upload-box {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    padding: 35px;
    width: 100%;
    height: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    box-sizing: border-box;
}

.demo-list {
    width: 100%;
    margin-top: 10px;
    margin-bottom: 25px;  /* 底部边距 */
}

.upload-box h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 2em;
    margin-top: 0;
}

.upload-box .subtitle {
    color: #666;
    margin: 0 0 20px 0;
    font-size: 1em;
    min-height: 45px;
}

.upload-box .columns-info {
    margin-bottom: 15px;  /* 进一步减小，更紧凑 */
    background: #fcfcfc;
    padding: 12px;
    border-radius: 8px;
    border: 1px dashed #eee;
}

.upload-box .columns-info p {
    color: #333;
    margin: 5px 0;
    font-size: 0.9em;
}

.upload-box p {
    color: #333;
    margin: 10px 0;
    font-size: 1.1em;
}

.upload-box code {
    background: #f5f5f5;
    padding: 2px 8px;
    border-radius: 4px;
    color: #667eea;
    font-weight: 500;
}

.upload-button-large {
    display: inline-block;
    padding: 18px 48px;
    background: #5a7a9a;
    color: white;
    border-radius: 8px;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    max-width: 250px;
    margin: 20px auto 45px auto;  /* 减少底部边距，让 Tips 上移 */
    transition: all 0.2s;
    border: none;
}

.upload-button-large:hover {
    background: #4a6a8a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(90, 122, 154, 0.3);
}

/* Upload Progress */
.upload-progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin: 20px 0 8px;
}

.upload-progress-fill {
    height: 100%;
    background: #5a7a9a;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.upload-progress-text {
    font-size: 0.9em;
    color: #666;
    text-align: center;
}

.help-text li:last-child {
    border-bottom: none;
}

.error-message {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
}

/* Main Container */
.main-container {
    display: flex;
    gap: 20px;
    padding: 20px;
    padding-bottom: 20px;
    flex: 1;
    overflow: hidden;
    box-sizing: border-box;
    width: 100%;
    min-height: 0;
}

.plot-container {
    flex: 1;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    padding: 20px 20px 5px 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* Hide scrollbar for plot container if any */
.plot-container::-webkit-scrollbar {
    display: none;
}

.plot-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.plot-controls button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

/* Export Dropdown */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.export-button {
    background: #5a7a9a !important;
    color: white !important;
    border: none !important;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.export-button:hover {
    background: #4a6a8a !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(90, 122, 154, 0.4);
}

.export-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 1000;
    margin-top: 4px;
    overflow: hidden;
}

.export-menu button {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    border-radius: 0 !important;
}

.export-menu button:hover {
    background: #f0f4ff;
}

.export-menu button:not(:last-child) {
    border-bottom: 1px solid #eee;
}

.plot-controls button:hover {
    background: #5a7a9a;
    color: white;
    border-color: #5a7a9a;
}

.plot-wrapper {
    flex: 1;
    min-height: 400px;
    overflow: visible;
    position: relative;
    width: 100%;
    display: grid;
    place-items: center;
}

#manhattan-plot {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
}

/* Threshold Control */
.threshold-control {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #f5f5f5;
    border-radius: 6px;
    border: 1px solid #ddd;
    white-space: nowrap;
}

.threshold-control label {
    font-weight: 600;
    color: #333;
    font-size: 0.8em;
}

.threshold-control input[type="number"] {
    width: 50px;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85em;
    text-align: center;
}

.threshold-control input[type="range"] {
    width: 100px;
    cursor: pointer;
}

.threshold-pvalue {
    font-size: 0.75em;
    color: #666;
    font-style: italic;
}

.zoom-out-button {
    background: #5a7a9a !important;
    color: white !important;
    border: none !important;
}

.zoom-out-button:hover {
    background: #4a6a8a !important;
}

/* Selection Info */
.snp-selection-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 6px 0;
    padding: 8px 12px;
    background: #ecfdf5;
    border-radius: 6px;
    border: 1px solid #10b981;
    color: #065f46;
    font-size: 13px;
}

.snp-selection-info #selection-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.snp-selection-info .multi-region-item {
    padding: 4px 8px;
    font-size: 14px;
    margin-bottom: 3px;
}

.clear-selection-btn {
    background: #fee2e2;
    color: #ef4444;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.clear-selection-btn:hover {
    background: #fca5a5;
}

/* Chat Container */
.chat-container {
    width: 450px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.chat-header {
    padding: 12px 16px;
    background: #5a7a9a;
    color: white;
}

.chat-header h3 {
    margin: 0;
    font-size: 1rem;
}

.font-size-button {
    padding: 2px 6px;
    font-size: 0.75rem;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    color: #333;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f8f9fa;
    min-height: 0;  /* 关键：允许 flex 项收缩以触发滚动 */
}

.welcome-message {
    padding: 15px;
    background: white;
    border-radius: 12px;
    color: #666;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    font-size: 13px;
}

.welcome-message p {
    margin-bottom: 12px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.welcome-message ul {
    margin-left: 18px;
}

.welcome-message li {
    margin: 6px 0;
    line-height: 1.4;
}

.message {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s;
    width: 100%;
    margin-bottom: 15px;
}

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

.message.user {
    align-items: flex-end;
}

.message.assistant {
    align-items: stretch;
}

.message.system {
    align-items: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    line-height: 1.5;
}

.message.user .message-content,
.user-message {
    background: #5a7a9a;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content,
.assistant-message {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    max-width: 100%;
}

.message.system .message-content {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 3px solid #4caf50;
}

/* Chat Input */
.chat-input-container {
    display: flex;
    flex-wrap: wrap;
    padding: 15px;
    gap: 10px;
    background: white;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;  /* 防止输入区域被压缩 */
}

.quick-prompt-button {
    width: 100%;
    padding: 8px;
    background: #f0f9ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    color: #1e40af;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: center;
}

.quick-prompt-button:hover {
    background: #dbeafe;
}

.chat-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
    resize: none;
}

.chat-input:focus {
    border-color: #5a7a9a;
}

.send-button {
    padding: 12px 24px;
    background: #5a7a9a;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.send-button:hover:not(:disabled) {
    background: #4a6a8a;
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Settings Modal */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.settings-panel {
    background: white;
    border-radius: 16px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.settings-panel h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 1.8em;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #333;
    font-size: 1.05em;
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #5a7a9a;
}

.form-group small {
    color: #666;
    font-size: 0.9em;
}

.connection-status {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.95em;
    line-height: 1.4;
}

.connection-status.success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #4caf50;
}

.connection-status.error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #f44336;
}

.settings-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.test-button {
    flex: 1;
    padding: 14px 20px;
    background: #17a2b8;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
}

.test-button:hover:not(:disabled) {
    background: #138496;
}

.test-button:disabled {
    background: #b0b0b0;
    cursor: not-allowed;
}

.save-button {
    flex: 1;
    padding: 14px 20px;
    background: #5a7a9a;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
}

.save-button:hover {
    background: #4a6a8a;
}

.cancel-button {
    flex: 1;
    padding: 14px 20px;
    background: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
}

.cancel-button:hover {
    background: #d0d0d0;
}

/* Markdown Content Styles */
.message-content h2 {
    font-size: 1.3em;
    margin: 15px 0 10px;
    color: #333;
    border-bottom: 2px solid #5a7a9a;
    padding-bottom: 5px;
}

.message-content h3 {
    font-size: 1.1em;
    margin: 12px 0 8px;
    color: #1a1a1a;
    font-weight: 700;
}

/* Make References header more prominent */
.message-content h3:last-of-type {
    color: #000;
    border-bottom: 1px solid #ddd;
    padding-bottom: 4px;
}

.message-content h4 {
    font-size: 1em;
    margin: 10px 0 6px;
    color: #666;
}

.message-content ul, .message-content ol {
    margin: 10px 0;
    padding-left: 25px;
}

.message-content li {
    margin: 5px 0;
    line-height: 1.6;
}

.message-content code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #d63384;
}

.message-content pre {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 10px 0;
}

.message-content strong {
    font-weight: 700;
    color: #333;
}

.message-content p {
    margin: 8px 0;
    line-height: 1.6;
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 15px 0;
    font-size: 0.9em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    overflow: hidden;
}

.message-content table thead {
    background: #5a7a9a;
    color: white;
}

.message-content table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
}

.message-content table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e5e7eb;
}

.message-content table tbody tr:hover {
    background-color: #f9fafb;
}

/* Cursor Blink Animation */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.cursor-blink {
    animation: blink 1s ease-in-out infinite;
    color: #5a7a9a;
    font-weight: bold;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Responsive */
@media (max-width: 1200px) {
    .main-container {
        flex-direction: column;
        height: auto;
    }
    
    .chat-container {
        width: 100%;
        height: 400px;
    }
    
    .App-header {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .App-header {
        padding: 15px 20px;
    }
    
    .App-header h1 {
        font-size: 1.5em;
    }
    
    .header-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .upload-box {
        padding: 30px;
    }
    
    .plot-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .threshold-control {
        justify-content: center;
    }
}

/* ========================================
   Thinking Indicator - 简洁版 (类似 ChatGPT)
   ======================================== */

.thinking-indicator {
    margin-bottom: 12px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 3px solid #6c757d;
}

.thinking-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.thinking-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #6c757d;
    padding: 6px 0;
}

.thinking-step.active {
    color: #495057;
}

.thinking-step.complete {
    color: #28a745;
}

.step-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #dee2e6;
    border-top-color: #6c757d;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.thinking-step.active .step-spinner {
    border-top-color: #0d6efd;
}

.thinking-step.complete .step-spinner,
.step-spinner.done {
    border: none;
    animation: none;
    color: #28a745;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-text {
    flex: 1;
}

/* 折叠后的摘要 */
.thinking-indicator.collapsed {
    padding: 8px 12px;
    background: #e9ecef;
    border-left-color: #28a745;
}

.thinking-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #6c757d;
}

.summary-icon {
    font-size: 14px;
}

.summary-text {
    flex: 1;
}

.summary-toggle {
    font-size: 10px;
    color: #adb5bd;
}

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

/* Cursor blink animation */
.cursor-blink {
    animation: blink 1s infinite;
    color: #0d6efd;
}

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

/* Multi-region selection display */
.multi-region-item {
    padding: 3px 5px;
    font-size: 9px;
    border-radius: 6px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.multi-region-item:not(:last-child) {
    margin-bottom: 2px;
}

.multi-region-item.clickable {
    cursor: pointer;
}

.multi-region-item.clickable:hover {
    background: rgba(255, 193, 7, 0.15);
    border-left-color: #ffc107;
}

.multi-region-item.highlighted {
    background: linear-gradient(90deg, rgba(255, 193, 7, 0.25), rgba(255, 152, 0, 0.1));
    border-left: 4px solid #ff9800;
    padding-left: 10px;
    font-weight: 600;
    animation: pulse-highlight 1.5s ease-in-out;
}

@keyframes pulse-highlight {
    0% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(255, 152, 0, 0.2); }
    100% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0); }
}

/* 共用思维链 */
.shared-thinking {
    background: #f0f7ff;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    border-left: 3px solid #3b82f6;
}

.thinking-status {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #3b82f6;
    font-size: 14px;
}

.thinking-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.thinking-done {
    color: #28a745;
    font-size: 14px;
}

/* 回复卡片容器 */
.responses-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

/* 区域响应卡片 */
.region-response-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

.region-response-card:hover {
    border-color: #3b82f6;
}

.region-response-card.active {
    border-color: #ff9800;
    border-width: 2px;
    box-shadow: 0 4px 16px rgba(255, 152, 0, 0.3);
    background: linear-gradient(180deg, rgba(255, 193, 7, 0.08), white 20%);
    animation: card-highlight 0.5s ease-out;
}

@keyframes card-highlight {
    0% { transform: scale(1.01); }
    100% { transform: scale(1); }
}

.region-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.region-card-header:hover {
    background: #e9ecef;
}

.region-badge {
    background: #3b82f6;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.region-badge-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
}

.region-badge-container .region-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 12px;
}

.region-badge-container .region-badge small {
    font-size: 9px;
    opacity: 0.9;
    margin-top: 2px;
}

.region-header {
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 10px;
}

.region-info {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.region-range {
    font-size: 11px;
    color: #999;
    margin-left: auto;
}

.region-card-body {
    padding: 14px;
    min-height: 50px;
}

/* 加载动画 */
.card-loading {
    display: flex;
    gap: 4px;
    padding: 10px 0;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: #3b82f6;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* 卡片内容 */
.card-content {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

.card-content p { margin-bottom: 10px; }
.card-content p:last-child { margin-bottom: 0; }
.card-content ul, .card-content ol { margin-left: 18px; margin-bottom: 10px; }
.card-content strong { color: #1a1a1a; }

.card-error {
    color: #dc3545;
    font-size: 13px;
}

/* Trait line styling - 使用 Flexbox 实现完美的悬挂缩进对齐 */
.trait-line {
    display: flex;             /* 启用 Flex 布局 */
    align-items: baseline;     /* 基线对齐 */
    margin: 6px 0;            
    line-height: 1.6;        
    font-size: 1em;           /* 统一改为 1em，避免不同列表字体大小不一致 */
    color: #444;
}

/* 文本内容容器 */
.trait-content {
    flex: 1;
    min-width: 0;             
    display: block;           
}

/* 通过 CSS 生成项目符号 */
.trait-line::before {
    content: "•";
    margin-right: 12px;       
    color: #666;             
    flex-shrink: 0;           
    line-height: 1.6;         
}

/* 消息容器中的样式覆盖 */
.message-content .trait-line,
.card-content .trait-line {
    font-size: 1em !important; /* 强制统一为 1em */
    color: #333;              
}

/* 调整引用文献的样式，顶格显示 */
.ref-line {
    font-size: 0.9em !important;
    color: #666;
    display: block;
    margin: 2px 0;            /* 移除左边距，顶格显示 */
    padding: 0;
    line-height: 1.4;
}

