/**
 * 寄售行页面样式
 */

/* 活动页变量兜底（主站 style 可能未定义） */
.consignment-page {
    --text: #f0f4f8;
    --text-secondary: #8b9cb3;
    --border: rgba(255, 255, 255, 0.12);
    --radius: 14px;
    --radius-sm: 10px;
    --primary: #7ee787;
    --glass: rgba(26, 35, 50, 0.85);
    --glass-border: rgba(126, 231, 135, 0.2);
}

body.consign-modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

.consign-modal-sheet {
    border-color: rgba(126, 231, 135, 0.25);
}

.consign-buy-foot .btn-confirm-buy,
.btn-list-submit {
    background: linear-gradient(135deg, #7ee787, #00d9ff);
    color: #0f1419;
}

.consign-buy-foot .buy-qty-label {
    display: block;
    text-align: left;
    margin-bottom: 6px;
}

.sell-hint {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 14px;
}

.records-tabs-inline {
    margin-bottom: 14px;
    padding: 0;
}

/* ========== 页面整体居中 ========== */
.consignment-page .page-header {
    text-align: center;
    margin-bottom: 20px;
}

.consignment-rules {
    max-width: 1100px;
    margin: 0 auto 20px;
    padding: 14px 20px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(126, 231, 135, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    color: var(--text-secondary);
    line-height: 1.6;
    text-align: center;
}

.consignment-rules strong {
    color: #7ee787;
}

.consignment-page .tab-panel {
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

/* 统一外框面板 */
.panel-box {
    width: 100%;
    background: rgba(12, 18, 32, 0.82);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(126, 231, 135, 0.3);
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.panel-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.35);
    border-bottom: 1px solid rgba(126, 231, 135, 0.2);
}

.panel-box-header h2 {
    margin: 0;
    font-size: 1.2em;
    color: #7ee787;
}

.panel-box-meta {
    font-size: 0.85em;
    color: var(--text-secondary);
}

.panel-box-body {
    padding: 20px 24px 28px;
}

.consignment-page .page-header h1 {
    font-size: 2em;
    background: linear-gradient(90deg, #7ee787, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.consignment-page .page-header p {
    color: var(--text-secondary);
}

/* 标签页 */
.consignment-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.tab-btn {
    padding: 10px 20px;
    border: 1px solid rgba(126, 231, 135, 0.35);
    background: rgba(20, 30, 40, 0.8);
    color: var(--text);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.95em;
}

.tab-btn:hover {
    border-color: #7ee787;
    background: rgba(126, 231, 135, 0.12);
}

.tab-btn.active {
    background: linear-gradient(135deg, rgba(126, 231, 135, 0.35), rgba(0, 217, 255, 0.25));
    border-color: #7ee787;
    box-shadow: 0 4px 16px rgba(126, 231, 135, 0.2);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* 市场工具栏 */
.market-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    max-width: 360px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.4);
    color: var(--text);
    font-size: 1em;
}

.search-input:focus {
    outline: none;
    border-color: #7ee787;
}

.market-stats {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.market-stats strong {
    color: #7ee787;
    font-size: 1.2em;
}

/* 商品网格：默认 3 列；极窄屏 2 列 */
.market-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.market-card {
    background: linear-gradient(180deg, rgba(26, 26, 46, 0.95) 0%, rgba(22, 33, 62, 0.95) 100%);
    border: 1px solid rgba(126, 231, 135, 0.25);
    border-radius: var(--radius);
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 0;
}

.market-card:hover {
    transform: translateY(-4px);
    border-color: #7ee787;
    box-shadow: 0 12px 28px rgba(126, 231, 135, 0.15);
}

.market-card .item-img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    margin: 0 auto 12px;
    display: block;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
}

.market-card .item-name {
    font-weight: bold;
    margin-bottom: 6px;
    font-size: 0.82em;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
}

.market-card .item-price {
    color: #7ee787;
    font-size: 1.1em;
    font-weight: bold;
}

.market-card .item-stock {
    color: var(--text-secondary);
    font-size: 0.85em;
    margin-top: 4px;
}

.market-card .listing-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 2px 8px;
    background: rgba(0, 217, 255, 0.15);
    border-radius: 10px;
    font-size: 0.75em;
    color: var(--primary);
}

/* 上架表单 */
.sell-form-card {
    background: var(--glass);
    border: 1px solid rgba(126, 231, 135, 0.2);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 960px;
    margin: 0 auto;
}

.sell-form-card h3 {
    margin-bottom: 16px;
    color: #7ee787;
}

.bag-select-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.loading-inline {
    grid-column: 1 / -1;
    text-align: center;
    padding: 32px 16px;
    color: var(--text-secondary);
}

.loading-inline .spinner {
    margin: 0 auto 12px;
}

.bag-select-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-width: 0;
    padding: 10px 6px 10px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.4);
    cursor: pointer;
    text-align: center;
    transition: all 0.25s ease;
    color: var(--text);
    font-family: inherit;
}

