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

body {
    font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    background-color: #fff;
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* 头部样式 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background-color: #e74c3c;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.back-btn, .user-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.back-btn:hover, .user-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
}

.header-right {
    width: 40px;
}

/* 页面容器 */
.page-container {
    min-height: calc(100vh - 60px);
}

/* 页面样式 */
.page {
    display: none;
    min-height: 100%;
    padding: 16px;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

/* 区块样式 */
.section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
    text-align: center;
}

/* 英雄区域 */
.hero-section {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
    padding: 40px 20px;
    text-align: center;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.hero-content h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
}

.hero-content p {
    font-size: 16px;
    margin-bottom: 8px;
}

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

/* 进度条区域 */
.progress-section {
    background-color: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.progress-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
}

.progress-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.progress-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.progress-header span:first-child {
    color: #666;
}

.progress-header span:last-child {
    font-weight: 600;
    color: #333;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background-color: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease-in-out;
}

.progress-fill.weight {
    background: linear-gradient(90deg, #3498db 0%, #2980b9 100%);
}

.progress-fill.steps {
    background: linear-gradient(90deg, #27ae60 0%, #229954 100%);
}

/* 活动目标区域 */
.goals-section {
    background-color: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.goals-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
}

.goal-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.goal-card {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-left: 4px solid #e74c3c;
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.goal-card.weight-goal {
    border-left-color: #3498db;
}

.goal-card.steps-goal {
    border-left-color: #27ae60;
}

.goal-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
}

.goal-card.weight-goal .goal-icon {
    background-color: #3498db;
}

.goal-card.steps-goal .goal-icon {
    background-color: #27ae60;
}

.goal-card h4 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.goal-card p {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* 激励机制区域 */
.incentive-section {
    background-color: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.incentive-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
}

.incentive-card {
    background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
    color: #333;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.incentive-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #f39c12;
    flex-shrink: 0;
}

.incentive-content h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.incentive-content p {
    font-size: 14px;
    line-height: 1.5;
}

/* 个人数据区域 */
.personal-data-section {
    background-color: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.personal-data-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
}

.personal-stats {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.personal-stat {
    flex: 1;
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.personal-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background-color: #f0f0f0;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.btn {
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn.primary {
    background-color: #e74c3c;
    color: #fff;
}

.btn.primary:hover {
    background-color: #c0392b;
}

.btn.secondary {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #e0e0e0;
}

.btn.secondary:hover {
    background-color: #e0e0e0;
}

.btn:active {
    transform: scale(0.98);
}

/* 表单卡片 */
.form-card {
    background-color: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.form-group input {
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #e74c3c;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.1);
}

.form-group input::placeholder {
    color: #999;
}

.form-group.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.form-group.checkbox input {
    width: 16px;
    height: 16px;
}

.form-group.checkbox label {
    font-size: 14px;
    color: #666;
    cursor: pointer;
}

.submit-btn {
    margin-top: 8px;
}

/* 承诺书区域 */
.commitment-section {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

.commitment-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
}

.commitment-content {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 12px;
}

.commitment-content ul {
    list-style-type: disc;
    margin-left: 20px;
    margin-top: 8px;
}

.commitment-content li {
    margin-bottom: 4px;
}

/* 数据上报卡片 */
.report-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.report-card {
    background-color: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.report-hint {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
}

.steps-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    margin: 12px 0;
}

.steps-today, .steps-week, .steps-total {
    flex: 1;
    min-width: 100px;
    text-align: center;
    margin-bottom: 12px;
}

.steps-info .label {
    font-size: 12px;
    color: #666;
    display: block;
    margin-bottom: 4px;
}

.steps-info .value {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* 个人中心 */
.user-info {
    display: flex;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
    border-radius: 12px;
    margin-bottom: 20px;
}

.avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 16px;
}

.user-details h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.user-details p {
    font-size: 14px;
    opacity: 0.8;
}

/* 个人数据统计 */
.stats-section {
    background-color: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.stats-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
}

.stats-cards {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.stat-card {
    flex: 1;
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
}

.stat-icon.weight {
    background-color: #3498db;
}

.stat-icon.steps {
    background-color: #27ae60;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.stat-label {
    font-size: 12px;
    color: #666;
    text-align: center;
}

/* 菜单区域 */
.menu-section {
    background-color: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.menu-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
}

.menu-list {
    list-style: none;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.3s;
}

.menu-item:hover {
    background-color: #f9f9f9;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item i:first-child {
    font-size: 18px;
    color: #e74c3c;
    margin-right: 12px;
    width: 20px;
}

.menu-item span {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.menu-item i:last-child {
    font-size: 14px;
    color: #999;
}

/* 电子证书 */
.certificate-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.certificate {
    background-color: #fff;
    border: 2px solid #f1c40f;
    border-radius: 12px;
    padding: 32px 20px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
}

.certificate::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    border: 1px solid #f1c40f;
    border-radius: 8px;
    pointer-events: none;
}

.certificate-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #e74c3c;
    margin-bottom: 8px;
}

.certificate-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 24px;
}

.certificate-content {
    margin-bottom: 24px;
    line-height: 1.6;
}

.certificate-content p {
    font-size: 14px;
    color: #333;
    margin-bottom: 12px;
}

.certificate-content .recipient {
    font-size: 18px;
    font-weight: 600;
    color: #e74c3c;
    margin: 16px 0;
}

.certificate-footer {
    display: flex;
    justify-content: flex-end;
}

.signature {
    text-align: right;
}

.signature p {
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

/* 历史记录页面 */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background-color: #fff;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.history-item .date {
    font-size: 14px;
    color: #666;
}

.history-item .value {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.history-item .weight-value.negative {
    color: #27ae60;
}

.history-item .weight-value.positive {
    color: #e74c3c;
}

/* 提示框 */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.toast.active {
    opacity: 1;
    visibility: visible;
    animation: fadeIn 0.3s ease-in-out;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .app-container {
        max-width: 100%;
    }
    
    .hero-section {
        padding: 32px 16px;
    }
    
    .hero-content h2 {
        font-size: 20px;
    }
    
    .stats-cards {
        flex-direction: column;
    }
    
    .stat-card {
        flex-direction: row;
        justify-content: space-between;
        padding: 12px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .stat-content {
        text-align: right;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* 加载动画 */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #e74c3c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}