page {
    background: #F4F6F0;
}

.exchange-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.page-scroll {
    flex: 1;
    height: 0;
}

/* ========== Balance Header ========== */
.balance-header {
    background: linear-gradient(180deg, #E8F5E9 0%, #F4F6F0 100%);
    padding: 32rpx 32rpx 24rpx;
    flex-shrink: 0;
}

.balance-card {
    background: #fff;
    border-radius: 24rpx;
    padding: 32rpx 36rpx;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.04);
}

.balance-label {
    font-size: 22rpx;
    color: #9CA3AF;
    display: block;
    margin-bottom: 8rpx;
    font-weight: 500;
}

.balance-value-row {
    display: flex;
    align-items: center;
    gap: 8rpx;
}

.balance-emoji {
    font-size: 36rpx;
}

.balance-value {
    font-size: 48rpx;
    font-weight: 800;
    color: #558B2F;
    line-height: 1;
}

.balance-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6rpx;
    padding: 16rpx 24rpx;
    border-radius: 20rpx;
    background: #F1F8E9;
}

.orders-text {
    font-size: 20rpx;
    color: #558B2F;
    font-weight: 600;
}

/* ========== Type Tabs ========== */
.type-tabs {
    display: flex;
    white-space: nowrap;
    padding: 20rpx 32rpx;
    gap: 16rpx;
    flex-shrink: 0;
}

.type-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10rpx 28rpx;
    background: #fff;
    border: 2rpx solid #E5E7EB;
    border-radius: 40rpx;
    font-size: 26rpx;
    color: #6B7280;
    font-weight: 600;
    flex-shrink: 0;
    margin-right: 0;
    transition: all 0.2s;
}

.type-tab.active {
    background: #333;
    color: #fff;
    border-color: #333;
}

/* ========== Items Grid ========== */
.items-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 0 32rpx;
    gap: 20rpx;
}

.item-card {
    background: #fff;
    border-radius: 20rpx;
    overflow: hidden;
    box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.03);
    transition: transform 0.15s;
}

.item-card:active {
    transform: scale(0.97);
}

.item-image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #F8FAF5;
    overflow: hidden;
}

.item-img {
    width: 100%;
    height: 100%;
    display: block;
}

.item-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #F1F8E9, #E8F5E9);
}

.stock-badge {
    position: absolute;
    top: 12rpx;
    right: 12rpx;
    background: rgba(239, 83, 80, 0.85);
    color: #fff;
    font-size: 20rpx;
    font-weight: 700;
    padding: 4rpx 14rpx;
    border-radius: 14rpx;
}

.sold-out-mask {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 30rpx;
    font-weight: 800;
    letter-spacing: 4rpx;
}

.sold-out-mask.not-started {
    background: rgba(33, 150, 243, 0.5);
}

.sold-out-mask.ended {
    background: rgba(0, 0, 0, 0.5);
}

.item-card.inactive {
    opacity: 0.7;
}

.item-info {
    padding: 16rpx 20rpx 20rpx;
}

.item-name {
    font-size: 28rpx;
    font-weight: 600;
    color: #1F2937;
    display: block;
    margin-bottom: 10rpx;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-price-row {
    display: flex;
    align-items: center;
    gap: 6rpx;
}

.price-sun {
    font-size: 24rpx;
}

.price-val {
    font-size: 30rpx;
    font-weight: 800;
    color: #E65100;
}

.item-time {
    display: flex;
    align-items: center;
    gap: 6rpx;
    margin-top: 8rpx;
    font-size: 22rpx;
    color: #9CA3AF;
    font-weight: 500;
}

/* ========== Empty & Footer States ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 120rpx 40rpx 80rpx;
}

.empty-icon {
    font-size: 100rpx;
    margin-bottom: 24rpx;
}

.empty-title {
    font-size: 30rpx;
    font-weight: 700;
    color: #374151;
    margin-bottom: 12rpx;
}

.empty-desc {
    font-size: 24rpx;
    color: #9CA3AF;
    font-weight: 500;
}

.state-footer {
    padding: 40rpx;
    display: flex;
    justify-content: center;
    align-items: center;
}

.no-more {
    font-size: 24rpx;
    color: #D1D5DB;
    font-weight: 500;
}

/* ========== Redeem Popup ========== */
.redeem-popup {
    background: #fff;
    border-radius: 32rpx 32rpx 0 0;
    padding: 36rpx;
    padding-bottom: calc(36rpx + env(safe-area-inset-bottom));
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28rpx;
}

.popup-title {
    font-size: 34rpx;
    font-weight: 700;
    color: #1F2937;
}

.popup-close {
    padding: 8rpx;
}

/* Item Preview in Popup */
.redeem-item-preview {
    display: flex;
    gap: 24rpx;
    padding: 24rpx;
    background: #F8FAF5;
    border-radius: 20rpx;
    margin-bottom: 28rpx;
}

.preview-img-wrap {
    width: 140rpx;
    height: 140rpx;
    border-radius: 16rpx;
    overflow: hidden;
    flex-shrink: 0;
    background: #E8F5E9;
}

.preview-img {
    width: 100%;
    height: 100%;
}

.preview-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8rpx;
}

.preview-name {
    font-size: 30rpx;
    font-weight: 700;
    color: #1F2937;
}

.preview-desc {
    font-size: 24rpx;
    color: #9CA3AF;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.5;
}

.preview-cost {
    display: flex;
    align-items: center;
    gap: 6rpx;
    margin-top: 4rpx;
}

.cost-sun { font-size: 24rpx; }
.cost-val { font-size: 32rpx; font-weight: 800; color: #E65100; }
.cost-unit { font-size: 22rpx; color: #9CA3AF; margin-left: 2rpx; }

/* Address Form */
.address-form {
    margin-bottom: 24rpx;
}

.form-title {
    font-size: 28rpx;
    font-weight: 700;
    color: #374151;
    margin-bottom: 16rpx;
}

.form-item {
    display: flex;
    align-items: center;
    background: #F9FAFB;
    border: 2rpx solid #F3F4F6;
    border-radius: 16rpx;
    padding: 20rpx 24rpx;
    margin-bottom: 12rpx;
    gap: 16rpx;
}

.form-label {
    font-size: 26rpx;
    color: #6B7280;
    font-weight: 600;
    flex-shrink: 0;
    width: 60rpx;
}

.form-item input {
    flex: 1;
    font-size: 26rpx;
    color: #1F2937;
}

/* Balance Check */
.balance-check {
    padding: 20rpx 24rpx;
    background: #F1F8E9;
    border-radius: 16rpx;
    margin-bottom: 20rpx;
    font-size: 26rpx;
    color: #558B2F;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.balance-check.insufficient {
    background: #FFF3E0;
    color: #E65100;
}

.insufficient-tip {
    color: #EF5350;
    font-weight: 700;
}

/* Redeem Button */
.redeem-btn {
    width: 100%;
    height: 92rpx;
    background: linear-gradient(135deg, #558B2F, #689F38);
    border-radius: 46rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 30rpx;
    font-weight: 700;
    transition: all 0.2s;
    box-shadow: 0 8rpx 24rpx rgba(85, 139, 47, 0.25);
}

.redeem-btn:active {
    transform: scale(0.97);
    opacity: 0.9;
}

.redeem-btn.disabled {
    background: #E5E7EB;
    color: #9CA3AF;
    pointer-events: none;
}
