/* 问卷系统样式 - 圣哲智办 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 统一使用绿色主题 - 与主系统保持一致 */
    --primary: #2e7d5a;
    --primary-light: #4caf7c;
    --primary-dark: #1b5e40;
    --success: #388e5c;
    --warning: #e6a23c;
    --danger: #e05555;
    /* 统一的灰度和背景风格 */
    --bg-main: #a8c4ad;
    --bg-card: #d4e4d7;
    --gray-50: #c8d9ce;
    --gray-100: #b8ccbe;
    --gray-200: #a3bba9;
    --gray-300: #8daa94;
    --gray-400: #6d8c74;
    --gray-500: #526b58;
    --gray-700: #3a4d3f;
    --gray-900: #1e2b22;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.08);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 25px -3px rgb(0 0 0 / 0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-main);
    min-height: 100vh;
    color: var(--gray-900);
    padding-bottom: 40px;
}

/* 顶部导航 */
.top-nav {
    background: var(--bg-card);
    padding: 12px 20px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-nav-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.top-nav .back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 0.95em;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.top-nav .back-btn:hover {
    background: var(--gray-50);
    color: var(--primary);
}

.top-nav .nav-title {
    font-weight: 600;
    color: var(--gray-900);
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部 */
.header {
    text-align: center;
    padding: 30px 20px;
    color: var(--gray-900);
}

.header h1 {
    font-size: 1.8em;
    margin-bottom: 8px;
    color: var(--primary-dark);
}

.header .subtitle {
    font-size: 0.95em;
    color: var(--gray-500);
}

.back-home {
    display: inline-block;
    margin-bottom: 16px;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.9em;
    transition: color 0.2s;
}

.back-home:hover {
    color: var(--primary);
}

/* 工具栏 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.type-filter {
    padding: 10px 16px;
    border: 2px solid var(--gray-100);
    border-radius: 10px;
    font-size: 15px;
    background: var(--bg-card);
    color: var(--gray-900);
    cursor: pointer;
    transition: all 0.2s;
}

.type-filter:hover {
    border-color: var(--primary);
}

.type-filter:focus {
    outline: none;
    border-color: var(--primary);
}

.type-tag {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8em;
    font-weight: 500;
    color: white;
    white-space: nowrap;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--gray-700);
    border: 2px solid var(--gray-100);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    background: var(--bg-card);
    color: var(--primary);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

/* 问卷列表 */
.survey-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.survey-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.1);
    transition: transform 0.3s ease;
}

.survey-card:hover {
    transform: translateY(-4px);
}

.survey-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.survey-title {
    font-size: 1.3em;
    color: var(--gray-900);
}

.survey-desc {
    color: var(--gray-500);
    margin-bottom: 16px;
    font-size: 0.95em;
}

.survey-meta {
    display: flex;
    gap: 20px;
    color: var(--gray-500);
    font-size: 0.9em;
    margin-bottom: 16px;
}

.survey-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 状态标签 */
.status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
}

.status-draft {
    background: #e9ecef;
    color: #666;
}

.status-published {
    background: #d4edda;
    color: var(--success);
}

.status-closed {
    background: #f8d7da;
    color: var(--danger);
}

/* 空状态 */
.empty {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border-radius: 16px;
}

.empty-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.empty p {
    color: var(--gray-500);
    font-size: 1.1em;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray-700);
    font-size: 1.1em;
}

/* 表单样式 */
.form-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--gray-900);
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-50);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* 问题编辑器 */
.question-list {
    margin-bottom: 24px;
}

.question-item {
    background: var(--gray-50);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    position: relative;
}

.question-item .question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.question-type {
    padding: 4px 10px;
    background: var(--primary);
    color: white;
    border-radius: 4px;
    font-size: 0.85em;
}

.question-title-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    margin-bottom: 12px;
}

.options-list {
    margin-top: 12px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.option-item input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.option-item .btn-remove {
    background: #dc3545;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
}

.add-option-btn {
    margin-top: 8px;
    padding: 6px 12px;
    background: #e9ecef;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.add-question-btns {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.add-question-btns .btn {
    padding: 10px 16px;
    font-size: 14px;
}

/* 填写页面 */
.fill-container {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 30px;
    margin-top: 20px;
}

.fill-question {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-50);
}

.fill-question:last-child {
    border-bottom: none;
}

