/* ===== FitSpark 品牌样式 ===== */
/* 品牌色板 */
:root {
    --primary: #ea580c;
    --primary-dark: #c2410c;
    --primary-light: #fb923c;
    --secondary: #1e293b;
    --secondary-light: #334155;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    background: #f1f5f9;
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

.app-container {
    max-width: 450px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    position: relative;
    padding-bottom: 70px;
}

.status-bar {
    height: 44px;
    background: var(--secondary);
}

/* ===== 通用组件 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    min-height: 44px;
    min-width: 44px;
    text-decoration: none;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 15px rgba(234, 88, 12, 0.35);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(234, 88, 12, 0.45);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: rgba(234, 88, 12, 0.08);
}

.btn-block {
    width: 100%;
}

.btn.small {
    padding: 8px 16px;
    font-size: 13px;
    min-height: 36px;
}

/* 卡片 */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

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

/* 页面标题 */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s;
}

.back-btn:active {
    background: var(--border);
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.add-btn:active {
    transform: scale(0.9);
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: var(--font);
    background: var(--card-bg);
    color: var(--text);
    transition: border-color 0.2s;
    appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.1);
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .half {
    flex: 1;
}

/* 弹窗 */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

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

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 24px 20px 32px;
    width: 100%;
    max-width: 450px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-actions .btn {
    flex: 1;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ===== 首页 Hero ===== */
.hero-section {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 40px 24px 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg);
    border-radius: 50% 50% 0 0;
}

.hero-logo {
    width: 140px;
    height: auto;
    margin-bottom: 16px;
}

.hero-tagline {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.hero-subtitle {
    font-size: 15px;
    color: rgba(255,255,255,0.85);
    margin-bottom: 24px;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-actions .btn {
    min-width: 130px;
}

.hero-actions .btn-outline {
    border-color: #fff;
    color: #fff;
}

.hero-actions .btn-outline:hover {
    background: rgba(255,255,255,0.15);
}

/* ===== 仪表盘卡片 ===== */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 0 16px;
    margin-top: -20px;
    position: relative;
    z-index: 2;
}

.dashboard-cards .card {
    text-align: center;
    padding: 16px 10px;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
}

.steps-icon {
    background: rgba(234, 88, 12, 0.12);
    color: var(--primary);
}

.calorie-icon {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

.time-icon {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}

.card-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

.card-label {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

/* ===== 分区通用 ===== */
.section {
    padding: 20px 16px;
}

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

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.section-more {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.section-more:active {
    opacity: 0.7;
}

/* ===== 训练列表 ===== */
.training-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.training-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.training-card:active {
    transform: scale(0.98);
}

.training-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 24px;
}

.training-icon.strength {
    background: rgba(234, 88, 12, 0.12);
    color: var(--primary);
}

.training-icon.cardio {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

.training-icon.yoga {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}

.training-icon.hiit {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
}

.training-info {
    flex: 1;
}

.training-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.training-meta {
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    gap: 12px;
}

.training-level {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.level-beginner {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}

.level-intermediate {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
}

.level-advanced {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

.training-action {
    color: var(--text-light);
    flex-shrink: 0;
}

/* ===== 记录列表 ===== */
.records-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.record-item {
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
}

.record-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.record-info {
    flex: 1;
}

.record-name {
    font-size: 15px;
    font-weight: 600;
}

.record-detail {
    font-size: 12px;
    color: var(--text-light);
}

.record-stats {
    text-align: right;
    flex-shrink: 0;
}

.record-calories {
    font-size: 14px;
    font-weight: 700;
    color: var(--danger);
}

.record-duration {
    font-size: 11px;
    color: var(--text-light);
}

/* ===== 图表 ===== */
.chart-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chart-container canvas {
    width: 100% !important;
    height: auto !important;
    max-height: 180px;
}

/* ===== 筛选标签 ===== */
.filter-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    padding: 8px 18px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 36px;
}

.filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.filter-btn:active {
    transform: scale(0.95);
}

/* ===== 个人中心 ===== */
.profile-header {
    text-align: center;
    padding: 30px 16px 20px;
    background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
    color: #fff;
}

.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 12px;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255,255,255,0.3);
    overflow: hidden;
}

.avatar img {
    width: 60%;
    height: 60%;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.profile-name {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-level {
    font-size: 13px;
    opacity: 0.85;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 16px;
}

.stat-item {
    background: var(--card-bg);
    padding: 16px 8px;
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
}

.stat-label {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

.profile-menu {
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--border);
    border-radius: var(--radius);
    margin: 0 16px 16px;
    overflow: hidden;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--card-bg);
    text-decoration: none;
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    transition: background 0.2s;
}

.menu-item:active {
    background: #f8fafc;
}

.menu-item span {
    flex: 1;
}

/* ===== 关于页 ===== */
.about-hero {
    text-align: center;
    padding: 32px 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}

.about-logo {
    width: 160px;
    height: auto;
    margin-bottom: 12px;
}

.about-slogan {
    font-size: 20px;
    font-weight: 700;
    opacity: 0.9;
}

.about-section {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
}

.about-section h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
}

.about-section p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 8px;
}

.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-dot {
    position: absolute;
    left: -18px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg);
}

.timeline-content h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2px;
}

.timeline-content p {
    font-size: 13px;
    color: var(--text-secondary);
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.team-card {
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 16px 12px;
    text-align: center;
    box-shadow: var(--shadow);
}

.team-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    margin: 0 auto 8px;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.team-avatar img {
    width: 50%;
    height: 50%;
    object-fit: contain;
    opacity: 0.5;
}

.team-card h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
}

.team-card p {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 4px;
}

.team-card span {
    font-size: 11px;
    color: var(--text-light);
    display: block;
}

/* ===== 页脚 ===== */
.app-footer {
    padding: 24px 16px;
    text-align: center;
    background: var(--secondary);
    color: #fff;
    margin-top: 16px;
}

.footer-logo {
    width: 120px;
    height: auto;
    margin-bottom: 12px;
    filter: brightness(0) invert(1);
}

.footer-desc {
    font-size: 13px;
    opacity: 0.7;
    margin-bottom: 16px;
    line-height: 1.6;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 16px;
}

.footer-links a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #fff;
}

