/* ============================================
   大学生睡眠质量调查系统 - 样式表
   ============================================ */

/* ----- CSS 变量 ----- */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --primary-bg: #eef2ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
}

/* ----- 全局重置 ----- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ----- 容器 ----- */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ----- 头部 ----- */
.header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #a855f7 100%);
    color: #fff;
    padding: 48px 0 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 40px;
    background: var(--bg);
    border-radius: 50% 50% 0 0;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.header .subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
    line-height: 1.8;
    max-width: 550px;
    margin: 0 auto;
}

.header .subtitle strong {
    color: #fbbf24;
    font-weight: 700;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.header h1 {
    animation: float 3s ease-in-out infinite;
}

/* ----- 主内容区 ----- */
main.container {
    padding-top: 8px;
    padding-bottom: 40px;
}

/* ----- 进度条 ----- */
.progress-wrapper {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 16px;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.progress-bar {
    flex: 1;
    height: 10px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #a855f7);
    border-radius: 99px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

.progress-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 90px;
    text-align: right;
}

/* ----- 问题分组 ----- */
.question-group {
    margin-bottom: 28px;
}

.group-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 14px;
    padding-left: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ----- 问题卡片 ----- */
.question-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
    transition: all var(--transition);
    position: relative;
}

.question-card:hover {
    box-shadow: var(--shadow-md);
}

.question-card.answered {
    border-color: #d9f99d;
    background: #f7fee7;
}

.question-card.answered::after {
    content: "✓";
    position: absolute;
    top: 16px;
    right: 20px;
    width: 26px;
    height: 26px;
    background: var(--success);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.question-text {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
    padding-right: 36px;
}

/* ----- 选项 ----- */
.options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.option {
    position: relative;
    cursor: pointer;
    flex: 1;
    min-width: 100px;
}

.option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option span {
    display: block;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 0.93rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: #f8fafc;
    transition: all var(--transition);
    user-select: none;
}

.option:hover span {
    border-color: var(--primary-light);
    color: var(--primary);
    background: var(--primary-bg);
}

.option input:checked + span {
    border-color: var(--primary);
    background: var(--primary-bg);
    color: var(--primary-dark);
    font-weight: 700;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* ----- 提交区 ----- */
.submit-wrapper {
    text-align: center;
    padding: 32px 0 20px;
}

.btn-submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 16px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border: none;
    border-radius: 99px;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.35);
    letter-spacing: 0.01em;
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}

.btn-submit:active:not(:disabled) {
    transform: translateY(0);
}

.btn-submit:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    box-shadow: none;
    color: #94a3b8;
}

.submit-hint {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ----- 结果展示区 ----- */
.result-section {
    margin-top: 20px;
    animation: fadeInUp 0.5s ease;
}

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

.result-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 36px 32px;
    box-shadow: var(--shadow-lg);
    border-top: 4px solid var(--primary);
}

.result-header {
    text-align: center;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 2px dashed var(--border);
}

.result-header .score-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 12px;
    position: relative;
}

.score-excellent { background: #d1fae5; color: #065f46; }
.score-good      { background: #dbeafe; color: #1e40af; }
.score-medium     { background: #fef3c7; color: #92400e; }
.score-poor       { background: #fee2e2; color: #991b1b; }

.result-header .level-badge {
    display: inline-block;
    padding: 6px 20px;
    border-radius: 99px;
    font-weight: 700;
    font-size: 0.95rem;
    margin-top: 8px;
}

.badge-excellent { background: #d1fae5; color: #065f46; }
.badge-good      { background: #dbeafe; color: #1e40af; }
.badge-medium    { background: #fef3c7; color: #92400e; }
.badge-poor      { background: #fee2e2; color: #991b1b; }

/* ----- 对比图表区 ----- */
.comparison-section {
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 24px;
    margin: 24px 0;
}

.comparison-section h3 {
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    text-align: center;
}

.comparison-bars {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.comparison-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.comparison-label {
    width: 70px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
}

.comparison-track {
    flex: 1;
    height: 24px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
    position: relative;
}

.comparison-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 1s ease 0.2s;
}

.comparison-fill.you    { background: linear-gradient(90deg, var(--primary), #7c3aed); }
.comparison-fill.normal { background: linear-gradient(90deg, #34d399, #10b981); }

.comparison-bar-row .comparison-value {
    width: 48px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
}

.comparison-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.comparison-legend .dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: middle;
}

.dot-you    { background: linear-gradient(90deg, var(--primary), #7c3aed); }
.dot-normal { background: linear-gradient(90deg, #34d399, #10b981); }

/* ----- 报告内容 ----- */
.report-block {
    margin-bottom: 24px;
}

.report-block h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.report-block p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.8;
    padding-left: 4px;
}

.advice-list {
    list-style: none;
    padding: 0;
}

.advice-list li {
    position: relative;
    padding: 10px 14px 10px 32px;
    margin-bottom: 6px;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    font-size: 0.93rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.advice-list li::before {
    content: "💡";
    position: absolute;
    left: 8px;
    top: 10px;
    font-size: 0.85rem;
}

/* ----- 重新填写按钮 ----- */
.btn-retry {
    display: block;
    margin: 24px auto 0;
    padding: 12px 32px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 99px;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-retry:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

/* ----- 页脚 ----- */
.footer {
    text-align: center;
    padding: 24px 20px;
    color: var(--text-light);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 20px;
}

/* ----- 响应式 ----- */
@media (max-width: 640px) {
    .header {
        padding: 32px 0 28px;
    }
    .header h1 {
        font-size: 1.4rem;
    }
    .header .subtitle {
        font-size: 0.85rem;
    }
    .question-card {
        padding: 18px 16px;
    }
    .question-text {
        font-size: 0.95rem;
        padding-right: 30px;
    }
    .options {
        gap: 6px;
    }
    .option span {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    .btn-submit {
        padding: 14px 28px;
        font-size: 1rem;
    }
    .result-card {
        padding: 24px 18px;
    }
    .comparison-bar-row {
        flex-wrap: wrap;
    }
    .comparison-label {
        width: 60px;
        font-size: 0.8rem;
    }
}
