/* style.css - 仿 Vue 风格 */

/* 1. 全局变量与基础样式 */
:root {
    /* 核心色彩 */
    --primary: #409EFF;         /* Element UI 蓝色，非常经典 */
    --primary-light: #ECF5FF;   /* 主色浅色版 */
    --primary-lighter: #F5FAFE; /* 主色更浅色版 */
    --accent: #4CAF50;          /* <-- 修改：更深、更显眼的绿色 */
    --accent-light: #e8f9e8;    /* 配合accent的浅色背景 */
    --warning: #E6A23C;         /* 警告色 */
    --danger: #F56C6C;          /* 危险色 */
    --info: #909399;            /* 信息色 */

    /* 背景与边框 */
    --bg-color: #f2f3f5;       /* 整体背景，柔和的浅灰色 */
    --card-bg: #ffffff;        /* 卡片背景 */
    --border-color-light: #e4e7ed; /* 轻量边框色 */
    --border-color-lighter: #ebeef5; /* 更轻量边框色 */

    /* 文本色彩 */
    --text-color-primary: #303133; /* 主要文本色 */
    --text-color-regular: #606266; /* 常规文本色 */
    --text-color-secondary: #909399; /* 次要文本色 */
    --text-color-placeholder: #C0C4CC; /* 占位符文本色 */

    /* 阴影 */
    --shadow-base: 0 2px 12px 0 rgba(0, 0, 0, 0.05); /* 基础卡片阴影 */
    --shadow-hover: 0 4px 16px 0 rgba(0, 0, 0, 0.08); /* 悬停卡片阴影 */
    --shadow-button: 0 2px 0 rgba(0, 0, 0, 0.015); /* 按钮轻微阴影 */

    /* 圆角 */
    --border-radius-base: 4px;
    --border-radius-medium: 8px;
    --border-radius-large: 12px;
}

/* 引入 Google Fonts - Poppins 用于标题，Inter 用于正文 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@500;600;700&display=swap');

body {
    font-family: 'Inter', sans-serif; /* 正文使用 Inter */
    background-color: var(--bg-color);
    margin: 0;
    padding: 30px 0; /* 增加整体上下边距 */
    color: var(--text-color-regular);
    line-height: 1.7; /* 增加行高，提升阅读舒适度 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 15px; /* 基础字号 */
}

/* 标题样式 */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif; /* 标题使用 Poppins */
    color: var(--text-color-primary);
    margin-top: 0;
    margin-bottom: 15px;
    font-weight: 600; /* 标题字重 */
}

h1 { font-size: 2.4em; font-weight: 700; color: var(--primary); margin-bottom: 20px;}
h2 { font-size: 1.8em; }
h3 { font-size: 1.3em; }
h4 { font-size: 1.1em; }

.container {
    width: 90%;
    max-width: 800px; /* 进一步增加最大宽度 */
    margin: 0 auto;
    padding: 0 20px; /* 增加水平内边距 */
}

header {
    text-align: center;
    margin-bottom: 40px; /* 增加头部与内容间距 */
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-base);
    border: 1px solid var(--border-color-lighter);
}
header p { color: var(--text-color-secondary); font-size: 0.9em; }

/* 2. 卡片样式 */
.card {
    background: var(--card-bg);
    padding: 35px; /* 增加卡片内边距 */
    border-radius: var(--border-radius-large); /* 统一大圆角 */
    box-shadow: var(--shadow-base);
    margin-bottom: 30px;
    border: 1px solid var(--border-color-lighter);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card:hover {
    transform: translateY(-4px); /* 悬停上浮更明显 */
    box-shadow: var(--shadow-hover);
}

/* 3. 进度条 */
.progress-bar {
    background: var(--border-color-light);
    height: 8px;
    border-radius: var(--border-radius-base);
    overflow: hidden;
    margin: 20px 0;
}
.progress {
    background: linear-gradient(90deg, #66b1ff, var(--primary)); /* 柔和渐变 */
    height: 100%;
    transition: width 0.4s ease-out;
    border-radius: var(--border-radius-base);
}

/* 4. 选项按钮 */
.options {
    display: grid;
    gap: 15px; /* 增加按钮间距 */
    margin-top: 25px;
}
.option-btn {
    display: block;
    width: 100%;
    padding: 16px 20px;
    border: 1px solid var(--border-color-light);
    background: var(--card-bg);
    border-radius: var(--border-radius-medium); /* 中等圆角 */
    font-size: 16px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.645, 0.045, 0.355, 1); /* 常用缓动曲线 */
    text-align: left;
    outline: none;
    color: var(--text-color-regular);
    box-shadow: var(--shadow-button);
}
.option-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-lighter); /* 更浅的主色背景 */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06); /* 悬停阴影 */
}
.option-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-button);
    background: var(--primary-light); /* 按下时更深的浅色背景 */
    border-color: var(--primary);
}

