/* 移动端公共样式 - 全国原料贸易平台 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: #F5F5F5;
    color: #212121;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "tnum";
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
input, textarea, select, button { font-family: inherit; font-size: inherit; color: inherit; outline: none; }
button { cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, h5, h6, p { margin: 0; }

/* === App 容器 === */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    --theme: #2E7D32;
    --theme-rgb: 46,125,50;
}

/* === 顶部栏 === */
.app-header {
    background: var(--theme);
    color: #fff;
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.header-back { color: #fff; font-size: 18px; padding: 8px; margin-left: -8px; }
.header-title { flex: 1; text-align: center; font-size: 17px; font-weight: 600; }
.header-right { min-width: 32px; text-align: right; }

/* === 主内容区 === */
.app-main {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.app-main.full-width { padding: 0; }

/* === 底部 Tab 栏 === */
.tabbar {
    display: flex;
    background: #fff;
    border-top: 1px solid #E0E0E0;
    height: 50px;
    position: sticky;
    bottom: 0;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9E9E9E;
    font-size: 11px;
}
.tabbar-item i { font-size: 18px; margin-bottom: 2px; }
.tabbar-item.active { color: var(--theme); }

/* === 文字色 === */
.text-primary { color: var(--theme); }
.text-orange { color: #FF8F00; }
.text-red { color: #D32F2F; }
.text-green { color: #388E3C; }
.text-blue { color: #1976D2; }
.text-muted { color: #9E9E9E; }
.text-small { font-size: 13px; }
.text-bold { font-weight: 600; }
.text-large { font-size: 17px; }
.text-xlarge { font-size: 22px; font-weight: 600; }
.text-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* === 卡片 === */
.card {
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.card-row { display: flex; align-items: center; padding: 6px 0; }
.card-row .label { color: #616161; min-width: 80px; }
.card-row .value { flex: 1; color: #212121; }

/* === 按钮 === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 16px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    background: #f5f5f5;
    color: #616161;
}
.btn-primary { background: var(--theme); color: #fff; }
.btn-accent { background: #FF8F00; color: #fff; }
.btn-danger { background: #D32F2F; color: #fff; }
.btn-success { background: #388E3C; color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--theme); color: var(--theme); }
.btn-block { display: flex; width: 100%; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 50px; font-size: 17px; }
.btn:disabled, .btn.disabled { background: #BDBDBD !important; color: #fff !important; cursor: not-allowed; }

/* === 表单 === */
.form-group {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    padding: 0 12px;
    margin-bottom: 10px;
    height: 48px;
}
.form-group i { color: #9E9E9E; margin-right: 8px; font-size: 16px; }
.form-group input, .form-group select, .form-group textarea {
    flex: 1;
    border: none;
    background: transparent;
    height: 100%;
    padding: 0;
}
.form-group input::placeholder, .form-group textarea::placeholder { color: #9E9E9E; }
.form-group textarea { resize: none; padding: 12px 0; }
.form-group .btn-sms {
    background: linear-gradient(135deg, #FF7043 0%, #F4511E 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    height: 32px;
    margin-left: 8px;
    flex-shrink: 0;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(244,81,30,.3);
    transition: all .2s;
}
.form-group .btn-sms:active { transform: scale(.96); }
.form-group .btn-sms.disabled { background: #BDBDBD; cursor: not-allowed; box-shadow: none; }
.form-group input, .form-group select, .form-group textarea { min-width: 0; }
.select {
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    background: #fff;
    padding: 0 12px;
    height: 48px;
    width: 100%;
}

/* === 标签 === */
.tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 4px;
    background: #E0E0E0;
    color: #616161;
}
.tag-green { background: #E8F5E9; color: #2E7D32; }
.tag-orange { background: #FFF3E0; color: #F57C00; }
.tag-red { background: #FFEBEE; color: #D32F2F; }
.tag-blue { background: #E3F2FD; color: #1976D2; }
.tag-gray { background: #F5F5F5; color: #9E9E9E; }
.tag-purple { background: #F3E5F5; color: #6A1B9A; }
.tag-cyan { background: #E0F7FA; color: #00838F; }

/* === 信用徽章 === */
.credit-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    border: 1px solid;
    background: #fff;
}
.credit-lv1 { border-color: #FFB300; color: #2E7D32; }
.credit-lv2 { border-color: #1976D2; color: #1976D2; }
.credit-lv3 { border-color: #F57C00; color: #F57C00; }
.credit-lv4 { border-color: #D32F2F; color: #D32F2F; }

/* === 列表/空状态 === */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #9E9E9E;
}
.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* === 列表项 === */
.list-item {
    background: #fff;
    padding: 12px;
    border-bottom: 1px solid #F5F5F5;
    display: flex;
    align-items: center;
}
.list-item:last-child { border-bottom: none; }

/* === Tab 切换 === */
.tabs {
    display: flex;
    background: #fff;
    border-bottom: 1px solid #E0E0E0;
    overflow-x: auto;
    position: sticky;
    z-index: 99;
}
.tab {
    flex: 1;
    min-width: 60px;
    text-align: center;
    padding: 12px 8px;
    font-size: 14px;
    color: #616161;
    white-space: nowrap;
    position: relative;
}
.tab.active { color: var(--theme); font-weight: 600; }
.tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--theme);
    border-radius: 2px;
}

/* === 进度条 === */
.progress {
    background: #E0E0E0;
    border-radius: 8px;
    height: 8px;
    overflow: hidden;
}
.progress-bar { height: 100%; border-radius: 8px; transition: width 0.3s; }
.progress-bar.green { background: #2E7D32; }
.progress-bar.orange { background: #FF8F00; }
.progress-bar.red { background: #D32F2F; }
.progress-bar.blue { background: #1976D2; }

/* === 价格 === */
.price { color: #FF8F00; font-weight: 600; font-size: 17px; }
.price-large { color: #FF8F00; font-weight: 700; font-size: 22px; }
.price-market { color: #9E9E9E; text-decoration: line-through; font-size: 13px; }

/* === 工具类 === */
.hide { display: none !important; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.flex-col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mb-4 { margin-bottom: 4px; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.p-8 { padding: 8px; } .p-12 { padding: 12px; } .p-16 { padding: 16px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.rounded { border-radius: 8px; }
.rounded-full { border-radius: 999px; }

/* === 提示 === */
.alert { padding: 10px 12px; border-radius: 6px; margin-bottom: 10px; font-size: 13px; }
.alert-error { background: #FFEBEE; color: #D32F2F; }
.alert-success { background: #E8F5E9; color: #2E7D32; }
.alert-warning { background: #FFF3E0; color: #F57C00; }
.alert-info { background: #E3F2FD; color: #1976D2; }

/* === Toast === */
.toast {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s;
    max-width: 80%;
    text-align: center;
}
.toast.show { opacity: 1; }
.toast.toast-success { background: #2E7D32; }
.toast.toast-error { background: #D32F2F; }
.toast.toast-warning { background: #FF8F00; }

/* === 加载 === */
.loading-mask {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}
