/* ===== 全局样式 - 暗黑主题 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* 主色调 - 暗夜蓝紫 */
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-dim: rgba(99, 102, 241, 0.15);

    /* 文本 */
    --text: #e4e6eb;
    --text-light: #9ca3af;
    --text-lighter: #6b7280;

    /* 背景 */
    --bg: #0f1115;
    --bg-soft: #14171c;
    --bg-card: #1a1d24;
    --bg-elevated: #1f232b;
    --bg-input: #14171c;

    /* 边框 */
    --border: #2a2e37;
    --border-light: #1f232b;
    --border-hover: #3a3f4a;

    /* 状态色 */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* 形状 */
    --radius: 12px;
    --radius-sm: 8px;

    /* 阴影 - 暗黑主题用更深的投影 */
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
    --glow-primary: 0 0 20px rgba(99, 102, 241, 0.3);

    --transition: all 0.2s ease;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
    background: var(--bg);
    background-image:
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(168, 85, 247, 0.06) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-hover); }

img { max-width: 100%; height: auto; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ===== 顶部导航 ===== */
.header {
    background: rgba(20, 23, 28, 0.85);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-logo {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-logo:hover { opacity: 0.85; }

.header-nav { display: flex; gap: 4px; align-items: center; }
.header-nav a {
    color: var(--text-light);
    font-size: 14px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.header-nav a:hover { background: var(--bg-elevated); color: var(--text); }

/* ===== 主容器 ===== */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px;
    flex: 1;
    width: 100%;
}

.container-sm {
    max-width: 540px;
    margin: 0 auto;
    padding: 32px 16px;
    flex: 1;
    width: 100%;
}

/* ===== 首页公告 ===== */
.notice {
    background: linear-gradient(135deg, var(--primary-dim) 0%, rgba(99, 102, 241, 0.05) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius);
    padding: 14px 18px;
    font-size: 14px;
    color: var(--primary-hover);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.notice-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

/* ===== 商品列表 ===== */
.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
    letter-spacing: -0.01em;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
}
.product-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}
.product-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md), var(--glow-primary);
    transform: translateY(-2px);
}
.product-card:hover::before { transform: scaleX(1); }

.product-image {
    width: 100%;
    height: 140px;
    background: var(--bg-soft);
    border-radius: var(--radius-sm);
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-lighter);
    font-size: 13px;
    overflow: hidden;
}
.product-image img {
    width: 100%; height: 100%; object-fit: cover;
}
.product-image-placeholder {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}

.product-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
}
.product-desc {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 40px;
}
.product-price {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #f87171 0%, #fbbf24 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: auto;
}

/* ===== 商品详情页 ===== */
.product-detail {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
}
.product-detail-header {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.product-detail-image {
    width: 200px;
    height: 200px;
    background: var(--bg-soft);
    border-radius: var(--radius);
    object-fit: cover;
    flex-shrink: 0;
    overflow: hidden;
}
.product-detail-image img { width: 100%; height: 100%; object-fit: cover; }
.product-detail-info { flex: 1; min-width: 240px; }
.product-detail-info h1 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
    letter-spacing: -0.01em;
}
.product-detail-price {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #f87171 0%, #fbbf24 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 12px 0;
}
.product-detail-desc {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.7;
    background: var(--bg-soft);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

/* ===== 表单 ===== */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}
.form-card h2 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}

.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 8px;
}
.form-label .required { color: var(--danger); }

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--bg-input);
    color: var(--text);
    transition: var(--transition);
    font-family: inherit;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-lighter); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.form-textarea { resize: vertical; min-height: 100px; }
.form-input:disabled { background: var(--bg-soft); color: var(--text-light); opacity: 0.7; }

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 36px;
}

/* 验证码 */
.captcha-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}
.captcha-row .form-input { flex: 1; }
.captcha-img {
    width: 120px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--bg-soft);
}

/* 支付方式 */
.payment-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.payment-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-input);
}
.payment-option:hover { border-color: var(--primary); }
.payment-option input { position: absolute; opacity: 0; }
.payment-option.checked {
    border-color: var(--primary);
    background: var(--primary-dim);
}
/* 维护中状态：禁用、置灰、显示徽章 */
.payment-option-disabled {
    cursor: not-allowed;
    opacity: 0.5;
    filter: grayscale(0.6);
    border-style: dashed;
}
.payment-option-disabled:hover { border-color: var(--border); }
.payment-option-disabled .payment-option-icon { opacity: 0.6; }
.payment-option-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    font-size: 11px;
    line-height: 1.5;
    color: #fff;
    background: #f59e0b;
    border-radius: 4px;
    vertical-align: middle;
    font-weight: 500;
}
.payment-option-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 18px;
    font-weight: 600;
    flex: 0 0 32px;
    line-height: 1;
}
.payment-option-icon svg { display: block; }
.payment-option-icon.wechat { background: #07c160; }
.payment-option-icon.alipay { background: #1677ff; }
.payment-option-name { font-size: 14px; font-weight: 500; color: var(--text); }

/* 内联支付标签（订单详情/查询/管理后台等位置使用） */
.pay-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    vertical-align: middle;
}
.pay-label-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    color: #fff;
    flex: 0 0 22px;
    line-height: 1;
}
.pay-label-icon svg { display: block; }
.pay-label-icon.pay-wechat { background: #07c160; }
.pay-label-icon.pay-alipay { background: #1677ff; }
.pay-label-name { font-weight: 500; }
/* 等待页/查询页内联场景：图标稍小，无背景色（直接用品牌色描边） */
.pay-inline .pay-label-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    border-radius: 4px;
}
.pay-inline .pay-label-name { font-weight: 500; }

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover {
    background: var(--primary-hover);
    color: #fff;
    box-shadow: var(--glow-primary);
    transform: translateY(-1px);
}
.btn-block { width: 100%; }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #059669; box-shadow: 0 0 20px rgba(16, 185, 129, 0.3); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; box-shadow: 0 0 20px rgba(239, 68, 68, 0.3); }
.btn-warning { background: var(--warning); color: #1a1a1a; }
.btn-warning:hover { background: #d97706; color: #1a1a1a; }
.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    background: var(--bg-elevated);
    color: var(--text);
    border-color: var(--border-hover);
}
.btn-outline.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ===== 等待页 ===== */
.waiting-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.waiting-card::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.05) 0%, transparent 70%);
    animation: pulse-bg 4s ease-in-out infinite;
    /* ★ 装饰层不参与点击事件，否则会盖住按钮导致点击无反应 */
    pointer-events: none;
    z-index: 0;
}
/* 兜底：waiting-card 内所有交互元素强制置顶，防止被 ::before 装饰层遮挡 */
.waiting-card > * {
    position: relative;
    z-index: 1;
}
@keyframes pulse-bg {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}
.waiting-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    background: var(--primary-dim);
    color: var(--primary);
    position: relative;
    z-index: 1;
}
.waiting-icon.spinning::before {
    content: '';
    position: absolute;
    inset: -4px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.waiting-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
    position: relative;
    z-index: 1;
}
.waiting-text {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}
.waiting-order {
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
    background: var(--bg-soft);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-light);
    display: inline-block;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    position: relative;
    z-index: 1;
}

