/* ============================================
   TCM Learning Assistant - Modern UI Styles
   ============================================ */

:root {
    /* 主题色 */
    --primary: #2d5a27;
    --primary-light: #4a8c42;
    --primary-dark: #1a3d16;
    --accent: #d4a84b;
    --accent-light: #e8c87a;

    /* 背景色 */
    --bg-dark: #0f1419;
    --bg-card: #1a2027;
    --bg-card-hover: #242d35;
    --bg-input: #1e262f;

    /* 文字色 */
    --text-primary: #f0f4f8;
    --text-secondary: #8899a6;
    --text-muted: #657786;

    /* 边框 */
    --border-color: #2f3940;
    --border-light: #3d4f5f;

    /* 渐变 */
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    --gradient-accent: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    --gradient-hero: linear-gradient(180deg, rgba(45, 90, 39, 0.15) 0%, transparent 100%);

    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* 过渡 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   导航栏
   ============================================ */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(15, 20, 25, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.nav-brand:hover {
    opacity: 0.8;
}

.nav-logo {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
}

.nav-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.nav-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--primary);
    color: white;
}

/* ============================================
   页面容器
   ============================================ */

.page {
    display: none;
    padding-top: 64px;
    min-height: 100vh;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   首页 Hero
   ============================================ */

.hero {
    background: var(--gradient-hero);
    padding: 80px 32px 60px;
    text-align: center;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.hero-search {
    display: flex;
    max-width: 560px;
    margin: 0 auto 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.hero-search:focus-within {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(74, 140, 66, 0.2);
}

.hero-search input {
    flex: 1;
    padding: 16px 20px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
}

.hero-search input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    padding: 12px 20px;
    background: var(--primary);
    border: none;
    color: white;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.search-btn:hover {
    background: var(--primary-light);
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ============================================
   功能卡片
   ============================================ */

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    padding: 48px 32px;
    max-width: 1200px;
    margin: 0 auto;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.feature-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    font-size: 40px;
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.feature-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ============================================
   页面头部
   ============================================ */

.page-header {
    padding: 32px;
    text-align: center;
}

.page-header h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
}

.page-desc {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.search-bar {
    display: flex;
    max-width: 560px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.search-bar:focus-within {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(74, 140, 66, 0.2);
}

.search-bar input {
    flex: 1;
    padding: 14px 18px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

/* ============================================
   分类筛选
   ============================================ */

.category-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 0 32px 24px;
}

.category-chip {
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.category-chip:hover {
    border-color: var(--primary-light);
    color: var(--text-primary);
}

.category-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ============================================
   方剂网格
   ============================================ */

.formula-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 0 32px 48px;
    max-width: 1400px;
    margin: 0 auto;
}

.formula-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.formula-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.formula-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.formula-category {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(212, 168, 75, 0.15);
    border-radius: 12px;
    font-size: 12px;
    color: var(--accent-light);
    margin-bottom: 12px;
}

.formula-efficacy {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.formula-source {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
   药材网格
   ============================================ */

.herb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    padding: 0 32px 48px;
    max-width: 1400px;
    margin: 0 auto;
}

.herb-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.herb-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.herb-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.herb-grade {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    margin-bottom: 8px;
}

.herb-grade.upper { background: rgba(76, 175, 80, 0.2); color: #81c784; }
.herb-grade.middle { background: rgba(255, 193, 7, 0.2); color: #ffd54f; }
.herb-grade.lower { background: rgba(244, 67, 54, 0.2); color: #e57373; }
.herb-grade.other { background: rgba(156, 39, 176, 0.2); color: #ce93d8; }

.herb-nature {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================
   辨证页面
   ============================================ */

.diagnosis-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 32px 48px;
}

.symptom-input-area {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
}

.symptom-input-area h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.symptom-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    min-height: 40px;
}

.symptom-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--primary);
    border-radius: 20px;
    font-size: 14px;
    color: white;
    animation: tagIn 0.2s ease;
}

@keyframes tagIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.symptom-tag .remove {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.symptom-tag .remove:hover {
    opacity: 1;
}

.symptom-input-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.symptom-input-row input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: border-color var(--transition-fast);
}

.symptom-input-row input:focus {
    border-color: var(--primary-light);
}

.btn-primary {
    padding: 12px 24px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.common-symptoms {
    margin-bottom: 24px;
}

.common-symptoms .label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-right: 8px;
}

.symptom-chip {
    display: inline-block;
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-secondary);
    font-size: 13px;
    margin: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.symptom-chip:hover {
    border-color: var(--primary-light);
    color: var(--text-primary);
}

.btn-diagnose {
    width: 100%;
    padding: 16px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-diagnose:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-diagnose:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   辨证结果
   ============================================ */

.diagnosis-result {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.diagnosis-result h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.result-section {
    margin-bottom: 24px;
}

.result-section h4 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.syndrome-match {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
}

.syndrome-name {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.syndrome-score {
    display: inline-block;
    padding: 2px 8px;
    background: var(--accent);
    border-radius: 10px;
    font-size: 12px;
    color: var(--bg-dark);
    margin-left: 8px;
}

.syndrome-desc {
    font-size: 14px;
    color: var(--text-secondary);
}

.recommended-formula {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.recommended-formula:hover {
    background: var(--bg-card-hover);
}

.formula-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.formula-header .name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.match-score {
    font-size: 14px;
    color: var(--accent);
}

.formula-indications {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.formula-source {
    font-size: 12px;
    color: var(--text-muted);
}

.disclaimer {
    background: rgba(212, 168, 75, 0.1);
    border-left: 3px solid var(--accent);
    padding: 12px 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 13px;
    color: var(--accent-light);
}

/* ============================================
   弹窗
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    max-width: 720px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: var(--bg-input);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 10;
}

.modal-close:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* ============================================
   方剂详情
   ============================================ */

.formula-detail {
    padding: 32px;
}

.detail-header {
    margin-bottom: 24px;
}

.detail-name {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.meta-tag {
    padding: 4px 12px;
    background: var(--bg-input);
    border-radius: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.classic-text-section {
    background: rgba(212, 168, 75, 0.08);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.classic-text {
    font-style: italic;
    color: var(--accent-light);
    line-height: 1.8;
    font-size: 15px;
}

.classic-source {
    text-align: right;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section h4 {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.composition-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.composition-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.composition-item:hover {
    background: var(--bg-card-hover);
}

.composition-item .herb-name {
    font-weight: 500;
    color: var(--primary-color);
}

.composition-item .herb-note {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.composition-item .dosage {
    color: var(--text-muted);
    font-size: 13px;
}

.composition-item .role {
    padding: 2px 6px;
    background: var(--primary);
    border-radius: 8px;
    font-size: 11px;
    color: white;
}

.detail-text {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.variations-section {
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 20px;
}

.variation-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.variation-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.variation-item:first-child {
    padding-top: 0;
}

.variation-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.variation-changes {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.variation-indication {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================
   药材详情
   ============================================ */

.herb-detail {
    padding: 32px;
}

.herb-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}

.herb-detail-name {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.herb-detail-grade {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    margin-top: 4px;
}

.nature-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.nature-tag {
    padding: 6px 12px;
    background: var(--bg-input);
    border-radius: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.classic-text {
    font-style: italic;
    color: var(--accent-light);
    line-height: 1.8;
}

/* ============================================
   加载状态
   ============================================ */

.loading {
    display: flex;
    justify-content: center;
    padding: 48px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Toast 提示
   ============================================ */

.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    opacity: 0;
    transition: all var(--transition-normal);
    z-index: 300;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ============================================
   响应式
   ============================================ */

@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
    }

    .nav-title {
        display: none;
    }

    .nav-links {
        gap: 4px;
    }

    .nav-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .hero {
        padding: 60px 16px 40px;
    }

    .hero-title {
        font-size: 32px;
    }

    .hero-stats {
        gap: 24px;
    }

    .stat-number {
        font-size: 24px;
    }

    .features {
        padding: 32px 16px;
    }

    .page-header {
        padding: 24px 16px;
    }

    .page-header h2 {
        font-size: 24px;
    }

    .formula-grid,
    .herb-grid {
        padding: 0 16px 32px;
    }

    .diagnosis-container {
        padding: 0 16px 32px;
    }

    .symptom-input-area {
        padding: 20px;
    }

    .modal {
        padding: 16px;
    }

    .modal-content {
        max-height: 90vh;
    }

    .formula-detail,
    .herb-detail {
        padding: 24px;
    }

    .detail-name,
    .herb-detail-name {
        font-size: 24px;
    }
}

/* 经典煎服法样式 */
.section-source {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--primary-light);
    margin-left: 0.5rem;
    opacity: 0.8;
}

.classic-usage {
    line-height: 1.8;
    text-align: justify;
    color: var(--text-primary);
}

/* 开发中标签 */
.badge-dev {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 500;
    padding: 2px 6px;
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border-radius: 4px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.feature-dev {
    opacity: 0.85;
    cursor: default !important;
}

.feature-dev:hover {
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
}

.dev-notice {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.dev-notice-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.dev-notice-content strong {
    display: block;
    color: #ffc107;
    margin-bottom: 8px;
    font-size: 1rem;
}

.dev-notice-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.dev-notice-large {
    text-align: center;
    padding: 60px 40px;
    background: var(--bg-card);
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-lg);
    max-width: 500px;
    margin: 40px auto;
}

.dev-notice-icon-large {
    font-size: 64px;
    margin-bottom: 24px;
}

.dev-notice-large h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.dev-notice-large p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
}

.dev-notice-large .dev-notice-tip {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    color: var(--primary-light);
    font-weight: 500;
}

/* ============================================
   智能辨证 — 对话界面
   ============================================ */

/* 覆盖 .page.active 的 display:block，改为 flex 横向布局 */
#page-diagnosis.active {
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
    padding-top: 64px;
    animation: fadeIn 0.3s ease;
}

/* ---- 左侧历史会话侧栏 ---- */
.chat-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.chat-sidebar {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-darker, #0f1a14);
    border-right: 1px solid var(--border-color);
    transition: width 0.25s ease, opacity 0.25s ease;
    overflow: hidden;
}

.chat-sidebar.collapsed {
    width: 0;
    opacity: 0;
    pointer-events: none;
}

.chat-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 10px;
    flex-shrink: 0;
}

.chat-sidebar-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.chat-sidebar-close {
    width: 22px;
    height: 22px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.chat-sidebar-close:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.chat-session-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px 12px;
}

.chat-session-list::-webkit-scrollbar { width: 4px; }
.chat-session-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.chat-session-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
    position: relative;
    min-width: 0;
}

.chat-session-item:hover {
    background: var(--bg-card);
}

.chat-session-item.active {
    background: rgba(74, 140, 66, 0.14);
}

.chat-session-item.active .chat-session-title {
    color: var(--primary-light);
}

.chat-session-icon {
    font-size: 13px;
    flex-shrink: 0;
    margin-top: 1px;
    opacity: 0.7;
}

.chat-session-info {
    flex: 1;
    min-width: 0;
}

.chat-session-title {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.chat-session-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.chat-session-del {
    width: 18px;
    height: 18px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-fast), background var(--transition-fast);
    flex-shrink: 0;
    padding: 0;
    font-size: 14px;
    line-height: 1;
}

.chat-session-item:hover .chat-session-del {
    opacity: 1;
}

.chat-session-del:hover {
    background: rgba(255, 80, 80, 0.15);
    color: #e57373;
}

.chat-session-empty {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    padding: 24px 12px;
    line-height: 1.8;
}

/* ---- 右侧主聊天区 ---- */
.chat-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 移动端展开历史按钮（桌面端隐藏）*/
.chat-history-toggle {
    display: none;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.chat-history-toggle:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* 移动端遮罩 */
.chat-sidebar-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 200;
}

/* 顶栏 */
.chat-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 48px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chat-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-topbar-avatar {
    width: 26px;
    height: 26px;
    background: var(--gradient-primary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
}

.chat-beta-tag {
    font-size: 10px;
    font-weight: 600;
    color: var(--accent-light);
    background: rgba(212, 168, 75, 0.12);
    padding: 2px 6px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-new-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chat-new-btn:hover {
    border-color: var(--border-light);
    color: var(--text-primary);
    background: var(--bg-card);
}

/* 消息滚动区 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    scroll-behavior: smooth;
}

/* 单条消息容器 */
.chat-msg {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    animation: fadeIn 0.2s ease;
}

.chat-msg-user {
    flex-direction: row-reverse;
}

/* AI 头像 */
.chat-avatar {
    width: 30px;
    height: 30px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* 气泡 */
.chat-bubble {
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.75;
}

.chat-bubble-user {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
    max-width: 65%;
    margin-left: auto;
}

.chat-bubble-ai {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    flex: 1;
    min-width: 0;
}

/* 气泡内分析文字 */
.analysis-title {
    display: block;
    font-weight: 700;
    color: var(--accent-light);
    margin-top: 12px;
    margin-bottom: 5px;
    font-size: 14px;
}

.analysis-title:first-child {
    margin-top: 0;
}

.analysis-bullet {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 3px;
    font-size: 13.5px;
    padding-left: 2px;
}

.analysis-line {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 3px;
    font-size: 13.5px;
}

/* AI 思考动画 */
.chat-thinking {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 2px;
}

.chat-thinking span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: chatDot 1.2s ease-in-out infinite;
}

.chat-thinking span:nth-child(2) { animation-delay: 0.2s; }
.chat-thinking span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatDot {
    0%, 60%, 100% { opacity: 0.25; transform: scale(0.85); }
    30% { opacity: 1; transform: scale(1.1); }
}

/* 流式输出时末尾闪烁光标 */
.chat-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--primary-color, #7c9e87);
    margin-left: 2px;
    vertical-align: text-bottom;
    border-radius: 1px;
    animation: chatCursorBlink 0.8s step-start infinite;
}

@keyframes chatCursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* 方剂推荐（内嵌在 AI 气泡内）*/
.chat-formula-recs {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.chat-recs-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
}

.chat-recs-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-rec-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.chat-rec-item.clickable {
    cursor: pointer;
}

.chat-rec-item.clickable:hover {
    border-color: var(--primary-light);
    background: var(--bg-card-hover);
}

.chat-rec-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 56px;
}

.chat-rec-reason {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.chat-rec-arrow {
    margin-left: auto;
    color: var(--primary-light);
    font-size: 13px;
    flex-shrink: 0;
    align-self: center;
}

/* 底部输入区 */
.chat-input-area {
    flex-shrink: 0;
    background: var(--bg-dark);
    border-top: 1px solid var(--border-color);
    padding: 10px 24px 16px;
}

.chat-input-wrap {
    max-width: 720px;
    margin: 0 auto;
}

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 10px 10px 16px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-input-row:focus-within {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(74, 140, 66, 0.15);
}

.chat-textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    resize: none;
    max-height: 120px;
    overflow-y: auto;
}

.chat-textarea::placeholder {
    color: var(--text-muted);
}

.chat-send-btn {
    width: 34px;
    height: 34px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition-fast);
}

.chat-send-btn:hover:not(:disabled) {
    background: var(--primary-light);
}

.chat-send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.chat-disclaimer-text {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
}

/* 加载 spinner（复用） */
.btn-spinner-inline {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* 快捷示例 chips（与 .category-chip 风格统一）*/
.diag-example-chip {
    padding: 5px 12px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.diag-example-chip:hover {
    border-color: var(--primary-light);
    color: var(--text-primary);
    background: rgba(74, 140, 66, 0.12);
}

@media (max-width: 768px) {
    .chat-messages { padding: 16px; }
    .chat-input-area { padding: 8px 16px 12px; }
    .chat-bubble { font-size: 13px; }
    .chat-bubble-user { max-width: 80%; }

    /* 移动端侧栏改为绝对定位抽屉 */
    .chat-sidebar {
        position: fixed;
        top: 64px;
        left: 0;
        bottom: 0;
        z-index: 201;
        width: 240px;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    .chat-sidebar.open {
        transform: translateX(0);
    }

    .chat-sidebar.collapsed {
        width: 240px;
        opacity: 1;
        pointer-events: auto;
        transform: translateX(-100%);
    }

    .chat-sidebar-mask.visible {
        display: block;
    }

    .chat-history-toggle {
        display: flex;
    }
}
