/* 公共样式 - 分销小程序 */

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; background: #f7f7f7; font-size: 14px; line-height: 1.6; color: #333; min-height: 100vh; }
:root { --primary: #07c160; --primary-dark: #06ad56; --blue: #576b95; --orange: #fa9d3b; --gold: #fa8c16; --red: #fa5151; --warn: #ff976a; --gray: #999; --gray-light: #ccc; --bg: #f7f7f7; --white: #fff; --border: #eee; }

/* 顶部导航 */
.mp-navbar { position: fixed; top: 0; left: 0; right: 0; height: 44px; background: #fff; display: flex; align-items: center; justify-content: center; z-index: 100; border-bottom: 1px solid #eee; }
.navbar-title { font-size: 17px; font-weight: 600; color: #333; display: flex; align-items: center; gap: 6px; }
.navbar-logo { height: 24px; width: auto; }
.navbar-right { position: absolute; right: 16px; top: 12px; }
.btn-search { background: #f5f5f5; border: none; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #999; font-size: 16px; cursor: pointer; }

/* 用户信息栏 */
.user-info-bar { height: 64px; background: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; margin-bottom: 12px; border-bottom: 1px solid #eee; }
.user-profile { display: flex; align-items: center; gap: 12px; }
.user-avatar-sm { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.user-avatar-sm img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.user-details { display: flex; flex-direction: column; }
.user-name-sm { font-size: 16px; font-weight: 600; }
.user-level-sm { font-size: 12px; color: #07c160; margin-top: 2px; }
.role-selector { position: relative; }
.role-switch-btn { display: flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 20px; border: 1px solid #07c160; background: transparent; color: #07c160; font-size: 13px; cursor: pointer; }
.role-switch-btn .icon { font-size: 12px; }
.role-dropdown { display: none; position: absolute; top: 100%; right: 0; margin-top: 8px; background: #fff; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); min-width: 120px; z-index: 101; overflow: hidden; }
.role-dropdown.active { display: block; }
.role-option { padding: 12px 16px; font-size: 14px; color: #333; cursor: pointer; transition: background 0.2s; }
.role-option:hover { background: #f7f7f7; }
.role-option.active { color: #07c160; background: #e6f7ef; }
.role-option .badge { margin-left: 8px; padding: 2px 6px; border-radius: 3px; font-size: 10px; background: #07c160; color: #fff; }

/* 用户搜索栏 */
.search-wrapper { display: flex; align-items: center; flex: 1; max-width: 200px; margin-left: 16px; }
.search-icon { position: absolute; left: 10px; font-size: 14px; color: #999; pointer-events: none; }
.user-search-input { width: 100%; padding: 8px 12px 8px 32px; border: 1px solid #e5e5e5; border-radius: 20px; font-size: 13px; background: #f5f5f5; color: #333; }
.user-search-input::placeholder { color: #999; }
.user-search-input:focus { outline: none; border-color: #07c160; background: #fff; }
.search-wrapper.has-search .user-search-input { border-color: #07c160; }

/* 主内容区 */
.mp-content { padding: 60px 12px 60px; min-height: 100vh; }
.page { display: none; }
.page.active { display: block; }
.no-data { text-align: center; padding: 60px 0; color: #999; font-size: 13px; }
.loading { text-align: center; padding: 40px 0; color: #999; }
.loading::after { content: '...'; animation: dots 1.5s infinite; }
@keyframes dots { 0%, 20% { content: '.'; } 40% { content: '..'; } 60%, 100% { content: '...'; } }

/* 卡片样式 */
.mp-card { background: #fff; border-radius: 8px; padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-title { font-size: 16px; font-weight: 600; }
.card-more { font-size: 12px; color: #999; cursor: pointer; }
.stats-card { background: linear-gradient(135deg, #07c160, #06ad56); color: #fff; }

/* 统计卡片 */
.stats-row { display: flex; align-items: center; text-align: center; }
.stat-item { flex: 1; }
.stat-item.main { flex: 1.5; }
.stat-money { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.stat-num { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.stat-label { font-size: 11px; opacity: 0.85; }
.stat-divider { width: 1px; height: 30px; background: rgba(255,255,255,0.3); }

/* 首页样式 */
.level-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.2); }
.level-name { font-size: 13px; font-weight: 500; }
.level-progress { font-size: 11px; opacity: 0.75; display: block; margin-top: 2px; }
.level-badge { padding: 4px 10px; border-radius: 10px; font-size: 11px; background: rgba(255,255,255,0.25); }
.tag-success { padding: 3px 8px; border-radius: 4px; font-size: 11px; background: #e6f7ef; color: #07c160; }
.tag-primary { padding: 3px 8px; border-radius: 4px; font-size: 11px; background: #e6f0f7; color: #576b95; }
.tag-warn { padding: 3px 8px; border-radius: 4px; font-size: 11px; background: #fff2e6; color: #fa9d3b; }

/* 推广卡片 */
.promo-card .promo-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.promo-body { display: flex; gap: 16px; align-items: center; }
.qr-box { width: 90px; height: 90px; background: #f5f5f5; border-radius: 6px; display: flex; align-items: center; justify-content: center; border: 1px dashed #ddd; }
.qr-placeholder { color: #ccc; font-size: 12px; }
.promo-info { flex: 1; }
.promo-code { font-size: 13px; color: #666; margin-bottom: 12px; }

/* 按钮样式 */
.mp-btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 16px; border-radius: 22px; font-size: 14px; border: none; cursor: pointer; transition: all 0.2s; }
.mp-btn-primary { background: #07c160; color: #fff; }
.mp-btn-primary:hover { background: #06ad56; }
.mp-btn-success { background: #07c160; color: #fff; }
.mp-btn-warn { background: #ff976a; color: #fff; }
.mp-btn-outline { border: 1px solid #07c160; color: #07c160; background: transparent; }
.mp-btn-mini { padding: 5px 10px; font-size: 11px; }
.mp-btn-block { width: 100%; padding: 12px; font-size: 16px; }

/* 菜单项 */
.menu-card { padding: 0; }
.menu-item { display: flex; justify-content: space-between; align-items: center; padding: 16px; cursor: pointer; border-bottom: 1px solid #eee; transition: background 0.2s; }
.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: #f9f9f9; }
.menu-left { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.menu-right { display: flex; align-items: center; gap: 4px; }
.menu-count { font-size: 13px; color: #999; }
.icon-arrow { font-size: 16px; color: #ccc; }

/* 底部导航栏 */
.mp-tabbar { position: fixed; bottom: 0; left: 0; right: 0; height: 60px; background: #fff; border-top: 1px solid #eee; display: flex; z-index: 100; }
.tab-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 0; cursor: pointer; color: #999; font-size: 10px; transition: all 0.2s; }
.tab-item.active { color: #07c160; }
.tab-icon { font-size: 22px; margin-bottom: 4px; }
.tab-text { font-size: 10px; }

/* 弹窗样式 */
.mp-modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; }
.modal-content { background: #fff; border-radius: 16px; width: 90%; max-width: 360px; overflow: hidden; }
.modal-header { padding: 16px; text-align: center; font-size: 17px; font-weight: 600; border-bottom: 1px solid #eee; }
.modal-body { padding: 16px; }
.modal-footer { padding: 12px 16px; background: #f7f7f7; display: flex; gap: 12px; }

/* 移动端底部安全区域适配 - 防止被浏览器工具栏遮挡 */
.modal-footer {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    padding-bottom: calc(12px + constant(safe-area-inset-bottom, 0px));
}
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .modal-footer {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

/* 关闭按钮样式 */
.modal-close { width: 28px; height: 28px; border: 1px solid #ddd; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; color: #999; cursor: pointer; background: #fff; }
.modal-close:hover { border-color: #999; color: #666; }

/* Toast提示 */
.mp-toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,0.7); color: #fff; padding: 12px 24px; border-radius: 8px; z-index: 1001; font-size: 14px; display: none; }

/* 表单样式 */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; margin-bottom: 6px; color: #666; }
.form-control { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.form-control:focus { outline: none; border-color: #07c160; }
.form-hint { font-size: 12px; color: #999; margin-top: 4px; }

/* ========== 骨架屏样式 ========== */
.skeleton-container { padding: 12px; }
.skeleton-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}
.skeleton-item:last-child { border-bottom: none; }
.skeleton-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    flex-shrink: 0;
    margin-right: 12px;
}
.skeleton-content { flex: 1; }
.skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}
.skeleton-line:last-child { margin-bottom: 0; }
.skeleton-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========== 空状态样式 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}
.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.6;
}
.empty-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}
.empty-desc {
    font-size: 14px;
    color: #999;
    margin-bottom: 20px;
}

/* ========== 通用工具类 ========== */
.text-primary { color: #07c160; }
.text-danger { color: #fa5151; }
.text-warning { color: #fa9d3b; }
.text-muted { color: #999; }
.text-center { text-align: center; }
.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; }
