/* ==========================================================
   水稻问卷 全站样式（简洁版）
   原则：单一主色、无渐变、轻阴影、克制动效、充足留白
   ========================================================== */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-bg: #eff6ff;
    --bg: #f8f9fa;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --green: #059669;
    --green-bg: #ecfdf5;
    --red: #dc2626;
    --red-bg: #fef2f2;
    --amber: #d97706;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

a { text-decoration: none; color: var(--primary); }
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--text-muted); }

/* ---------------- 顶部导航 ---------------- */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
}
.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    height: 56px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; color: var(--text); }
.brand-mark {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    color: #fff;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(37, 99, 235, .25);
}
.brand-name {
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.nav { display: flex; align-items: center; gap: 20px; }
.nav-link { color: var(--text-muted); font-weight: 500; font-size: 14px; padding: 4px 0; transition: color .15s; }
.nav-link:hover { color: var(--primary); }
.nav-link.active { color: var(--primary); border-bottom: 2px solid var(--primary); }
.nav-link-admin {
    background: var(--primary); color: #fff; padding: 6px 14px; border-radius: 8px; font-size: 13px;
}
.nav-link-admin:hover { background: var(--primary-hover); color: #fff; }
.nav-link-plain { color: var(--text-muted); }

/* ---------------- 前台 ---------------- */
.front-body { min-height: 100vh; display: flex; flex-direction: column; }
.main-area { flex: 1; padding: 32px 20px 56px; }

.hero {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 55%, #3b82f6 100%);
    border-radius: 16px;
    padding: 42px 36px;
    color: #fff;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}
.hero::before, .hero::after {
    content: ''; position: absolute; border-radius: 50%;
    background: rgba(255, 255, 255, .08);
}
.hero::before { width: 260px; height: 260px; top: -110px; right: -60px; }
.hero::after  { width: 180px; height: 180px; bottom: -90px; left: 24px; }
.hero-title { position: relative; z-index: 1; font-size: 30px; font-weight: 800; letter-spacing: .5px; }
.hero-sub { position: relative; z-index: 1; margin-top: 8px; font-size: 15px; opacity: .85; }

.survey-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px;
}
.survey-card {
    background: var(--card-bg); border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow); border: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 12px;
    transition: border-color .15s;
}
.survey-card:hover { border-color: #cbd5e1; }
.survey-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.survey-card-title { font-size: 16px; font-weight: 600; line-height: 1.4; }
.survey-card-desc { color: var(--text-muted); font-size: 13.5px; flex: 1; }
.survey-card-foot { display: flex; align-items: center; justify-content: space-between; }
.meta { color: var(--text-muted); font-size: 13px; }

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: none; cursor: pointer; font-family: inherit;
    padding: 8px 18px; border-radius: 8px; font-size: 14px; font-weight: 500;
    transition: background-color .15s, border-color .15s, color .15s; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--red-bg); color: var(--red); border: 1px solid #fecaca; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-xs { padding: 3px 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 10px 28px; font-size: 15px; }

/* ---------------- 徽章 ---------------- */
.badge {
    display: inline-block; padding: 2px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 500; white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-gray { background: #f3f4f6; color: var(--text-muted); }

/* ---------------- 空状态 ---------------- */
.empty-box {
    background: var(--card-bg); border: 1px dashed var(--border);
    border-radius: var(--radius); padding: 48px 20px; text-align: center; color: var(--text-muted);
}
.empty-icon { font-size: 36px; margin-bottom: 10px; }
.empty-sub { margin-top: 10px; font-size: 13px; }
.code {
    background: #f3f4f6; padding: 2px 8px; border-radius: 5px; font-family: Consolas, monospace;
    color: var(--primary); font-size: 13px;
}

/* ---------------- 填答页 ---------------- */
.take-wrap { max-width: 760px; margin: 0 auto; }
.take-card {
    background: var(--card-bg); border-radius: 12px; overflow: hidden;
    box-shadow: var(--shadow); border: 1px solid var(--border);
}
.take-bar { height: 5px; background: linear-gradient(90deg, #2563eb, #3b82f6); }
.take-head { padding: 26px 30px 18px; border-bottom: 1px solid var(--border); }
.take-title { font-size: 22px; font-weight: 700; }
.take-desc { margin-top: 8px; color: var(--text-muted); font-size: 14px; }
.take-tip { margin-top: 10px; font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.take-count {
    display: inline-flex; align-items: center;
    background: var(--primary-bg); color: var(--primary);
    padding: 2px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
}

.progress-bar { height: 3px; background: #eef0f3; }
.progress-fill { height: 100%; background: var(--primary); width: 0; transition: width .3s ease; }

#surveyForm { padding: 6px 30px 28px; }

.question-block { padding: 20px 0; border-bottom: 1px solid var(--border); }
.question-block:last-of-type { border-bottom: none; }
.question-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.q-no {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff; font-size: 12px; font-weight: 600; flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(37, 99, 235, .25);
}
.q-type {
    font-size: 11px; color: var(--primary); background: var(--primary-bg);
    padding: 1px 8px; border-radius: 999px; font-weight: 500;
}
.question-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.required { color: var(--red); margin-left: 2px; }

.options { display: flex; flex-direction: column; gap: 9px; }
.option {
    display: flex; align-items: center; gap: 10px; cursor: pointer;
    padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
    transition: border-color .15s, background-color .15s; user-select: none;
}
.option:hover { border-color: #cbd5e1; background: #fafafa; }
.option input { display: none; }
.option-mark {
    width: 18px; height: 18px; border-radius: 50%; border: 2px solid #cbd5e1;
    flex-shrink: 0; position: relative; transition: border-color .15s, background-color .15s;
}
.option-mark.check { border-radius: 5px; }
.option input:checked + .option-mark { border-color: var(--primary); background: var(--primary); }
.option input:checked + .option-mark::after {
    content: ''; position: absolute; inset: 4px; border-radius: 50%;
    background: #fff;
}
.option input:checked + .option-mark.check::after {
    inset: 0; border-radius: 2px;
    background: transparent;
    border: 2px solid #fff; border-top: none; border-right: none;
    width: 8px; height: 4px; margin: auto; transform: rotate(-45deg);
}
.option:has(input:checked) { border-color: var(--primary); background: var(--primary-bg); }
.option-text { font-size: 14px; }

.textarea {
    width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px;
    font-family: inherit; font-size: 14.5px; resize: vertical; background: #fff; color: var(--text);
    transition: border-color .15s, box-shadow .15s; line-height: 1.6;
}
.textarea:focus, .input:focus, .select:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

/* 评分星 */
.rate-wrap { display: flex; align-items: center; gap: 4px; flex-direction: row-reverse; justify-content: flex-end; }
.rate-input { display: none; }
.rate-star {
    font-size: 32px; color: #d1d5db; cursor: pointer; transition: color .15s;
}
.rate-star:hover, .rate-star:hover ~ .rate-star { color: var(--amber); }
.rate-input:checked ~ .rate-star { color: var(--amber); }
.rate-hint { margin-left: 14px; font-size: 13px; color: var(--text-muted); }

.field-error { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 8px; }
.field-error.show { font-weight: 600; }
.question-block.has-error { animation: shake .3s; }
.question-block.has-error .question-title { color: var(--red); }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.take-foot { padding: 16px 0 6px; text-align: center; }

/* ---------------- 提交成功页 ---------------- */
.thanks-card {
    max-width: 520px; margin: 56px auto; background: var(--card-bg);
    border-radius: 12px; padding: 44px 34px; text-align: center;
    box-shadow: var(--shadow); border: 1px solid var(--border);
}
.thanks-icon {
    width: 72px; height: 72px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 34px; font-weight: 800;
    margin: 0 auto;
}
.thanks-icon.success { background: var(--green-bg); color: var(--green); }
.thanks-icon.warning { background: #fffbeb; color: var(--amber); }
.thanks-title { font-size: 22px; font-weight: 700; margin: 18px 0 10px; }
.thanks-sub { color: var(--text-muted); margin-bottom: 24px; }
.thanks-actions { display: flex; justify-content: center; }

/* ---------------- 页脚 ---------------- */
.site-footer {
    text-align: center; padding: 20px 0; color: var(--text-muted);
    font-size: 13px; border-top: 1px solid var(--border); background: #fff;
}

/* ==========================================================
   后台样式
   ========================================================== */
.admin-header {
    background: #fff; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
}
.admin-header-inner {
    max-width: 1200px; margin: 0 auto; padding: 0 24px; height: 56px;
    display: flex; align-items: center; justify-content: space-between;
}
.admin-main { max-width: 1200px; margin: 0 auto; padding: 26px 24px 72px; }

.admin-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-title { font-size: 20px; font-weight: 700; }

/* 卡片 */
.card {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 4px; }
.card-step {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px;
    background: var(--primary); color: #fff;
    border-radius: 50%;
    font-size: 12px; font-weight: 600;
    flex-shrink: 0;
}
.card-head-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.form-hint { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }

/* 表格 */
.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    text-align: left; padding: 11px 16px; background: #fafafa;
    font-weight: 500; color: var(--text-muted); font-size: 13px; border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td { padding: 11px 16px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafafa; }
.th-actions, .td-actions { text-align: right; }
.td-actions { white-space: nowrap; display: flex; gap: 6px; justify-content: flex-end; }
.td-title .link-title { color: var(--text); font-weight: 600; }
.td-title .link-title:hover { color: var(--primary); }
.td-muted { color: var(--text-muted); font-size: 13px; }

/* 表单 */
.form-row { margin-bottom: 15px; }
.form-row-inline { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.form-label { display: block; font-size: 13.5px; font-weight: 500; color: var(--text-muted); margin-bottom: 7px; }
.form-row-inline .form-label { margin-bottom: 0; }
.radio-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.input {
    width: 100%; padding: 9px 13px; border: 1px solid var(--border); border-radius: 8px;
    font-family: inherit; font-size: 14.5px; transition: border-color .15s, box-shadow .15s; background: #fff;
}
.select {
    padding: 9px 13px; border: 1px solid var(--border); border-radius: 8px;
    font-family: inherit; font-size: 14.5px; background: #fff; min-width: 180px;
}
.checkbox-label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; margin-bottom: 0; }
.form-actions { display: flex; gap: 12px; padding: 6px 0 20px; }

/* 题目编辑器 */
.question-editor {
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; margin-bottom: 16px; background: #fcfcfd;
}
.q-editor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.q-editor-no { font-weight: 600; font-size: 14px; }
.q-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.q-option-item { display: flex; gap: 8px; align-items: center; }
.q-option-item .input { flex: 1; }

/* 统计 */
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    text-align: center;
    box-shadow: var(--shadow);
}
.stat-card-num { font-size: 30px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.stat-card-label { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

.stats-question { padding: 20px 24px; }
.stats-q-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.stats-q-title { font-size: 15.5px; font-weight: 600; margin-bottom: 16px; }

.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-label {
    width: 180px; font-size: 13px; color: var(--text); flex-shrink: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-track {
    flex: 1; height: 24px; background: #f3f4f6; border-radius: 5px; overflow: hidden;
}
.bar-fill {
    height: 100%; background: var(--primary); border-radius: 5px;
    display: flex; align-items: center; justify-content: flex-end; padding-right: 8px;
    min-width: 2px; transition: width .4s ease;
}
.bar-fill-rate { background: var(--amber); }
.bar-num { color: #fff; font-size: 12px; font-weight: 500; white-space: nowrap; }

.rate-result { display: flex; gap: 40px; align-items: flex-start; flex-wrap: wrap; }
.rate-result .bar-list { flex: 1; min-width: 260px; }
.rate-avg { text-align: center; padding-top: 6px; }
.rate-avg-num { font-size: 42px; font-weight: 700; color: var(--amber); display: block; }
.rate-avg-stars { font-size: 18px; color: var(--amber); letter-spacing: 2px; }
.stars-dim { color: #d1d5db; }
.rate-avg-label { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

.text-answers { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.text-answer-item {
    background: #fafafa; border: 1px solid var(--border); border-radius: 8px;
    padding: 10px 14px; font-size: 14px;
}

/* 提示信息 */
.toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-20px);
    background: #111827; color: #fff; padding: 10px 20px; border-radius: 8px;
    font-size: 14px; opacity: 0; pointer-events: none; transition: all .3s; z-index: 999;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: #059669; }
.toast.error { background: #dc2626; }

/* ---------------- 认证页（分屏式） ---------------- */
.auth-body {
    min-height: 100vh;
    display: flex;
    margin: 0;
}

/* 左侧品牌区 */
.auth-side {
    flex: 1.1;
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 60%, #3b82f6 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
}
.auth-side::before, .auth-side::after {
    content: ''; position: absolute; border-radius: 50%;
    background: rgba(255, 255, 255, .06);
}
.auth-side::before { width: 360px; height: 360px; top: -100px; right: -80px; }
.auth-side::after  { width: 280px; height: 280px; bottom: -80px; left: -60px; }
.auth-side-inner { max-width: 420px; position: relative; z-index: 1; }

.auth-logo {
    display: inline-flex; align-items: center; gap: 10px;
    font-size: 18px; font-weight: 600;
    margin-bottom: 40px;
}
.auth-logo-mark {
    width: 38px; height: 38px;
    background: rgba(255, 255, 255, .18);
    border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 19px; font-weight: 700;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.auth-side-title { font-size: 38px; font-weight: 800; line-height: 1.3; margin-bottom: 16px; letter-spacing: .5px; }
.auth-side-desc { font-size: 15px; opacity: .85; line-height: 1.7; margin-bottom: 36px; }

.auth-features {
    list-style: none;
    display: flex; flex-direction: column; gap: 16px;
    font-size: 14px;
}
.auth-features li {
    display: flex; align-items: center; gap: 12px;
    opacity: .92;
}
.auth-features-icon {
    width: 22px; height: 22px;
    background: rgba(255, 255, 255, .2);
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    flex-shrink: 0;
}

/* 右侧表单区 */
.auth-main {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 40px;
    background: #fff;
    overflow-y: auto;
}
.auth-wrap { width: 100%; max-width: 360px; }

.auth-title {
    font-size: 26px; font-weight: 700;
    color: var(--text);
    letter-spacing: .3px;
}
.auth-sub {
    color: var(--text-muted);
    font-size: 14px;
    margin: 8px 0 30px;
}

.btn-block {
    width: 100%; padding: 12px;
    font-size: 15px;
    margin-top: 8px;
    border-radius: 10px;
}
.auth-switch { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-muted); }
.auth-foot { text-align: center; margin-top: 20px; font-size: 13px; }
.auth-foot a { color: var(--text-muted); }
.auth-foot a:hover { color: var(--primary); }

/* 表单元素在认证页里更精致 */
.auth-main .form-row { margin-bottom: 18px; }
.auth-main .form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 8px;
}
.auth-main .input {
    width: 100%; padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit; font-size: 14.5px;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.auth-main .input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.auth-main .input::placeholder { color: #9ca3af; }

/* ---------------- 后台导航用户区 ---------------- */
.nav-user { display: flex; align-items: center; gap: 8px; margin-left: 6px; }
.nav-user-name { font-size: 13px; color: var(--text); font-weight: 500; }
.logout-form { display: inline; margin: 0; }

/* 响应式 */
@media (max-width: 860px) {
    .auth-body { flex-direction: column; }
    .auth-side { padding: 40px 28px 32px; flex: none; }
    .auth-side::before, .auth-side::after { display: none; }
    .auth-logo { margin-bottom: 24px; }
    .auth-side-title { font-size: 26px; margin-bottom: 12px; }
    .auth-side-desc { display: none; }
    .auth-features { gap: 10px; font-size: 13px; }
    .auth-features li:nth-child(n+3) { display: none; }
    .auth-main { padding: 32px 24px; }
}

@media (max-width: 720px) {
    .survey-grid { grid-template-columns: 1fr; }
    .bar-label { width: 110px; }
    .take-head { padding: 22px 20px 16px; }
    #surveyForm { padding: 2px 18px 20px; }
    .rate-result { flex-direction: column; }
    .td-actions { flex-wrap: wrap; }
    .admin-main { padding: 18px 14px 56px; }
    .nav { gap: 14px; }
    .stat-cards { grid-template-columns: 1fr; gap: 10px; }
    .hero { padding: 30px 24px; }
    .hero-title { font-size: 24px; }
}
