/* Market App CSS */
.page.market {
    /* 默认会在 index.html 中配合 active class 展现 */
    display: none;
    background: #f8f9fa; /* 韩系高级浅灰背景 */
    flex-direction: column;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.page.market.active {
    display: flex;
}

/* 顶部 Header */
.market-header {
    background: rgba(248, 249, 250, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    flex-shrink: 0;
    padding: calc(max(env(safe-area-inset-top), 20px) + 5px) 20px 15px 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

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

.market-header-avatar {
    width: 44px;
    height: 44px;
    border-radius: 22px;
    object-fit: cover;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.market-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.market-header-name {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    letter-spacing: 0.5px;
}

.market-header-balance {
    display: none !important; /* 余额不再显示在头部 */
}

.market-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.market-header-btn {
    font-size: 20px;
    color: #495057;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    transition: transform 0.2s;
}
.market-header-btn:active {
    transform: scale(0.95);
}

/* 主体内容区域 */
.market-body {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

/* 视图通用样式 */
.market-view {
    display: none;
    padding: 15px;
    padding-bottom: 40px; /* 留出底部边距 */
}

.market-view.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- 商城视图 (瀑布流/网格) --- */
.shop-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.goods-item {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(0,0,0,0.02);
}
.goods-item:active {
    transform: scale(0.98);
}

.goods-img-placeholder {
    aspect-ratio: 1;
    background: #f1f3f5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ced4da;
    font-size: 40px;
    background-size: cover; 
    background-position: center;
}

.goods-info {
    padding: 12px 15px;
}

.goods-name {
    font-size: 14px;
    font-weight: 500;
    color: #343a40;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
    line-height: 1.4;
    letter-spacing: 0.2px;
}

.goods-price {
    color: #495057;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.5px;
}

/* --- 闲置视图 (列表) --- */
.secondhand-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.secondhand-item {
    background: #fff;
    border-radius: 20px;
    padding: 15px;
    display: flex;
    gap: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.02);
    align-items: center;
}

.sh-img-placeholder {
    width: 80px;
    height: 80px;
    background: #f8f9fa;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #dee2e6;
    font-size: 28px;
    flex-shrink: 0;
}

.sh-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sh-name {
    font-size: 15px;
    color: #212529;
    font-weight: 600;
    margin-bottom: 4px;
}

.sh-price {
    color: #495057;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.5px;
}

.sh-user {
    font-size: 12px;
    color: #868e96;
    margin-top: 4px;
}

.floating-btn {
    position: fixed;
    bottom: 90px;
    right: 20px;
    background: #495057;
    color: #fff;
    padding: 14px 24px;
    border-radius: 30px;
    box-shadow: 0 8px 20px rgba(73, 80, 87, 0.25);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s, background 0.2s;
}
.floating-btn:active {
    transform: scale(0.95);
    background: #343a40;
}

/* --- 拍卖场视图 (Auction) --- */
#market-tab-auction {
    padding-bottom: 80px;
}

#auction-bids-container::-webkit-scrollbar {
    width: 4px;
}
#auction-bids-container::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 4px;
}

/* --- 我的仓库视图 --- */
.warehouse-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.warehouse-item {
    aspect-ratio: 1;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.03);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    font-size: 32px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    transition: transform 0.2s;
    overflow: hidden;
}
.warehouse-item:active {
    transform: scale(0.95);
}

.warehouse-item-name {
    font-size: 12px; 
    color: #495057; 
    text-align: center; 
    margin-top: 10px; 
    width: 80%; 
    font-weight: 500;
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap;
}

.warehouse-item.empty {
    background: transparent;
    border: 2px dashed #dee2e6;
    box-shadow: none;
}

.wh-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}
.wh-empty-icon {
    font-size: 60px;
    color: #dee2e6;
    margin-bottom: 15px;
}
.wh-empty-text {
    font-size: 15px;
    color: #adb5bd;
    margin-bottom: 30px;
    letter-spacing: 0.5px;
}
.wh-add-btn {
    background: #495057;
    color: #fff;
    padding: 14px 30px;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(73, 80, 87, 0.2);
    cursor: pointer;
}

/* 底部 Tab 栏 */
.market-tab-bar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0,0,0,0.03);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0 calc(env(safe-area-inset-bottom) + 10px) 0;
    flex-shrink: 0;
}

.market-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #adb5bd;
    cursor: pointer;
    flex: 1;
    padding: 4px 0;
    transition: color 0.2s;
}

.market-tab-item i {
    font-size: 20px;
    transition: transform 0.2s;
}