.bag-select-item:hover {
    border-color: rgba(126, 231, 135, 0.6);
    background: rgba(126, 231, 135, 0.08);
    transform: translateY(-2px);
}

.bag-select-item.selected {
    border-color: #7ee787;
    background: rgba(126, 231, 135, 0.15);
    box-shadow: 0 0 0 1px rgba(126, 231, 135, 0.3), 0 8px 20px rgba(126, 231, 135, 0.12);
}

.bag-select-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    line-height: 22px;
    border-radius: 50%;
    background: #7ee787;
    color: #0d1a12;
    font-size: 12px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s;
}

.bag-select-item.selected .bag-select-check {
    opacity: 1;
}

.bag-select-img {
    width: 72px;
    height: 72px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.bag-select-img img {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
}

.bag-select-name {
    display: block;
    width: 100%;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bag-select-num {
    font-size: 0.9em;
    font-weight: bold;
    color: #ffc800;
}

.sell-rules {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: rgba(126, 231, 135, 0.06);
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    color: var(--text-secondary);
    text-align: center;
}

.sell-section-title {
    font-size: 1em;
    color: #7ee787;
    margin-bottom: 14px;
    text-align: center;
}

.sell-fields {
    max-width: 520px;
    margin: 24px auto 0;
    padding-top: 24px;
    border-top: 1px solid rgba(126, 231, 135, 0.2);
}

.market-price-hint .tier-hint {
    display: block;
    margin-top: 4px;
    opacity: 0.85;
}

.market-price-hint {
    margin-top: 8px;
    padding: 10px 12px;
    background: rgba(0, 217, 255, 0.08);
    border: 1px solid rgba(0, 217, 255, 0.25);
    border-radius: var(--radius-sm);
    font-size: 0.85em;
    color: var(--primary);
    line-height: 1.5;
}

.deposit-preview {
    padding: 12px;
    background: rgba(255, 200, 0, 0.08);
    border: 1px solid rgba(255, 200, 0, 0.25);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9em;
    color: #ffc800;
    line-height: 1.5;
}

.selected-item-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    border: 1px solid rgba(126, 231, 135, 0.25);
}

.preview-img-wrap {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-img-wrap img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.preview-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.preview-text strong {
    font-size: 1.05em;
    word-break: break-all;
}

.preview-meta {
    font-size: 0.9em;
    color: var(--text-secondary);
}

.form-row {
    margin-bottom: 16px;
}

.form-row label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-row input {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.4);
    color: var(--text);
    font-size: 1em;
}

.field-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.85em;
    color: var(--text-secondary);
}

.fee-preview {
    padding: 12px;
    background: rgba(126, 231, 135, 0.08);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9em;
    color: #7ee787;
}


.btn-block {
    width: 100%;
    padding: 14px;
    font-size: 1.05em;
}

/* 我的挂单 - 表格式整体列表 */
.my-listings-wrap {
    width: 100%;
}

.listings-table {
    width: 100%;
    border-collapse: collapse;
}

.listings-table thead th {
    padding: 12px 14px;
    text-align: left;
    font-size: 0.85em;
    font-weight: normal;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.35);
    border-bottom: 1px solid rgba(126, 231, 135, 0.2);
}

.listings-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.2s;
}

.listings-table tbody tr:hover {
    background: rgba(126, 231, 135, 0.05);
}

.listings-table td {
    padding: 14px;
    vertical-align: middle;
}

.listing-item-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.listing-item-cell img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 8px;
    flex-shrink: 0;
}

.listing-item-cell .item-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.listing-price {
    color: #7ee787;
    font-weight: bold;
}

.listing-deposit {
    font-size: 0.85em;
    color: #ffc800;
}

.listing-time-hint {
    font-size: 0.8em;
    color: var(--text-secondary);
    margin-top: 4px;
}

.listing-time-hint.can-refund {
    color: #7ee787;
}

.listings-table .btn-cancel {
    padding: 8px 18px;
    background: rgba(255, 107, 107, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.9em;
}

.listings-table .btn-cancel:hover {
    background: rgba(255, 107, 107, 0.3);
}

/* 我的记录标签页 */
.records-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.record-tab-btn {
    padding: 10px 20px;
    border: 1px solid rgba(126, 231, 135, 0.35);
    background: rgba(20, 30, 40, 0.8);
    color: var(--text);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.95em;
    font-family: inherit;
}

.record-tab-btn:hover {
    border-color: #7ee787;
    background: rgba(126, 231, 135, 0.12);
}

.record-tab-btn.active {
    background: linear-gradient(135deg, rgba(126, 231, 135, 0.35), rgba(0, 217, 255, 0.25));
    border-color: #7ee787;
    box-shadow: 0 4px 16px rgba(126, 231, 135, 0.2);
}

.records-list {
    width: 100%;
}

/* 交易记录表格 */
.trade-record-table {
    width: 100%;
    border-collapse: collapse;
}

.trade-record-table thead th {
    padding: 12px 14px;
    text-align: left;
    font-size: 0.85em;
    font-weight: normal;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.35);
    border-bottom: 1px solid rgba(126, 231, 135, 0.2);
}

