/* 全局样式 - 完美适配H5手机端 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --radius: 12px;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== 前台首页样式 ===== */
.site-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: #fff;
    padding: 2rem 1rem 3rem;
    text-align: center;
}

.site-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.site-header p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.main-container {
    max-width: 720px;
    margin: -1.5rem auto 0;
    padding: 0 1rem 2rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 1rem;
    padding-left: 0.75rem;
    border-left: 4px solid var(--primary-color);
}

/* 商品卡片 */
.product-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.product-card:active {
    transform: scale(0.98);
}

.product-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.product-name {
    font-size: 1.15rem;
    font-weight: 600;
    flex: 1;
    padding-right: 0.5rem;
}

.product-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--danger-color);
    white-space: nowrap;
}

.product-price small {
    font-size: 0.85rem;
    font-weight: 500;
}

.product-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.product-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.product-stock {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.product-stock.in-stock {
    color: var(--success-color);
}

.product-stock.out-stock {
    color: var(--danger-color);
}

/* 按钮通用 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.4rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    outline: none;
    min-height: 44px;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.btn-success {
    background: var(--success-color);
    color: #fff;
}

.btn-warning {
    background: var(--warning-color);
    color: #fff;
}

.btn-danger {
    background: var(--danger-color);
    color: #fff;
}

.btn-secondary {
    background: var(--text-secondary);
    color: #fff;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* ===== 支付弹窗 ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: #fff;
    width: 100%;
    max-width: 500px;
    border-radius: 16px 16px 0 0;
    padding: 1.5rem;
    transform: translateY(100%);
    transition: transform 0.3s;
}

.modal-overlay.show .modal-container {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-color);
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.order-info {
    background: var(--bg-color);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.order-info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    font-size: 0.95rem;
}

.order-info-row .label {
    color: var(--text-secondary);
}

.order-info-row .value {
    font-weight: 500;
}

.order-info-row.total .value {
    color: var(--danger-color);
    font-size: 1.2rem;
    font-weight: 700;
}

/* 支付方式 */
.pay-methods {
    margin-bottom: 1.25rem;
}

.pay-method-label {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.pay-method-options {
    display: flex;
    gap: 0.75rem;
}

.pay-method-item {
    flex: 1;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.pay-method-item.selected {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
    color: var(--primary-color);
    font-weight: 500;
}

/* 提示框 */
.alert {
    padding: 0.85rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* 结果页卡密显示 */
.result-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.result-header {
    text-align: center;
    padding: 1rem 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.25rem;
}

.result-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.result-icon.success {
    background: #d1fae5;
    color: var(--success-color);
}

.result-icon.fail {
    background: #fee2e2;
    color: var(--danger-color);
}

.result-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.result-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.card-mih {
    background: #fef3c7;
    border: 1px dashed #f59e0b;
    border-radius: 10px;
    padding: 1rem;
    margin: 1rem 0;
}

.card-mih-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.card-mih-content {
    font-family: "Consolas", "Monaco", monospace;
    font-size: 1rem;
    font-weight: 600;
    word-break: break-all;
    line-height: 1.8;
    color: #92400e;
    padding: 0.5rem;
    background: #fffbeb;
    border-radius: 6px;
    user-select: all;
}

.copy-btn {
    margin-top: 0.75rem;
    width: 100%;
}

/* 查询表单 */
.query-section {
    margin-top: 2rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    min-height: 44px;
    background: #fff;
}

.form-input:focus {
    border-color: var(--primary-color);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

/* 页脚 */
.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* 加载中 */
.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

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

/* 桌面端适配 */
@media (min-width: 768px) {
    .site-header {
        padding: 3rem 1rem 4rem;
    }
    .site-header h1 {
        font-size: 2rem;
    }
    .modal-overlay {
        align-items: center;
    }
    .modal-container {
        border-radius: 16px;
    }
}