.market-tab-item span {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.market-tab-item.active {
    color: #343a40;
}

.market-tab-item.active i {
    transform: translateY(-2px);
}

/* 仓库 韩系余额模块 */
.market-balance-module {
    background: #f1f3f5;
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.02);
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    transition: transform 0.2s;
}
.market-balance-module:active {
    transform: scale(0.98);
}
.market-balance-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: #495057;
}
.market-balance-arrow {
    font-size: 12px;
    color: #868e96;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 支付模块 - 仿微信灰色系UI */
.market-pay-overlay {
    background: rgba(0,0,0,0.5);
    z-index: 5000;
}
.market-pay-drawer {
    background: #f0f0f0; /* 微信支付灰色底板 */
    border-radius: 12px 12px 0 0;
    width: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(100%);
}
.market-pay-header {
    padding: 16px;
    text-align: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    position: relative;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}
.market-pay-close {
    position: absolute;
    left: 16px;
    top: 16px;
    font-size: 20px;
    color: #888;
    cursor: pointer;
}
.market-pay-amount-area {
    padding: 24px 20px 20px;
    text-align: center;
}
.market-pay-title {
    font-size: 15px;
    color: #666;
    margin-bottom: 12px;
}
.market-pay-amount {
    font-size: 40px;
    font-weight: 700;
    color: #000;
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 4px;
}
.market-pay-method-row {
    background: #fff;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-top: 1px solid rgba(0,0,0,0.05);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 24px;
}
.market-pay-pwd-dots {
    display: flex;
    justify-content: center;
    gap: 0;
    margin: 0 20px 30px;
    border: 1px solid #ccc;
    border-radius: 6px;
    overflow: hidden;
}
.market-pay-dot {
    flex: 1;
    height: 50px;
    background: #fff;
    border-right: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #000;
}
.market-pay-dot:last-child {
    border-right: none;
}
.market-pay-keyboard {
    background: #d1d5db;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    padding-top: 1px;
    padding-bottom: max(env(safe-area-inset-bottom), 0px);
}
.market-pay-key {
    background: #fff;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 500;
    color: #000;
    cursor: pointer;
}
.market-pay-key:active {
    background: #e5e5e5;
}
.market-pay-key.special {
    background: #e5e7eb;
}

/* --- 聊天流中的市集卡片样式 --- */

/* 赠礼卡片 - 韩系极简 */
.market-card.gift-card {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.03);
    border-radius: 20px;
    padding: 16px;
    width: 240px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.gift-card-content {
    display: flex;
    gap: 12px;
    align-items: center;
}

.gift-card-img {
    width: 54px;
    height: 54px;
    background: #f8f9fa;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    flex-shrink: 0;
}

.gift-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.gift-card-title {
    font-size: 12px;
    color: #adb5bd;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.gift-card-name {
    font-size: 15px;
    font-weight: 600;
    color: #343a40;
    line-height: 1.3;
}

.gift-card-btn {
    background: #f1f3f5;
    color: #495057;
    border: none;
    padding: 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
}
.gift-card-btn:active {
    background: #e9ecef;
}

/* 代付卡片 - 韩系极简 */
.market-card.pay-card {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.03);
    border-radius: 20px;
    padding: 16px;
    width: 240px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.pay-card-header {
    font-size: 12px;
    color: #adb5bd;
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
    letter-spacing: 0.5px;
}

.pay-card-content {
    display: flex;
    gap: 12px;
    align-items: center;
}

.pay-card-img {
    width: 50px;
    height: 50px;
    background: #f8f9fa;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 22px;
    flex-shrink: 0;
}

.pay-card-info {
    flex: 1;
    overflow: hidden;
}

.pay-card-name {
    font-size: 14px;
    color: #343a40;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pay-card-price {
    font-size: 16px;
    font-weight: 600;
    color: #495057;
    margin-top: 4px;
}

.pay-card-btn {
    background: #343a40;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
}
.pay-card-btn:active {
    background: #212529;
}

/* 闲置分享卡片 - 韩系极简 */
.market-card.share-card {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.03);
    border-radius: 20px;
    overflow: hidden;
    width: 220px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.share-card-img {
    width: 100%;
    height: 140px;
    background: #f8f9fa;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 40px;
}
.share-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.share-card-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.share-card-name {
    font-size: 14px;
    color: #343a40;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.share-card-price {
    font-size: 16px;
    font-weight: 600;
    color: #495057;
}

.share-card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #adb5bd;
    margin-top: 6px;
}
