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

:root {
    --primary: #1890ff;
    --primary-dark: #096dd9;
    --success: #52c41a;
    --warning: #faad14;
    --danger: #f5222d;
    --orange: #fa8c16;
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-light: #666666;
    --border: #e8e8e8;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ========== H5容器 ========== */
.h5-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--card-bg);
    position: relative;
}

/* ========== 首页 ========== */
.index-hero {
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    color: white;
    padding: 60px 24px 40px;
    text-align: center;
}
.index-hero h1 { font-size: 28px; margin-bottom: 8px; }
.index-hero p { font-size: 14px; opacity: 0.9; }
.index-logo {
    width: 80px; height: 80px;
    background: rgba(255,255,255,0.15);
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 40px; margin: 0 auto 16px;
}
.index-features {
    padding: 24px;
}
.feature-item {
    display: flex; align-items: center;
    padding: 16px; margin-bottom: 12px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.feature-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; margin-right: 16px; flex-shrink: 0;
}
.feature-item h3 { font-size: 16px; margin-bottom: 2px; }
.feature-item p { font-size: 13px; color: var(--text-light); }

.index-cta {
    padding: 0 24px 40px;
}
.btn-primary {
    display: block;
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
    display: block;
    width: 100%;
    padding: 14px;
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 12px;
    font-size: 15px;
    cursor: pointer;
    margin-top: 8px;
}

/* ========== 表单 ========== */
.form-card {
    padding: 24px;
}
.form-card h2 {
    font-size: 20px; margin-bottom: 6px; text-align: center;
}
.form-card .subtitle {
    font-size: 14px; color: var(--text-light); text-align: center; margin-bottom: 24px;
}
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px;
}
.form-group input {
    width: 100%; padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    transition: border 0.2s;
}
.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(24,144,255,0.1);
}

/* ========== 测评页 ========== */
.survey-header {
    position: sticky; top: 0; z-index: 100;
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
}
.progress-bar {
    height: 6px;
    background: #e8e8e8;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1890ff, #096dd9);
    border-radius: 3px;
    transition: width 0.3s ease;
}
.progress-text {
    display: flex; justify-content: space-between;
    font-size: 12px; color: var(--text-light);
}

