/* ── 全局重置 ── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
    background: #f5f5f5;
    color: #333;
    -webkit-tap-highlight-color: transparent;
}

/* ── 顶部导航栏 ── */
.h5-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: #e4002b;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

.h5-navbar-title {
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: .5px;
}

.h5-navbar-back {
    position: absolute;
    left: 0;
    top: 0;
    height: 48px;
    width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    text-decoration: none;
}

/* ── 主内容区 ── */
.h5-main {
    padding-top: 48px;
    min-height: 100vh;
}

/* ── 通用卡片 ── */
.h5-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin: 12px;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
}

/* ── 主按钮 ── */
.btn-kfc {
    background: #e4002b;
    color: #fff;
    border: none;
    border-radius: 24px;
    height: 48px;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity .15s;
}

.btn-kfc:hover, .btn-kfc:active {
    background: #c4001f;
    color: #fff;
    opacity: .9;
}

.btn-kfc:disabled {
    opacity: .5;
}

/* ── 输入框 ── */
.h5-input {
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    height: 50px;
    font-size: 16px;
    padding: 0 16px;
    width: 100%;
    outline: none;
    transition: border-color .2s;
    background: #fafafa;
}

.h5-input:focus {
    border-color: #e4002b;
    background: #fff;
}

/* ── 首页 ── */
.index-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 24px 24px;
}

.index-logo {
    width: 80px;
    height: 80px;
    background: #e4002b;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 4px 16px rgba(228,0,43,.3);
}

.index-logo i {
    font-size: 40px;
    color: #fff;
}

.index-title {
    font-size: 22px;
    font-weight: 700;
    color: #222;
    margin-bottom: 6px;
}

.index-subtitle {
    font-size: 14px;
    color: #999;
    margin-bottom: 32px;
}

/* ── 商品卡片 ── */
.product-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin: 0 12px 12px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.product-card.selected {
    border-color: #e4002b;
    box-shadow: 0 2px 12px rgba(228,0,43,.15);
}

.product-icon {
    width: 56px;
    height: 56px;
    background: #fff5f5;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 28px;
}

.product-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.product-info { flex: 1; }

.product-name {
    font-size: 16px;
    font-weight: 600;
    color: #222;
    margin-bottom: 4px;
}

.product-desc {
    font-size: 13px;
    color: #999;
}

.product-check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all .15s;
}

.product-card.selected .product-check {
    background: #e4002b;
    border-color: #e4002b;
    color: #fff;
}

/* ── 确认页 ── */
.confirm-section {
    margin: 12px;
}

.confirm-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.confirm-value {
    font-size: 16px;
    font-weight: 600;
    color: #222;
}

.voucher-code-display {
    color: #e4002b;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 2px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.confirm-sub {
    font-size: 13px;
    color: #666;
    margin-top: 2px;
}

.location-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
    padding: 10px 0;
}

.location-status.locating { color: #f59e0b; }
.location-status.success  { color: #10b981; }
.location-status.failed   { color: #ef4444; }

.confirm-product {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
}

.store-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.store-option {
    width: 100%;
    text-align: left;
    background: #fafafa;
    border: 1.5px solid #e5e5e5;
    border-radius: 10px;
    padding: 12px;
    color: #333;
}

.store-option.selected {
    border-color: #e4002b;
    background: #fff5f5;
}

.store-name {
    font-size: 15px;
    font-weight: 600;
    color: #222;
}

.store-address {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

.store-distance {
    font-size: 13px;
    color: #e4002b;
    margin-top: 6px;
}

/* ── 结果页 ── */
.result-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 24px;
    text-align: center;
}

.result-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin-bottom: 20px;
}

.result-icon.processing {
    background: #fff7ed;
    color: #f59e0b;
}

.result-icon.success {
    background: #f0fdf4;
    color: #10b981;
}

.result-icon.failed {
    background: #fef2f2;
    color: #ef4444;
}

.pickup-code {
    font-size: 64px;
    font-weight: 800;
    color: #e4002b;
    letter-spacing: 8px;
    line-height: 1;
    margin: 16px 0;
}

.pickup-code.small {
    font-size: 36px;
    letter-spacing: 4px;
    margin: 8px 0 0;
}

.order-history-card {
    width: 100%;
}

.order-history-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.order-field {
    margin-top: 12px;
}

.order-field-main {
    min-width: 0;
    flex: 1;
    margin-top: 0;
}

.order-field-label {
    font-size: 12px;
    color: #999;
    line-height: 1.2;
    margin-bottom: 5px;
}

.order-field-value {
    font-size: 14px;
    color: #333;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.order-field-value.strong {
    font-size: 16px;
    font-weight: 600;
    color: #222;
}

.order-field-sub {
    font-size: 13px;
    color: #666;
    line-height: 1.45;
    margin-top: 2px;
    overflow-wrap: anywhere;
}

.order-status-box {
    flex-shrink: 0;
    text-align: right;
}

.order-history-no {
    min-width: 0;
    color: #333;
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.order-status {
    flex-shrink: 0;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
}

.order-status.status-0 {
    background: #fff7ed;
    color: #f59e0b;
}

.order-status.status-1 {
    background: #fff7ed;
    color: #f59e0b;
}

.order-status.status-2 {
    background: #f0fdf4;
    color: #10b981;
}

.order-status.status-3 {
    background: #fef2f2;
    color: #ef4444;
}

.order-status.status-4 {
    background: #fef2f2;
    color: #ef4444;
}

.order-pickup {
    margin-top: 12px;
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
}

.order-product-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.order-product-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.order-product-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #fff5f5;
    color: #e4002b;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.order-product-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 7px;
}

.order-product-name {
    min-width: 0;
    color: #222;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.fail-reason .order-field-value {
    color: #ef4444;
}

.order-refresh-area {
    margin-top: 12px;
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
}

.order-refresh-btn {
    border: 1px solid #e4002b;
    background: #fff;
    color: #e4002b;
    border-radius: 18px;
    height: 36px;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.order-refresh-btn:disabled {
    opacity: .5;
}

.order-retry-form {
    margin-top: 12px;
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
}

.order-retry-btn {
    border: none;
    background: #e4002b;
    color: #fff;
    border-radius: 18px;
    height: 36px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pickup-hint {
    font-size: 13px;
    color: #999;
    margin-top: 8px;
}

.pickup-address {
    font-size: 13px;
    color: #666;
    line-height: 1.45;
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.single-result-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-top: 20px;
    text-align: left;
    width: 100%;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
}

.result-products {
    border-top: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    text-align: left;
}

.single-result-refresh {
    width: 100%;
    text-align: center;
}

/* ── 底部固定按钮区 ── */
.h5-footer-btn {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: #fff;
    box-shadow: 0 -1px 8px rgba(0,0,0,.08);
}

/* ── 加载动画 ── */
.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ── 错误提示 ── */
.h5-alert {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 14px;
    padding: 10px 14px;
    margin: 0 12px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