/* ===== 倒计时区块 ===== */
.countdown-block {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 24px;
    margin: 16px auto;
    max-width: 320px;
    position: relative;
    z-index: 1;
}
.countdown-block.countdown-urgent {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.08);
}
.countdown-block.countdown-critical {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    animation: countdown-pulse 1s ease-in-out infinite;
}
.countdown-block.countdown-expired {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
    opacity: 0.7;
}
@keyframes countdown-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}
.countdown-label {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.countdown-timer {
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    letter-spacing: 0.05em;
}
.countdown-urgent .countdown-timer { color: var(--warning); }
.countdown-critical .countdown-timer { color: var(--danger); }
.countdown-expired .countdown-timer { color: var(--danger); text-decoration: line-through; }
.countdown-hint {
    font-size: 11px;
    color: var(--text-lighter);
    margin-top: 8px;
}

/* 状态徽章 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    border: 1px solid transparent;
}
.badge-pending { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border-color: rgba(245, 158, 11, 0.3); }
.badge-matched { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border-color: rgba(59, 130, 246, 0.3); }
.badge-paid { background: rgba(168, 85, 247, 0.15); color: #c084fc; border-color: rgba(168, 85, 247, 0.3); }
.badge-completed { background: rgba(16, 185, 129, 0.15); color: #34d399; border-color: rgba(16, 185, 129, 0.3); }
.badge-cancelled { background: rgba(239, 68, 68, 0.15); color: #f87171; border-color: rgba(239, 68, 68, 0.3); }

/* 二维码展示 */
.qr-display {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin: 20px 0;
}
.qr-image {
    max-width: 280px;
    width: 100%;
    margin: 0 auto;
    display: block;
    border-radius: var(--radius-sm);
    background: #fff;
    box-shadow: var(--shadow-md);
    padding: 8px;
}
.qr-tip {
    text-align: center;
    margin-top: 14px;
    font-size: 13px;
    color: var(--text-light);
}

/* ===== 订单查询结果 ===== */
.order-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 14px;
    transition: var(--transition);
}
.order-card:hover { border-color: var(--border-hover); }
.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.order-no {
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    color: var(--text-light);
}
.order-time { font-size: 12px; color: var(--text-lighter); }
.order-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}
.order-row .label { color: var(--text-light); }
.order-row .value { color: var(--text); font-weight: 500; text-align: right; }

.card-content {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-top: 14px;
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    color: #fbbf24;
    word-break: break-all;
    white-space: pre-wrap;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}
.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

/* 提示消息 */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
}
.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}
.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}
.alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.3);
}
.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
}

/* ===== 页脚 ===== */
.footer {
    border-top: 1px solid var(--border);
    background: rgba(20, 23, 28, 0.5);
    padding: 20px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-lighter);
    backdrop-filter: blur(8px);
}

/* ===== 响应式 ===== */
@media (max-width: 640px) {
    .header-inner { padding: 0 14px; height: 52px; }
    .header-logo { font-size: 16px; }
    .header-nav a { padding: 6px 8px; font-size: 13px; }
    .container { padding: 16px 14px; }
    .product-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .product-card { padding: 14px; }
    .product-name { font-size: 14px; }
    .product-price { font-size: 16px; }
    .product-detail { padding: 20px 16px; }
    .product-detail-image { width: 100%; height: 200px; }
    .product-detail-info h1 { font-size: 18px; }
    .product-detail-price { font-size: 24px; }
    .payment-options { grid-template-columns: 1fr; }
    .form-card { padding: 18px 16px; }
    .btn-lg { padding: 13px 20px; font-size: 14px; }
    .waiting-card { padding: 32px 18px; }
    .countdown-block { padding: 14px 18px; }
    .countdown-timer { font-size: 28px; }
}

@media (max-width: 380px) {
    .product-grid { grid-template-columns: 1fr; }
}

/* 强制 reduced-motion 用户的动画降级 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
