/* 校园交易集市响应式移动端样式 */
:root {
    --market-bg: #f8fafc;
    --market-primary: #4f46e5;
    --market-gold: #f59e0b;
    --market-border: #e2e8f0;
    --market-card-bg: #ffffff;
}

.market-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 12px 14px 40px;
    box-sizing: border-box;
    min-height: 100vh;
}

/* 顶部导航条 */
.market-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 0 12px;
}
.market-back-btn {
    background: #ffffff;
    border: 1px solid var(--market-border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--market-primary);
    cursor: pointer;
}
.market-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}
.market-coin-badge {
    background: #fffbeb;
    border: 1px solid #fde68a;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.88rem;
    font-weight: 800;
    color: #b45309;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(245, 158, 11, 0.12);
}

/* 交易准则提示条 */
.market-rule-bar {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.78rem;
    color: #1e40af;
    line-height: 1.4;
    margin-bottom: 12px;
}

/* 胶囊 Tabs */
.market-tabs {
    display: flex;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 12px;
    gap: 4px;
    margin-bottom: 14px;
    overflow-x: auto;
}
.tab-btn {
    flex: 1;
    min-width: 70px;
    border: none;
    background: transparent;
    padding: 8px 4px;
    border-radius: 9px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
    white-space: nowrap;
}
.tab-btn.active {
    background: #ffffff;
    color: var(--market-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* 面板显示控制 */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* 页面工具条 */
.hall-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: #475569;
}
.market-select {
    padding: 5px 8px;
    border: 1px solid var(--market-border);
    border-radius: 8px;
    background: #ffffff;
    font-size: 0.82rem;
}
.btn-refresh {
    background: #ffffff;
    border: 1px solid var(--market-border);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 0.78rem;
    cursor: pointer;
}

/* 集市商品网格 (手机单列/双列自适应) */
.goods-grid, .my-active-grid, .backpack-selectable-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
@media (max-width: 380px) {
    .goods-grid, .my-active-grid, .backpack-selectable-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}

/* 商品卡片 */
.goods-card {
    background: var(--market-card-bg);
    border: 2px solid var(--market-border);
    border-radius: 14px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    text-align: center;
}
.goods-card.mine-card { border-color: #cbd5e1; background: #fafafa; }
.goods-tag-mine {
    position: absolute;
    top: 8px; left: 8px;
    background: #64748b;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 6px;
}
.goods-countdown {
    position: absolute;
    top: 8px; right: 8px;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 6px;
}
.goods-img-box {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 16px 0 8px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.goods-img-box img { width: 100%; height: 100%; object-fit: cover; }
.goods-name {
    font-size: 0.82rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
}
.goods-seller {
    font-size: 0.72rem;
    color: #64748b;
    margin-bottom: 6px;
}
.goods-price-row {
    margin: auto 0 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 1rem;
    font-weight: 900;
    color: #d97706;
}
.btn-buy, .btn-delist-action, .btn-list-action {
    width: 100%;
    height: 36px;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: transform 0.1s;
}
.btn-buy:active, .btn-delist-action:active { transform: scale(0.97); }
.btn-buy { background: var(--market-primary); color: #ffffff; }
.btn-delist-action { background: #fee2e2; color: #dc2626; }
.btn-list-action { background: #e0e7ff; color: var(--market-primary); }

/* 配额指示药丸 */
.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.section-title-row h3 { margin: 0; font-size: 0.95rem; color: #1e293b; }
.quota-pill {
    background: #e0e7ff;
    color: var(--market-primary);
    font-size: 0.76rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 12px;
}

/* 分页条 */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
    padding: 10px 0;
}
.page-btn {
    background: #ffffff;
    border: 1px solid var(--market-border);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-info { font-size: 0.82rem; color: #64748b; font-weight: 700; }

/* 流水明细列表 */
.logs-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.logs-list, .my-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.log-item-card {
    background: #ffffff;
    border: 1px solid var(--market-border);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.log-reason { font-size: 0.84rem; font-weight: 700; color: #1e293b; }
.log-meta { font-size: 0.72rem; color: #94a3b8; margin-top: 3px; }
.log-amt { font-size: 0.95rem; font-weight: 900; font-family: monospace; }
.log-amt.positive { color: #16a34a; }
.log-amt.negative { color: #dc2626; }

/* 模态框通用 */
.market-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(3px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.market-modal-overlay.active { display: flex; }
.market-modal-card {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalPop {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.modal-header {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { margin: 0; font-size: 1rem; color: #1e293b; }
.modal-close-btn {
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 28px; height: 28px;
    cursor: pointer;
}
.modal-body { padding: 16px; }
.modal-footer {
    padding: 12px 16px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 8px;
}
.modal-btn {
    flex: 1;
    height: 42px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
}
.btn-ghost { background: #f1f5f9; color: #475569; }
.btn-primary { background: var(--market-primary); color: #ffffff; }
.btn-danger { background: #ef4444; color: #ffffff; }

.delist-fee-box {
    margin-top: 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    font-size: 0.86rem;
}
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 16px;
    color: #94a3b8;
    font-size: 0.85rem;
}
