/* 自助购买相关样式 */

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.top-nav .page-title { margin: 0; padding: 0; text-align: left; font-size: 22px; flex: 1 1 auto; min-width: 0; }
.top-nav-actions { display: flex; gap: 10px; flex-shrink: 0; }
.top-nav-actions .btn { text-decoration: none; }

/* 商品列表 */
.product-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.product-card {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    background: #fff;
    transition: all .15s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}
.product-card:hover { border-color: #c7d2fe; transform: translateY(-1px); }
.product-card.active {
    border-color: #6c63ff;
    box-shadow: 0 4px 16px rgba(108, 99, 255, 0.18);
}
.product-card.disabled { opacity: .5; cursor: not-allowed; }
.product-card .product-head {
    display: flex; align-items: center; gap: 10px;
}
.product-card .product-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: #eef2ff; color: #6c63ff; font-size: 18px;
}
.product-card .product-name { font-size: 15px; font-weight: 600; color: #1f2937; }
.product-card .product-desc { font-size: 12px; color: #6b7280; min-height: 18px; }
.product-card .product-meta {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin-top: 6px;
}
.product-card .product-price {
    color: #ef4444; font-weight: 700; font-size: 20px;
}
.product-card .product-price small { font-size: 12px; color: #9ca3af; font-weight: 400; }
.product-card .product-stock { font-size: 12px; color: #22c55e; }
.product-card .product-sold {
    margin-top: 6px;
    font-size: 12px;
    color: #f97316;
    display: flex;
    align-items: center;
    gap: 4px;
}
.product-card .sold-out {
    position: absolute; top: 8px; right: 8px;
    background: #ef4444; color: #fff; font-size: 11px;
    padding: 2px 8px; border-radius: 999px;
}

/* 商品摘要 */
.buy-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 0 0 24px;
}
@media (max-width: 720px) {
    .buy-summary { grid-template-columns: repeat(2, 1fr); }
}

.summary-item {
    background: #fff;
    padding: 18px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.summary-label {
    display: block;
    font-size: 12px;
    color: #999;
    margin-bottom: 6px;
}

.summary-value strong {
    font-size: 24px;
    font-weight: 700;
}

.price-original {
    margin-left: 6px;
    font-size: 12px;
    color: #aaa;
    text-decoration: line-through;
    vertical-align: middle;
}

.price-tip {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #f59e0b;
}

.price-tip.price-saved {
    color: #22c55e;
}

/* 阶梯折扣横幅 */
.discount-banner {
    background: linear-gradient(135deg, #fff7ed 0%, #fff1f2 100%);
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 20px;
}

.discount-title {
    font-size: 14px;
    font-weight: 600;
    color: #b45309;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.discount-tiers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.discount-tier {
    position: relative;
    background: #fff;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 10px 12px;
    text-align: center;
    transition: all 0.2s;
}

.discount-tier.active {
    border-color: #f59e0b;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.18);
    transform: translateY(-1px);
}

.tier-qty {
    font-size: 12px;
    color: #92400e;
    margin-bottom: 4px;
}

.tier-price {
    font-size: 18px;
    font-weight: 700;
    color: #dc2626;
}

.tier-unit {
    font-size: 11px;
    font-weight: 400;
    color: #999;
}

.tier-off {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 500;
}

/* 表单 */
.form-group {
    margin-bottom: 18px;
}

.form-group > label {
    display: block;
    font-size: 13px;
    color: #555;
    font-weight: 500;
    margin-bottom: 6px;
}

.required { color: #ef4444; }

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: #6c63ff;
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.hint {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.btn-block {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    justify-content: center;
}

/* 数量选择 */
.qty-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #e0e0e0;
    background: #fff;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.qty-btn:hover { border-color: #6c63ff; color: #6c63ff; }

.qty-input {
    width: 80px;
    text-align: center;
}

.qty-max {
    font-size: 12px;
    color: #999;
    margin-left: 6px;
}

/* 支付方式 */
.pay-methods {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.pay-option {
    flex: 1;
    min-width: 140px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.pay-option:hover { border-color: #6c63ff; }

.pay-option input[type="radio"] {
    accent-color: #6c63ff;
    cursor: pointer;
}

.pay-option input[type="radio"]:checked + .pay-icon {
    transform: scale(1.1);
}

.pay-option:has(input:checked) {
    border-color: #6c63ff;
    background: #f8f7ff;
}

.pay-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pay-icon {
    font-size: 22px;
    transition: transform 0.2s;
}

.pay-icon.alipay { color: #1677ff; }
.pay-icon.wechat { color: #07c160; }

/* 验证码 */
.captcha-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.captcha-img {
    height: 44px;
    cursor: pointer;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f5f7fa;
}

/* 订单状态徽章 */
.status-badge {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}
.status-badge.pending { background: #fffbeb; color: #f59e0b; }
.status-badge.paid { background: #f0fdf4; color: #22c55e; }
.status-badge.cancelled { background: #fef2f2; color: #ef4444; }
.status-badge.expired { background: #fef2f2; color: #ef4444; }

/* 订单信息行 */
.order-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
}

.info-row:last-child { border-bottom: none; }
.info-row span { color: #666; }
.info-row strong { font-size: 14px; color: #1a1a2e; }

/* 二维码 */
.qr-img {
    width: 240px;
    height: 240px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    padding: 8px;
}

/* 卡密展示（query页） */
.result-card-item {
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    background: #fafffe;
}

.result-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    color: #999;
}

.card-idx { font-weight: 600; color: #6c63ff; }

.card-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.info-field {
    padding: 10px;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.info-field:hover { background: #f8f8f8; }
.info-field.full-width { grid-column: 1 / -1; }

.info-field-label {
    font-size: 10px;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.info-field-value {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    word-break: break-all;
}

.info-field-copy {
    float: right;
    font-size: 10px;
    color: #6c63ff;
    opacity: 0.5;
}

.info-field:hover .info-field-copy { opacity: 1; }

.expire-info {
    margin-top: 10px;
    font-size: 11px;
    color: #999;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.status-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}
.tag-active { background: #ecfdf5; color: #10b981; }
.tag-expired { background: #fef2f2; color: #ef4444; }

@media (max-width: 600px) {
    .top-nav { flex-direction: column; align-items: stretch; }
    .top-nav-actions { justify-content: center; }
    .buy-summary { grid-template-columns: 1fr; }
    .card-info-grid { grid-template-columns: 1fr; }
}


/* 兑换码列表 */
.codes-list {
    margin-top: 16px;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.code-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
}

.code-row:last-child { border-bottom: none; }
.code-row code { flex: 1; color: #6c63ff; font-weight: 500; }
.code-row .hint { color: #999; font-size: 11px; margin: 0; }

.tag-unused { background: #f0fdf4; color: #22c55e; }
.tag-used { background: #f3f4f6; color: #999; }


/* 查询页：模式切换 Tab */
.query-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    background: #f5f5fb;
    padding: 4px;
    border-radius: 10px;
}

.query-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.query-tab:hover {
    color: #6c63ff;
}

.query-tab.active {
    background: #fff;
    color: #6c63ff;
    box-shadow: 0 2px 6px rgba(108, 99, 255, 0.15);
}


/* 本机历史订单 */
.local-orders-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.local-order-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    background: #fafbff;
    transition: border-color 0.2s, background 0.2s;
}

.local-order-row:hover {
    border-color: #d6d2ff;
    background: #f5f3ff;
}

.local-order-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.local-order-no {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #6c63ff;
    font-weight: 600;
}

.local-order-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 12px;
    color: #888;
}

.local-order-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}


/* ===== 查询页：历史订单优化（折叠 + 紧凑 + 限高） ===== */
.local-orders-tools {
    display: flex;
    gap: 8px;
    align-items: center;
}

.local-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin-left: 6px;
    border-radius: 999px;
    background: #eef2ff;
    color: #6c63ff;
    font-size: 12px;
    font-weight: 600;
    vertical-align: middle;
}

/* 展开后限高，避免长列表把结果挤出屏幕 */
.local-orders-body {
    max-height: 340px;
    overflow-y: auto;
}

/* 历史订单行：横向紧凑排列，一行看完关键信息 */
.local-order-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 14px;
    padding: 10px 14px;
}

.local-order-main {
    flex: 1 1 auto;
    min-width: 0;
}

.local-order-meta {
    flex: 0 0 auto;
    margin-left: auto;
}

.local-order-actions {
    flex: 0 0 auto;
}

.local-order-actions .btn {
    padding: 4px 10px;
    font-size: 12px;
}

@media (max-width: 600px) {
    /* 窄屏回到竖向堆叠，保证可读性 */
    .local-order-row { flex-direction: column; align-items: stretch; }
    .local-order-meta { margin-left: 0; }
}