.question-container {
    padding: 20px 16px;
}
.question-card {
    display: none;
    animation: fadeIn 0.3s ease;
}
.question-card.active { display: block; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.question-number {
    font-size: 13px; color: var(--primary); font-weight: 600; margin-bottom: 6px;
}
.question-text {
    font-size: 18px; font-weight: 600; line-height: 1.5;
    margin-bottom: 20px; white-space: pre-line;
}
.option-list {
    list-style: none;
}
.option-item {
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    display: flex; align-items: center;
}
.option-item:hover {
    border-color: var(--primary);
    background: rgba(24,144,255,0.03);
}
.option-item.selected {
    border-color: var(--primary);
    background: rgba(24,144,255,0.08);
}
.option-label {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 14px; margin-right: 12px;
    flex-shrink: 0; transition: all 0.2s;
}
.option-item.selected .option-label {
    background: var(--primary); color: white;
}
.option-text { flex: 1; }

.survey-nav {
    display: flex; justify-content: space-between;
    padding: 16px;
    position: sticky; bottom: 0;
    background: white;
    border-top: 1px solid var(--border);
}
.btn-nav {
    padding: 12px 32px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: white;
    font-size: 15px;
    cursor: pointer;
    color: var(--text);
}
.btn-nav:disabled {
    opacity: 0.4; cursor: not-allowed;
}
.btn-nav.next {
    background: var(--primary); color: white; border: none;
}

/* ========== 结果页 ========== */
.result-hero {
    padding: 40px 24px;
    text-align: center;
}
.score-circle {
    width: 140px; height: 140px;
    border-radius: 50%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    margin: 0 auto 16px;
    border: 4px solid;
}
.score-value { font-size: 36px; font-weight: 700; }
.score-unit { font-size: 14px; }
.score-label { font-size: 16px; font-weight: 600; margin-top: 4px; }

.result-section {
    padding: 0 16px 16px;
}
.result-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.result-card h3 {
    font-size: 16px; margin-bottom: 12px;
    border-left: 4px solid var(--primary);
    padding-left: 10px;
}
.dim-bar {
    margin-bottom: 12px;
}
.dim-bar-header {
    display: flex; justify-content: space-between;
    font-size: 13px; margin-bottom: 4px;
}
.dim-bar-track {
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}
.dim-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.risk-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px; font-weight: 600;
}
.risk-low { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.risk-mid { background: #fffbe6; color: #faad14; border: 1px solid #ffe58f; }
.risk-high { background: #fff2e8; color: #fa8c16; border: 1px solid #ffbb96; }
.risk-critical { background: #fff1f0; color: #f5222d; border: 1px solid #ffa39e; }

.recommendation-list {
    list-style: none;
}
.recommendation-list li {
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}
.recommendation-list li:last-child { border: none; }

/* ========== 管理后台 ========== */
.admin-body {
    background: var(--bg);
    min-height: 100vh;
}
.admin-header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
    display: flex; align-items: center; justify-content: space-between;
}
.admin-header h1 { font-size: 18px; }
.admin-header .links a {
    color: var(--text-light); font-size: 14px;
    margin-left: 20px; text-decoration: none;
}
.admin-header .links a:hover { color: var(--primary); }
.admin-header .links a.active { color: var(--primary); font-weight: 600; }

.admin-content { padding: 24px; max-width: 1200px; margin: 0 auto; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px; margin-bottom: 24px;
}
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}
.stat-card .label { font-size: 13px; color: var(--text-light); }
.stat-card .value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat-card .sub { font-size: 12px; color: var(--text-light); margin-top: 4px; }

.chart-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}
.chart-card h3 { font-size: 16px; margin-bottom: 16px; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
table.data-table th {
    background: #fafafa;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
}
table.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid #f5f5f5;
}
table.data-table tr:hover { background: #fafafa; }

.login-card {
    max-width: 360px;
    margin: 80px auto;
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow);
}
.login-card h2 { text-align: center; margin-bottom: 24px; }
.login-error {
    color: var(--danger); font-size: 14px; margin-bottom: 12px; text-align: center;
}

.dim-table {
    width: 100%; border-collapse: collapse;
}
.dim-table th, .dim-table td {
    padding: 8px 12px; font-size: 13px; text-align: center;
    border: 1px solid #f0f0f0;
}
.dim-table th { background: #fafafa; font-weight: 600; }

.bar-chart-row {
    display: flex; align-items: center; gap: 12px; margin-bottom: 10px;
}
.bar-chart-label { width: 80px; font-size: 13px; }
.bar-chart-track { flex: 1; height: 24px; background: #f0f0f0; border-radius: 12px; overflow: hidden; }
.bar-chart-fill { height: 100%; border-radius: 12px; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; color: white; font-size: 12px; font-weight: 600; }

.filter-bar {
    display: flex; gap: 12px; margin-bottom: 16px; align-items: center;
}
.filter-bar input, .filter-bar select {
    padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 14px;
}
.filter-bar input { flex: 1; }
.btn-sm {
    padding: 8px 16px; border: none; border-radius: 8px;
    font-size: 13px; cursor: pointer; text-decoration: none;
    display: inline-block;
}
.btn-sm-primary { background: var(--primary); color: white; }
.btn-sm-success { background: var(--success); color: white; }
.btn-sm-danger { background: var(--danger); color: white; }

@media (max-width: 768px) {
    .admin-content { padding: 12px; }
    table.data-table { font-size: 12px; }
    table.data-table th, table.data-table td { padding: 8px; }
    .stat-grid { grid-template-columns: 1fr; }
}