.reset-link {
    display: block;
    text-align: center;
    margin-top: 25px;
    color: var(--info);
    text-decoration: none;
    font-size: 0.9em;
    transition: color 0.2s ease;
}
.reset-link:hover {
    color: var(--text-color-primary);
}

/* 5. 结果卡片 */
.score-circle {
    width: 110px; height: 110px; /* 增大圆圈 */
    background: linear-gradient(135deg, #66b1ff, var(--primary)); /* 渐变背景 */
    color: #fff;
    border-radius: 50%;
    margin: 0 auto 25px;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    font-size: 42px; font-weight: 700;
    box-shadow: 0 6px 20px rgba(64, 158, 255, 0.3); /* 突出主色阴影 */
}
.score-circle small { font-size: 15px; font-weight: normal; opacity: 0.85; }
.result-card { text-align: center; }
.result-card h3 { margin-bottom: 12px; color: var(--primary); font-size: 1.6em;}
.result-card p { color: var(--text-color-secondary); font-size: 0.95em; }

/* 6. AI建议框 */
.ai-box {
    text-align: left;
    background: var(--primary-lighter); /* 浅主色背景 */
    padding: 20px 25px;
    border-radius: var(--border-radius-medium);
    margin: 30px 0;
    border: 1px solid var(--primary-light);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.03);
    position: relative;
    color: var(--text-color-regular);
}
.ai-box h4 {
    color: var(--primary);
    margin-bottom: 12px;
    padding-left: 28px; /* 为图标留出空间 */
    position: relative;
    font-weight: 600;
}
.ai-box h4::before {
    content: '💡'; /* 更换为灯泡图标 */
    position: absolute;
    left: 0;
    top: -2px;
    font-size: 1.4em;
    line-height: 1; /* 确保图标对齐 */
}
.markdown-body {
    font-size: 0.95em;
    line-height: 1.8;
}
.markdown-body p { margin-bottom: 1em; }
.markdown-body ul { padding-left: 25px; margin-bottom: 1em; }
.markdown-body li { margin-bottom: 0.6em; }

/* 7. 上传档案部分 */
.upload-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px dashed var(--border-color-light);
}
.upload-section h4 { color: var(--text-color-primary); font-weight: 600; }
.upload-section .small-text { font-size: 0.85em; color: var(--text-color-secondary); margin-bottom: 25px; }

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    margin-top: 20px;
}
.upload-form input[type="text"] {
    padding: 12px 15px;
    border: 1px solid var(--border-color-light);
    border-radius: var(--border-radius-base);
    width: 100%;
    max-width: 320px; /* 限制最大宽度 */
    font-size: 1em;
    color: var(--text-color-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.upload-form input[type="text"]::placeholder {
    color: var(--text-color-placeholder);
}
.upload-form input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.2); /* 主色光晕 */
    outline: none;
}

.btn-upload {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: var(--border-radius-base);
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 10px rgba(64, 158, 255, 0.2);
    width: 100%;
    max-width: 320px;
}
.btn-upload:hover {
    background: #66b1ff; /* 浅一点的主色 */
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(64, 158, 255, 0.3);
}
.btn-upload:active {
    background: #3a8ee6; /* 深一点的主色 */
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(64, 158, 255, 0.1);
}

.btn-restart {
    display: inline-block;
    margin-top: 35px;
    text-decoration: none;
    color: var(--info);
    font-weight: 500;
    padding: 8px 18px;
    border: 1px solid var(--border-color-light);
    border-radius: var(--border-radius-base);
    transition: all 0.2s ease;
}
.btn-restart:hover {
    background: var(--primary-lighter);
    border-color: var(--primary);
    color: var(--primary);
}
.msg-success {
    color: var(--accent); /* 成功信息使用新的 accent 绿色 */
    font-weight: 500;
    background: var(--accent-light); /* 极浅绿色背景 */
    padding: 12px 20px;
    border-radius: var(--border-radius-base);
    margin-bottom: 20px;
    border: 1px solid #c8e6c9; /* 成功信息边框，与新的 accent 绿色搭配 */
}