.trade-record-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.2s;
}

.trade-record-table tbody tr:hover {
    background: rgba(126, 231, 135, 0.05);
}

.trade-record-table td {
    padding: 14px;
    vertical-align: middle;
}

.trade-record-table .item-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.trade-record-table .item-cell img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 8px;
    flex-shrink: 0;
}

.trade-record-table .item-cell .item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.trade-record-table .item-cell .item-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trade-record-table .item-cell .item-meta {
    font-size: 0.85em;
    color: var(--text-secondary);
}

.trade-record-table .price-cell {
    color: #7ee787;
    font-weight: bold;
}

.trade-record-table .total-cell {
    font-weight: bold;
}

.trade-record-table .time-cell {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.record-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

/* 上架模态框 */
.sell-form-modal .form-row {
    margin-bottom: 16px;
}

.sell-form-modal .form-row label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.95em;
}

.sell-form-modal .form-row input {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.4);
    color: var(--text);
    font-size: 1em;
    box-sizing: border-box;
}

.sell-form-modal .qty-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}

.sell-form-modal .qty-row input {
    flex: 1;
    text-align: center;
}

.sell-form-modal .fee-preview {
    padding: 12px;
    background: rgba(126, 231, 135, 0.08);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 0.9em;
    color: #7ee787;
}

.sell-form-modal .deposit-preview {
    padding: 12px;
    background: rgba(255, 200, 0, 0.08);
    border: 1px solid rgba(255, 200, 0, 0.25);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9em;
    color: #ffc800;
    line-height: 1.5;
}

/* 模态由 activity-mobile .act-modal.show 控制 */

.detail-summary p {
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.detail-summary strong {
    color: var(--text);
}

/* 购买弹窗 */
.consignment-detail-modal {
    max-width: 480px;
    width: 95%;
}

.detail-top {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    align-items: center;
}

.detail-img-wrap {
    width: 88px;
    height: 88px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-img-wrap img {
    max-width: 72px;
    max-height: 72px;
    object-fit: contain;
}

.detail-summary p {
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.price-tag {
    color: #7ee787;
    font-size: 1.4em;
    font-weight: bold;
}

.tier-title {
    font-size: 0.95em;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.price-tier-table-wrap {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.price-tier-table {
    width: 100%;
    border-collapse: collapse;
}

.price-tier-table th,
.price-tier-table td {
    padding: 10px 14px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.price-tier-table th {
    background: rgba(0, 0, 0, 0.35);
    color: var(--text-secondary);
    font-weight: normal;
    font-size: 0.85em;
}

.price-tier-table td:first-child {
    color: #7ee787;
    font-weight: bold;
}

.buy-section label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.buy-qty-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.buy-qty-row input {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.4);
    color: var(--text);
    font-size: 1.1em;
}

.qty-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.4);
    color: var(--text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.2em;
}

.qty-btn:hover {
    border-color: #7ee787;
    color: #7ee787;
}

.qty-btn.max-btn {
    width: auto;
    padding: 0 12px;
    font-size: 0.85em;
}

.buy-total {
    text-align: center;
    margin-bottom: 16px;
    font-size: 1.05em;
}

.buy-total span {
    color: #7ee787;
    font-weight: bold;
    font-size: 1.2em;
}

.hint-text {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
}

@media (max-width: 768px) {
    .consignment-page .page-container {
        max-width: 100%;
        padding: 0 0 20px;
    }

    .consignment-rules {
        display: none;
    }

    .panel-box-header {
        display: none;
    }

    .market-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        max-width: none;
        min-width: 0;
        min-height: 48px;
        font-size: 16px;
    }

    .market-card .item-img {
        width: 56px;
        height: 56px;
    }

    .qty-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .buy-qty-row input,
    .sell-form-modal .form-row input {
        min-height: 48px;
        font-size: 16px;
    }

    .detail-top {
        flex-direction: row;
        gap: 14px;
    }

    .price-tier-table th,
    .price-tier-table td {
        padding: 12px 10px;
        font-size: 14px;
    }
}

/* 极窄屏：2 列一排，避免 3 列挤爆 */
@media (max-width: 380px) {
    .market-grid,
    .bag-select-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .market-card .item-img {
        width: 52px;
        height: 52px;
    }

    .bag-select-img {
        width: 48px;
        height: 48px;
    }
}

@media (max-width: 600px) {
    .panel-box-body {
        padding: 16px;
    }

    .listings-table thead {
        display: none;
    }

    .listings-table tbody tr {
        display: block;
        margin-bottom: 12px;
        padding: 12px;
        background: rgba(0, 0, 0, 0.25);
        border-radius: var(--radius-sm);
        border: 1px solid rgba(255, 255, 255, 0.08);
    }

    .listings-table td {
        display: block;
        padding: 6px 0;
        text-align: left;
    }

    .listings-table td:last-child {
        margin-top: 10px;
    }

    .sell-fields {
        max-width: 100%;
    }
}