.fill-question h3 {
    margin-bottom: 16px;
    color: var(--gray-900);
}

.fill-question .required {
    color: var(--danger);
}

.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-group label,
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.radio-group label:hover,
.checkbox-group label:hover {
    background: var(--gray-100);
}

.radio-group input,
.checkbox-group input {
    width: 18px;
    height: 18px;
}

.rating-group {
    display: flex;
    gap: 10px;
}

.rating-group label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 20px;
    background: var(--gray-50);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.rating-group label:hover {
    background: var(--primary);
    color: white;
}

.rating-group input {
    display: none;
}

.rating-group input:checked + span {
    background: var(--primary);
    color: white;
}

.rating-group label.selected {
    background: var(--primary);
    color: white;
}

.text-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--gray-50);
    border-radius: 8px;
    font-size: 15px;
    min-height: 80px;
    resize: vertical;
}

/* 统计页面 */
.stats-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.stats-total {
    font-size: 2em;
    color: var(--primary);
    font-weight: bold;
}

.question-stats {
    margin-top: 16px;
}

.bar-chart {
    margin-top: 12px;
}

.bar-item {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.bar-label {
    width: 150px;
    font-size: 14px;
    color: var(--gray-500);
}

.bar-container {
    flex: 1;
    height: 24px;
    background: var(--gray-50);
    border-radius: 12px;
    overflow: hidden;
    margin: 0 12px;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 12px;
    transition: width 0.5s ease;
}

.bar-value {
    width: 60px;
    text-align: right;
    font-size: 14px;
    color: var(--gray-900);
}

.text-answers {
    margin-top: 12px;
}

.text-answer-item {
    padding: 12px;
    background: var(--gray-50);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--gray-700);
}

/* 成功页面 */
.success-container {
    text-align: center;
    padding: 60px 20px;
}

.success-icon {
    font-size: 5em;
    margin-bottom: 20px;
}

.success-container h2 {
    color: var(--success);
    margin-bottom: 16px;
}

/* 响应式 - 平板 */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .header {
        padding: 20px 16px;
    }
    
    .header h1 {
        font-size: 1.5em;
    }
    
    .toolbar {
        flex-direction: column;
        gap: 12px;
    }
    
    .toolbar-left {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .toolbar .btn-primary {
        width: 100%;
        text-align: center;
    }
    
    .bar-label {
        width: 100px;
        font-size: 12px;
    }
    
    .bar-value {
        width: 50px;
        font-size: 12px;
    }
}