/* 8. 统计数据区域 */
.stats-container {
    background: var(--card-bg);
    padding: 35px;
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-base);
    margin-top: 40px;
    border: 1px solid var(--border-color-lighter);
}
.stats-container h2 { text-align: center; margin-bottom: 35px; color: var(--text-color-primary); }

.chart-wrapper {
    max-width: 380px; /* 进一步增大图表区域 */
    margin: 0 auto 40px;
    padding: 20px; /* 增加内边距 */
    background: var(--primary-lighter); /* 浅主色背景 */
    border-radius: var(--border-radius-large);
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

.recent-list { margin-top: 30px; }
.recent-list h3 { margin-bottom: 20px; color: var(--text-color-primary); }
.recent-list table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    text-align: left;
    background: var(--card-bg);
    border-radius: var(--border-radius-medium);
    overflow: hidden;
    border: 1px solid var(--border-color-lighter);
    box-shadow: var(--shadow-base);
}
.recent-list th {
    color: var(--text-color-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color-lighter);
    padding: 12px 18px;
    background: var(--bg-color); /* 表头背景 */
}
.recent-list td {
    border-bottom: 1px solid var(--border-color-lighter);
    padding: 12px 18px;
    vertical-align: middle;
    color: var(--text-color-regular);
}
.recent-list tr:last-child td { border-bottom: none; }
.recent-list tr:nth-child(even) { background: #f9f9f9; } /* 斑马纹 */

/* 9. 抑郁程度标签 - 使用 Vue-like 状态色 */
.tag {
    font-size: 13px;
    padding: 5px 10px;
    border-radius: var(--border-radius-base);
    font-weight: 500;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    line-height: 1;
    border: 1px solid transparent; /* <-- 修改：默认透明边框，下文具体定义颜色 */
    transition: all 0.2s ease;
}

/* 对应 `index.php` 中生成的类名来定义颜色 */
.tag.没有抑郁或极轻微 {
    background: var(--accent); /* <-- 修改：使用更深的 accent 绿色 */
    border-color: #388e3c;     /* <-- 新增：为此标签定义边框颜色，略深于背景色 */
}
.tag.轻度抑郁 {
    background: var(--primary);
    border-color: #3a8ee6;     /* <-- 新增：为此标签定义边框颜色 */
}
.tag.中度抑郁 {
    background: var(--warning);
    border-color: #d6892e;     /* <-- 新增：为此标签定义边框颜色 */
}
.tag.中重度抑郁 {
    background: var(--danger);
    border-color: #e54c4c;     /* <-- 新增：为此标签定义边框颜色 */
}
.tag.重度抑郁 {
    background: #CC3333;
    border-color: #a82a2a;     /* <-- 新增：为此标签定义边框颜色 */
}

.small-text { font-size: 0.85em; color: var(--text-color-secondary); }
.subtitle { font-size: 0.9em; color: var(--text-color-secondary); margin-top: -10px; margin-bottom: 25px; }

/* 响应式调整 */
@media (max-width: 768px) {
    body { padding: 20px 0; font-size: 14px; }
    .container { padding: 0 15px; }
    h1 { font-size: 2em; }
    h2 { font-size: 1.6em; }
    .card { padding: 25px; margin-bottom: 20px; }
    .option-btn { font-size: 15px; padding: 14px 15px; }
    .upload-form { flex-direction: column; align-items: stretch; gap: 10px; }
    .upload-form input[type="text"], .btn-upload { max-width: none; }
    .recent-list th, .recent-list td { padding: 10px 12px; font-size: 13px; }
    header { padding: 20px; margin-bottom: 30px; }
    .score-circle { width: 90px; height: 90px; font-size: 36px; margin-bottom: 20px; }
    .ai-box { margin: 25px 0; padding: 18px 20px; }
    .ai-box h4 { font-size: 1em; padding-left: 25px; }
    .ai-box h4::before { font-size: 1.2em; }
    .btn-restart { margin-top: 25px; }
    .stats-container { padding: 25px; margin-top: 30px; }
    .chart-wrapper { max-width: 300px; margin-bottom: 30px; }
}

/* 确保 Chart.js 容器是响应式的 */
canvas {
    max-width: 100%;
    height: auto;
}
