@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    /* 核心色彩 - 深邃医疗蓝渐变 */
    --primary-gradient: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    --bg-gradient: radial-gradient(circle at top right, #F8FAFF 0%, #F2F2F7 100%);
    
    --primary-color: #007AFF;
    --primary-dark: #0056B3;
    --primary-soft: rgba(0, 122, 255, 0.1);
    
    --success-color: #34C759;
    --warning-color: #FF9500;
    --danger-color: #FF3B30;
    
    --text-main: #1C1C1E;
    --text-secondary: #636366;
    --text-muted: #8E8E93;
    
    /* 玻璃拟态效果 */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-blur: blur(20px);
    
    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
    
    --safe-area-bottom: env(safe-area-inset-bottom);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', -apple-system, system-ui, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
}

/* 背景装饰光斑 */
.bg-blob {
    position: fixed;
    width: 300px;
    height: 300px;
    background: var(--primary-soft);
    filter: blur(80px);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
}
.blob-1 { top: -100px; right: -100px; background: rgba(88, 86, 214, 0.15); }
.blob-2 { bottom: 100px; left: -150px; background: rgba(0, 122, 255, 0.1); }

/* 容器与布局 */
.container {
    padding: 24px 20px;
    padding-bottom: calc(90px + var(--safe-area-bottom)); /* 增加底部间距，确保内容不被 Tab 遮挡 */
}

.header {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 18px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header h1 {
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.header .back-btn {
    position: absolute;
    left: 15px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    border-radius: 50%;
    color: var(--primary-color);
    cursor: pointer;
}

/* 玻璃卡片样式 */
.card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:active {
    transform: translateY(2px);
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 按钮优化 */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 56px;
    border-radius: 18px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    outline: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 8px 20px rgba(0, 122, 255, 0.3);
}

.btn-primary:active {
    transform: translateY(2px) scale(0.98);
    box-shadow: 0 4px 10px rgba(0, 122, 255, 0.3);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--primary-color);
    color: var(--primary-color);
}

/* 表单优化 */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    margin-left: 4px;
}

.form-input {
    width: 100%;
    height: 54px;
    background: rgba(255, 255, 255, 0.5);
    border: 1.5px solid var(--glass-border);
    border-radius: 16px;
    padding: 0 18px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-input:focus {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

/* 底部 Tab 栏 - 微信小程序一致体验 */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 500px;
    margin: 0 auto;
    height: calc(64px + var(--safe-area-bottom));
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    border-radius: 0;
    display: flex;
    justify-content: space-around;
    padding-bottom: var(--safe-area-bottom);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.05);
    z-index: 1000;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
}

.tab-item.active {
    color: var(--primary-color);
}

.tab-item.active .tab-icon {
    transform: scale(1.1) translateY(-2px);
}

.tab-icon {
    font-size: 22px;
    margin-bottom: 2px;
    transition: transform 0.3s ease;
}

/* 状态组件 */
.badge {
    padding: 4px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: #E1F5E8; color: var(--success-color); }
.badge-info { background: #E5F1FF; color: var(--primary-color); }

/* 动画特效 */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-up {
    animation: slideUp 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

/* 全局滚动条美化 - 使其极致简约 */
::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* 聊天特定增强布局 */
.chat-input-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 20px calc(15px + var(--safe-area-bottom));
    background: linear-gradient(to top, rgba(255, 255, 255, 1) 80%, rgba(255, 255, 255, 0) 100%);
    display: flex;
    gap: 12px;
    align-items: center;
    z-index: 10;
}

.chat-input-field {
    flex: 1;
    background: #F2F2F7;
    border: none;
    border-radius: 20px;
    height: 44px;
    padding: 0 16px;
    font-size: 15px;
    outline: none;
}

/* 列表项通用布局 */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--glass-border);
    transition: background 0.2s;
}

.list-item:active {
    background: var(--primary-soft);
    border-radius: 12px;
}

.list-item:last-child {
    border-bottom: none;
}

/* --- 新增：精致分组列表布局 --- */
.form-section {
    background: white;
    border-radius: 20px;
    padding: 8px 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.form-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 0 10px 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-cell {
    display: flex;
    align-items: center;
    min-height: 56px;
    padding: 4px 0;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.05);
    position: relative;
}

.form-cell:last-child {
    border-bottom: none;
}

.cell-label {
    width: 100px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
}

.cell-value {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    text-align: right;
    font-size: 15px;
    color: var(--text-main);
}

/* 优化 Select 和 Date 的内嵌样式 */
.cell-value select,
.cell-value input[type="date"],
.cell-value input[type="text"] {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    color: var(--text-main);
    text-align: right;
    width: 100%;
    outline: none;
    padding-right: 20px; /* 为箭头留位 */
    -webkit-appearance: none;
}

.cell-value select {
    cursor: pointer;
}

/* 占位符颜色 */
.cell-value input::placeholder {
    color: var(--text-muted);
}

/* 右侧箭头指示 */
.cell-arrow {
    position: absolute;
    right: 0;
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

.cell-arrow::after {
    content: '→'; /* 简单的字符箭头，后续可用更精致的 SVG */
    display: inline-block;
    transform: rotate(0deg);
    opacity: 0.5;
}

/* 针对分期的特殊布局 */
.cell-group-vertical {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 12px 0;
}

.cell-group-vertical .cell-label {
    width: 100%;
    margin-bottom: 12px;
}

/* 聊天气泡 */
.chat-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    margin-bottom: 12px;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease-out;
}

.received {
    background: white;
    color: var(--text-main);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.sent {
    background: var(--primary-gradient);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
}

.hidden { display: none !important; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
