/* ============================================
   泰义堂培训系统 - 移动端样式
   ============================================ */

:root {
    --primary: #6d4c41;
    --primary-dark: #4e342e;
    --primary-light: #8d6e63;
    --accent: #ff8f00;
    --success: #4caf50;
    --danger: #f44336;
    --warning: #ff9800;
    --info: #2196f3;
    --bg: #faf7f2;
    --card-bg: #ffffff;
    --text: #333333;
    --text-light: #666666;
    --border: #e0d5c7;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --radius: 12px;
}

* {
    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;
    background: linear-gradient(135deg, #f5efe6 0%, #e8d5c4 100%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 12px;
    min-height: 100vh;
}

/* 头部样式 */
.app-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    padding: 24px 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(109, 76, 65, 0.3);
}

.header-content h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}

.header-subtitle {
    font-size: 14px;
    opacity: 0.9;
}

/* 主菜单网格 */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 8px;
}

.menu-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px 16px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    cursor: pointer;
    border: 2px solid transparent;
}

.menu-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    border-color: var(--primary-light);
}

.menu-card:active {
    transform: translateY(0);
}

.menu-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.menu-card h3 {
    font-size: 18px;
    color: var(--primary);
    margin-bottom: 6px;
}

.menu-card p {
    font-size: 13px;
    color: var(--text-light);
}

/* 通用卡片 */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

/* 区域切换 */
.section {
    animation: fadeIn 0.3s ease;
}

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

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px 0;
}

.section-header h2 {
    font-size: 20px;
    color: var(--primary);
}

.back-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 20px;
    color: var(--primary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.back-btn:hover {
    background: var(--primary);
    color: white;
}

/* 表单样式 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text);
    font-weight: 500;
    font-size: 14px;
}

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

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
    background: #fafafa;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(109, 76, 65, 0.1);
}

select.form-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* 按钮样式 */
.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(109, 76, 65, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(109, 76, 65, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    padding: 10px 20px;
    background: white;
    border: 2px solid var(--primary);
    color: var(--primary);
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* 徽章样式 */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-compliance { background: #e3f2fd; color: #1565c0; }
.badge-job_skill { background: #f3e5f5; color: #6a1b9a; }
.badge-disease_knowledge { background: #e8f5e9; color: #2e7d32; }
.badge-doctor_professional { background: #fff3e0; color: #e65100; }
.badge-communication { background: #e0f7fa; color: #00838f; }
.badge-emergency { background: #ffebee; color: #c62828; }
.badge-ethics { background: #f1f8e9; color: #558b2f; }
.badge-tcm_basic { background: #fce4ec; color: #880e4f; }
.badge-comprehensive { background: #e8eaf6; color: #283593; }
.badge-stage { background: #efebe9; color: #4e342e; }

/* 批次卡片 */
.batch-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.batch-card {
    background: #faf8f5;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.batch-card:hover {
    border-color: var(--primary);
    background: white;
}

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

.batch-header h4 {
    font-size: 16px;
    color: var(--primary);
}

.batch-info {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.batch-desc {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.5;
}

/* 知识卡片 */
.knowledge-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.knowledge-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid var(--primary-light);
}

.knowledge-card:hover {
    transform: translateX(4px);
}

.knowledge-tag {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.knowledge-card h4 {
    font-size: 16px;
    color: var(--primary);
    margin-bottom: 6px;
}

.knowledge-preview {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.5;
}

/* 弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 440px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    color: var(--primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f5f5f5;
    color: var(--text);
}

.modal-body {
    padding: 20px;
    line-height: 1.8;
    font-size: 15px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* 考试界面 */
.exam-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.exam-timer {
    font-size: 18px;
    font-weight: 600;
    color: var(--warning);
    margin: 8px 0;
}

.exam-progress {
    font-size: 14px;
    color: var(--text-light);
}

.question-card {
    background: #faf8f5;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    border-left: 4px solid var(--primary);
}

.question-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.question-text {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 16px;
    color: var(--text);
}

.option-item {
    display: block;
    padding: 12px 16px;
    margin: 8px 0;
    background: white;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
}

.option-item:hover {
    border-color: var(--primary-light);
    background: #faf7f2;
}

.option-item.selected {
    border-color: var(--primary);
    background: #f3e5f5;
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
    margin-right: 10px;
}

.exam-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
}

/* 签名区域 */
.signature-section {
    text-align: center;
}

.signature-section h3 {
    font-size: 20px;
    color: var(--primary);
    margin-bottom: 8px;
}

.signature-pad {
    margin: 16px 0;
}

.signature-canvas {
    border: 2px dashed var(--primary-light);
    border-radius: var(--radius);
    width: 100%;
    height: 150px;
    background: white;
    touch-action: none;
}

.signature-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.signature-actions button {
    flex: 1;
}

/* 结果展示 */
.result-header {
    text-align: center;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: var(--radius);
}

.result-passed {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    color: #2e7d32;
}

.result-failed {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    color: #c62828;
}

.result-score {
    font-size: 48px;
    font-weight: 700;
    margin: 12px 0;
}

/* 搜索框 */
.search-box {
    display: flex;
    gap: 8px;
}

.search-box input {
    flex: 1;
}

.search-box button {
    width: auto;
    padding: 12px 24px;
}

/* 记录列表 */
.record-item {
    background: #faf8f5;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid var(--primary);
}

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

.record-score {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

/* 响应式调整 */
@media (max-width: 360px) {
    .menu-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .menu-card {
        padding: 16px 12px;
    }
    
    .menu-icon {
        font-size: 28px;
    }
    
    .menu-card h3 {
        font-size: 16px;
    }
}

@media (min-width: 481px) {
    .app-container {
        padding: 20px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Toast提示 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    z-index: 9999;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { transform: translateX(-50%) translateY(-100%); }
    to { transform: translateX(-50%) translateY(0); }
}