/**
 * 会员中心移动端统一样式系统
 * 版本: v2.0.0
 * 更新: 2025-11-06
 */

/* ==================== 基础样式 ==================== */
:root {
    /* 主题色 */
    --primary-color: #667eea;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-color: #764ba2;

    /* 功能色 */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;

    /* 中性色 */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --border-color: #e5e7eb;
    --bg-gray: #f3f4f6;
    --bg-white: #ffffff;

    /* 尺寸 */
    --container-max-width: 500px;
    --header-height: 56px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    /* 阴影 */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);

    /* 动画 */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-gray);
    overflow-x: hidden;
}

/* ==================== 容器布局 ==================== */
.mobile-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-white);
    position: relative;
    display: flex;
    flex-direction: column;
}

.mobile-page {
    flex: 1;
    background: var(--bg-gray);
    padding-bottom: 16px;
}

/* ==================== 顶部导航栏 ==================== */
.mobile-header {
    height: var(--header-height);
    background: var(--bg-white);
    display: flex;
    align-items: center;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.mobile-header-back {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.mobile-header-back:active {
    transform: scale(0.9);
    background: var(--border-color);
}

.mobile-header-title {
    flex: 1;
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    margin: 0 12px;
    color: var(--text-primary);
}

.mobile-header-action {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    transition: var(--transition);
}

.mobile-header-action:active {
    color: var(--primary-color);
}

/* ==================== 渐变头部 ==================== */
.gradient-header {
    background: var(--primary-gradient);
    color: white;
    padding: 24px 16px 80px;
    position: relative;
}

.gradient-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
    background: rgba(255, 255, 255, 0.2);
}

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

.user-level {
    display: inline-block;
    padding: 2px 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 12px;
    backdrop-filter: blur(10px);
}

/* ==================== 卡片组件 ==================== */
.card {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 16px;
    margin: 12px 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.card-elevated {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

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

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-extra {
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.card-body {
    padding: 0;
}

.card-elevated {
    margin-top: -50px;
    position: relative;
    z-index: 10;
    box-shadow: var(--shadow-lg);
}

/* ==================== 列表项 ==================== */
.list-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
}

.list-item:first-child {
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}

.list-item:last-child {
    border-bottom: none;
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

.list-item:active {
    background: var(--bg-gray);
}

.list-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 20px;
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-item-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-item-arrow {
    color: var(--text-tertiary);
    font-size: 18px;
    margin-left: 8px;
}

/* ==================== 按钮组件 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

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

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

.btn-text {
    background: transparent;
    color: var(--primary-color);
    padding: 8px 16px;
}

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

.btn-block {
    width: 100%;
}

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

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

/* ==================== 徽章标签 ==================== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.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: #f3f4f6;
    color: #374151;
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 64px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
}

.empty-state-desc {
    font-size: 13px;
    color: var(--text-tertiary);
    margin: 0;
}

/* ==================== 加载状态 ==================== */
.loading-state {
    text-align: center;
    padding: 40px 20px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

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

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

/* ==================== Toast提示 ==================== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 16px 24px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    z-index: 9999;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ==================== 网格布局 ==================== */
.grid {
    display: grid;
    gap: 12px;
    padding: 0 16px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ==================== 统计数据 ==================== */
.stats-grid {
    display: flex;
    gap: 16px;
    padding: 16px;
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.stat-item:active {
    transform: translateY(-1px);
    background: #f9fafb;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #667eea;
    line-height: 1.2;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

/* ==================== 分隔线 ==================== */
.divider {
    height: 1px;
    background: var(--border-color);
    margin: 16px 0;
}

.divider-thick {
    height: 8px;
    background: var(--bg-gray);
    margin: 0;
}

/* ==================== 工具类 ==================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-secondary { color: var(--text-secondary); }
.text-gray { color: var(--text-tertiary); }

.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.fw-medium { font-weight: 500; }

.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.p-0 { padding: 0; }
.p-8 { padding: 8px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-1 { flex: 1; }

.rounded { border-radius: var(--border-radius); }
.rounded-full { border-radius: 9999px; }

.cursor-pointer { cursor: pointer; }

/* ==================== 响应式 ==================== */
@media (max-width: 360px) {
    :root {
        --container-max-width: 100%;
    }

    .card {
        margin: 8px 12px;
        padding: 12px;
    }

    .mobile-header {
        padding: 0 12px;
    }
}