.footer-copy {
    font-size: 12px;
    opacity: 0.5;
}

/* ===== 底部导航 ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 450px;
    margin: 0 auto;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 6px 0;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    z-index: 50;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    text-decoration: none;
    color: var(--text-light);
    font-size: 10px;
    font-weight: 600;
    transition: color 0.2s;
    min-width: 60px;
}

.nav-item svg {
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active svg {
    stroke: var(--primary);
}

.nav-item span {
    margin-top: 1px;
}

/* ===== 后台管理 ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.login-box {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px 24px;
    width: 100%;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    width: 140px;
    height: auto;
    margin: 0 auto 16px;
    display: block;
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
    color: var(--text);
}

.error-msg {
    color: var(--danger);
    font-size: 13px;
    text-align: center;
    margin-top: 12px;
    min-height: 20px;
}

.admin-panel {
    min-height: 100vh;
    padding-bottom: 70px;
}

.admin-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 16px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 56px;
    z-index: 9;
}

.admin-tab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.admin-tab-content {
    display: none;
    padding: 16px;
}

.admin-tab-content.active {
    display: block;
}

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

.admin-section-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-row {
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-row-info {
    flex: 1;
}

.admin-row-info .title {
    font-size: 14px;
    font-weight: 600;
}

.admin-row-info .sub {
    font-size: 12px;
    color: var(--text-light);
}

.admin-row-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.admin-row-actions button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
}

.admin-row-actions .edit-btn {
    color: var(--primary);
}

.admin-row-actions .edit-btn:active {
    background: rgba(234, 88, 12, 0.1);
}

.admin-row-actions .delete-btn {
    color: var(--danger);
}

.admin-row-actions .delete-btn:active {
    background: rgba(239, 68, 68, 0.1);
}

/* 开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    transition: 0.3s;
}

.slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.switch input:checked + .slider {
    background: var(--primary);
}

.switch input:checked + .slider::before {
    transform: translateX(20px);
}

/* ===== 响应式 ===== */
@media (min-width: 768px) {
    .app-container {
        max-width: 450px;
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
    }

    .bottom-nav {
        max-width: 450px;
    }
}

@media (max-width: 374px) {
    .dashboard-cards {
        gap: 8px;
    }

    .dashboard-cards .card {
        padding: 12px 6px;
    }

    .card-value {
        font-size: 22px;
    }

    .hero-tagline {
        font-size: 24px;
    }

    .team-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== 打印样式 ===== */
@media print {
    .bottom-nav,
    .status-bar {
        display: none;
    }
    .app-container {
        padding-bottom: 0;
    }
}