/* 响应式 - 手机 */
@media (max-width: 600px) {
    body {
        padding-bottom: 20px;
    }
    
    .container {
        padding: 12px;
    }
    
    .header {
        padding: 16px 12px;
    }
    
    .header h1 {
        font-size: 1.3em;
        line-height: 1.3;
    }
    
    .header .subtitle {
        font-size: 0.85em;
    }
    
    /* 顶部导航 */
    .top-nav {
        padding: 10px 12px;
    }
    
    .top-nav .back-btn {
        font-size: 0.85em;
        padding: 6px 10px;
    }
    
    .top-nav .nav-title {
        font-size: 0.9em;
    }
    
    /* 工具栏 */
    .toolbar {
        flex-direction: column;
        gap: 10px;
    }
    
    .toolbar-left {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }
    
    .toolbar-left .type-filter,
    .toolbar-left .btn {
        width: 100%;
    }
    
    .toolbar .btn-primary {
        width: 100%;
        text-align: center;
    }
    
    /* 问卷卡片 */
    .survey-card {
        padding: 16px;
        border-radius: 12px;
    }
    
    .survey-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .survey-title {
        font-size: 1.1em;
    }
    
    .survey-desc {
        font-size: 0.9em;
        margin-bottom: 12px;
    }
    
    .survey-meta {
        flex-direction: column;
        gap: 6px;
        font-size: 0.85em;
        margin-bottom: 12px;
    }
    
    .survey-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .survey-actions .btn {
        text-align: center;
        padding: 10px 8px;
        font-size: 13px;
    }
    
    /* 按钮 */
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .btn-sm {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    /* 表单 */
    .form-card {
        padding: 16px;
        border-radius: 12px;
    }
    
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-group label {
        font-size: 0.95em;
    }
    
    .form-group input[type="text"],
    .form-group textarea {
        padding: 10px 12px;
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    /* 问题编辑器 */
    .question-item {
        padding: 14px;
        border-radius: 10px;
    }
    
    .question-item .question-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .add-question-btns {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .add-question-btns .btn {
        width: 100%;
        padding: 10px 8px;
        font-size: 13px;
    }
    
    /* 填写页面 */
    .fill-container {
        padding: 16px;
        border-radius: 12px;
        margin-top: 12px;
    }
    
    .fill-question {
        margin-bottom: 20px;
        padding-bottom: 16px;
    }
    
    .fill-question h3 {
        font-size: 1em;
        line-height: 1.4;
    }
    
    /* 选项组 - 增大触摸区域 */
    .radio-group label,
    .checkbox-group label {
        padding: 14px 16px;
        font-size: 15px;
        border-radius: 10px;
    }
    
    .radio-group input,
    .checkbox-group input {
        width: 20px;
        height: 20px;
        min-width: 20px;
    }
    
    /* 评分组 - 移动端适配 */
    .rating-group {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .rating-group label {
        padding: 10px 14px;
        min-width: 50px;
        border-radius: 10px;
    }
    
    /* 文本输入 */
    .text-input {
        padding: 12px;
        font-size: 16px; /* 防止iOS缩放 */
        min-height: 100px;
    }
    
    /* 统计页面 */
    .stats-card {
        padding: 16px;
        border-radius: 12px;
    }
    
    .stats-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .stats-total {
        font-size: 1.5em;
    }
    
    /* 柱状图 - 移动端优化 */
    .bar-item {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        margin-bottom: 16px;
    }
    
    .bar-label {
        width: 100%;
        font-size: 13px;
        margin-bottom: 4px;
    }
    
    .bar-container {
        margin: 0;
        height: 20px;
    }
    
    .bar-value {
        width: 100%;
        text-align: left;
        font-size: 12px;
        color: var(--gray-500);
        margin-top: 2px;
    }
    
    /* 模态框 */
    .modal-overlay {
        padding: 16px;
    }
    
    .modal-box {
        padding: 20px;
        border-radius: 14px;
        max-width: 100%;
    }
    
    .modal-title {
        font-size: 1.1em;
    }
    
    .modal-content {
        font-size: 0.95em;
    }
    
    .modal-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-buttons .btn {
        width: 100%;
    }
    
    /* 空状态 */
    .empty {
        padding: 40px 16px;
    }
    
    .empty-icon {
        font-size: 3em;
    }
    
    .empty p {
        font-size: 0.95em;
    }
    
    /* 成功页面 */
    .success-container {
        padding: 40px 16px;
    }
    
    .success-icon {
        font-size: 4em;
    }
    
    /* 文字答案列表 */
    .text-answer-item {
        padding: 10px;
        font-size: 13px;
    }
}

/* 超小屏幕 (iPhone SE等) */
@media (max-width: 375px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.2em;
    }
    
    .survey-actions {
        grid-template-columns: 1fr;
    }
    
    .add-question-btns {
        grid-template-columns: 1fr;
    }
    
    .rating-group label {
        padding: 8px 10px;
        min-width: 44px;
    }
    
    .type-tag {
        font-size: 0.75em;
        padding: 3px 8px;
    }
}

/* ==================== 通用组件 ==================== */

/* 模态框 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-overlay.show {
    display: flex;
}

.modal-box {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-title {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 12px;
}

.modal-content {
    color: var(--gray-700);
    margin-bottom: 20px;
    line-height: 1.6;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Toast 提示 */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
}

.toast {
    background: var(--gray-900);
    color: white;
    padding: 12px 24px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    margin-bottom: 10px;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.warning {
    background: var(--warning);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 警告框 */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.95em;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
}

/* 加载动画 */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-100);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 卡片hover效果增强 */
.survey-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.survey-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

/* 表单卡片增强 */
.form-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow);
}

/* 问题项增强 */
.question-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-50);
}

/* 输入框聚焦效果 */
.form-group input[type="text"]:focus,
.form-group textarea:focus,
.question-title-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 选项交互优化 */
.radio-group label,
.checkbox-group label {
    border: 2px solid transparent;
}

.radio-group label:hover,
.checkbox-group label:hover {
    border-color: var(--primary-light);
    background: white;
}

.radio-group input:checked + span,
.checkbox-group input:checked + span {
    color: var(--primary);
    font-weight: 500;
}

