/* ====================================
   悬赏平台移动端统一CSS框架
   基于 375px iPhone 基准，适配所有手机
   ==================================== */

/* --- 基础重置 --- */
*, *::before, *::after {
    margin: 0; padding: 0;
    box-sizing: border-box;
}
html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    font-size: 16px;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #f5f7fa;
    color: #2d3748;
    line-height: 1.5;
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- 颜色变量 --- */
:root {
    --primary: #e63946;
    --primary-dark: #c1121f;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --gray: #718096;
    --light: #f8fafc;
    --border: #e5e7eb;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
}

/* --- 安全区适配（刘海屏） --- */
.safe-top { padding-top: env(safe-area-inset-top); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }

/* --- 顶部导航栏 --- */
.app-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    height: 50px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px;
}
.app-header .back-btn {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(230,57,70,0.08);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary); font-size: 16px; text-decoration: none;
}
.app-header .title {
    font-size: 17px; font-weight: 600; color: #1e293b;
    position: absolute; left: 50%; transform: translateX(-50%);
}

/* --- 底部导航栏 --- */
.app-tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(0,0,0,0.06);
    display: flex;
    padding: 4px 0 calc(4px + env(safe-area-inset-bottom));
}
.app-tabbar .tab-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    padding: 4px 0; font-size: 10px; color: var(--gray);
    text-decoration: none; transition: color 0.2s;
}
.app-tabbar .tab-item.active { color: var(--primary); }
.app-tabbar .tab-item i { font-size: 20px; margin-bottom: 2px; }

/* --- 卡片 --- */
.card {
    background: #fff; border-radius: var(--radius-lg);
    padding: 16px; margin: 12px 16px;
    box-shadow: var(--shadow);
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.card-title { font-size: 16px; font-weight: 600; color: #1e293b; }

/* --- 按钮 --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 20px; border-radius: var(--radius);
    font-size: 14px; font-weight: 600; border: none;
    cursor: pointer; transition: all 0.2s;
    text-decoration: none; gap: 6px;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }
.btn-primary:active { transform: scale(0.97); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 2px solid var(--primary); }
.btn-block { width: 100%; padding: 12px; font-size: 16px; }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: var(--radius-sm); }

/* --- 表单 --- */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.form-label .required { color: var(--primary); }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px; background: #fafafa;
    transition: border 0.2s, box-shadow 0.2s;
    outline: none; color: #1e293b;
    -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230,57,70,0.1);
    background: #fff;
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-input.error { border-color: var(--danger); background: #fef2f2; }
.form-hint { font-size: 11px; color: var(--gray); margin-top: 4px; }

/* --- 标签 --- */
.tag {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-size: 10px; font-weight: 600;
}
.tag-red { background: rgba(230,57,70,0.1); color: var(--primary); }
.tag-green { background: rgba(16,185,129,0.1); color: var(--success); }
.tag-blue { background: rgba(59,130,246,0.1); color: var(--info); }
.tag-orange { background: rgba(245,158,11,0.1); color: var(--warning); }

/* --- 状态徽章 --- */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #f1f5f9; color: #475569; }

/* --- 任务列表 --- */
.task-item {
    display: block; background: #fff; border-radius: var(--radius-lg);
    padding: 16px; margin-bottom: 12px;
    box-shadow: var(--shadow); text-decoration: none; color: inherit;
    transition: transform 0.15s;
}
.task-item:active { transform: scale(0.98); }
.task-item .task-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 10px;
}
.task-item .task-title { font-size: 15px; font-weight: 600; color: #1e293b; flex: 1; }
.task-item .task-price {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; padding: 4px 12px; border-radius: 20px;
    font-size: 14px; font-weight: 700; white-space: nowrap; margin-left: 8px;
}
.task-item .task-meta {
    display: flex; gap: 12px; font-size: 12px; color: var(--gray);
}

/* --- 用户信息区域 --- */
.user-hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; padding: 24px 16px 20px; text-align: center;
}
.user-hero .avatar {
    width: 72px; height: 72px; border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.4); object-fit: cover;
}
.user-hero .name { font-size: 18px; font-weight: 700; margin-top: 8px; }

/* --- 统计网格 --- */
.stats-row {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 10px; padding: 0 16px; margin: -16px 0 16px;
    position: relative; z-index: 1;
}
.stats-row.col-4 { grid-template-columns: repeat(4, 1fr); }
.stats-row.col-3 { grid-template-columns: repeat(3, 1fr); }
.stat-card {
    background: #fff; border-radius: var(--radius);
    padding: 14px 10px; text-align: center;
    box-shadow: var(--shadow);
}
.stat-card .num { font-size: 20px; font-weight: 700; color: var(--primary); }
.stat-card .lbl { font-size: 11px; color: var(--gray); margin-top: 2px; }

/* --- 菜单列表 --- */
.menu-list {
    background: #fff; border-radius: var(--radius-lg);
    margin: 0 16px 12px; overflow: hidden; box-shadow: var(--shadow);
}
.menu-item {
    display: flex; align-items: center; padding: 14px 16px;
    border-bottom: 1px solid #f5f5f5; text-decoration: none; color: inherit;
    transition: background 0.15s;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: #f8fafc; }
.menu-item .menu-icon {
    width: 38px; height: 38px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; margin-right: 12px;
}
.menu-item .menu-text { flex: 1; font-size: 14px; font-weight: 500; }
.menu-item .menu-arrow { color: #cbd5e1; font-size: 14px; }

/* --- 弹窗/Modal --- */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 5000; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-content {
    background: #fff; border-radius: var(--radius-lg);
    padding: 24px; width: 85%; max-width: 400px;
    box-shadow: var(--shadow-lg); animation: modalUp 0.25s ease;
}
@keyframes modalUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Toast 提示 --- */
.toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.8); color: #fff; padding: 10px 24px;
    border-radius: 20px; font-size: 14px; z-index: 6000;
    animation: toastIn 0.3s ease;
    pointer-events: none;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* --- 间距工具 --- */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.text-center { text-align: center; }
.text-red { color: var(--primary); }
.text-green { color: var(--success); }
.text-blue { color: var(--info); }
.text-gray { color: var(--gray); }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* --- 表格容器（防溢出） --- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }
table { width: 100%; border-collapse: collapse; min-width: 300px; }
th, td { padding: 10px 12px; font-size: 13px; white-space: nowrap; }

/* --- 底部固定操作栏 --- */
.fixed-bottom {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 999;
    background: rgba(255,255,255,0.95); backdrop-filter: blur(10px);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1); display: flex; gap: 10px;
}
.fixed-bottom .btn { flex: 1; padding: 13px; font-size: 15px; min-height: 44px; }

/* --- 触摸优化 --- */
a, button, .btn, [onclick] { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
input, select, textarea, button { font-size: 16px; }
@media (max-width: 360px) {
    .stat-card .num { font-size: 17px; }
    .task-item .task-title { font-size: 14px; }
    .btn { padding: 8px 16px; font-size: 13px; }
    th, td { padding: 8px 10px; font-size: 12px; }
}
@media (min-width: 768px) {
    body { max-width: 500px; margin: 0 auto; }
    .app-tabbar { max-width: 500px; left: 50%; transform: translateX(-50%); }
    .app-header { max-width: 500px; left: 50%; transform: translateX(-50%); }
}
