/* ─── 全局样式 ─────────────────────────────────────────────── */
:root {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

body {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ─── 卡片样式 ─────────────────────────────────────────────── */
.card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.card-header {
    border-bottom: none;
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* ─── 首页 ─────────────────────────────────────────────────── */
.hero-section {
    padding: 4rem 0;
    text-align: center;
}

.hero-section h1 {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.hero-section .lead {
    font-size: 1.2rem;
    color: #6b7280;
    max-width: 600px;
    margin: 0 auto 2rem;
}

.role-card {
    padding: 2.5rem 2rem;
    text-align: center;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.3s ease;
    height: 100%;
}

.role-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.role-card .icon-wrap {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2.5rem;
    color: #fff;
}

.role-card.merchant .icon-wrap {
    background: linear-gradient(135deg, var(--primary), #818cf8);
}

.role-card.customer .icon-wrap {
    background: linear-gradient(135deg, var(--success), #34d399);
}

.role-card h3 {
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.role-card p {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

/* ─── 统计卡片 ─────────────────────────────────────────────── */
.stat-card {
    padding: 1.5rem;
    border-radius: 16px;
    text-align: center;
    color: #fff;
}

.stat-card .stat-number {
    font-size: 2.2rem;
    font-weight: 800;
}

.stat-card .stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.stat-card.purple { background: linear-gradient(135deg, var(--primary), #818cf8); }
.stat-card.green { background: linear-gradient(135deg, var(--success), #34d399); }
.stat-card.orange { background: linear-gradient(135deg, var(--warning), #fbbf24); }
.stat-card.red { background: linear-gradient(135deg, var(--danger), #f87171); }

/* ─── 二维码展示 ─────────────────────────────────────────────── */
.qr-container {
    background: #fff;
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.qr-container img {
    max-width: 250px;
    height: auto;
}

.qr-code-text {
    font-family: 'Courier New', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--primary);
}

/* ─── 商品卡片 ─────────────────────────────────────────────── */
.product-card {
    padding: 0;
    overflow: hidden;
}

.product-card .product-body {
    padding: 1.25rem;
}

.product-card .product-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--danger);
}

.product-card .product-price::before {
    content: '¥';
    font-size: 1rem;
}

/* ─── 扫码区域 ─────────────────────────────────────────────── */
#scanner-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
}

#scanner-container video {
    width: 100%;
    border-radius: 12px;
}

/* ─── 按钮 ─────────────────────────────────────────────────── */
.btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
}

/* ─── 表单 ─────────────────────────────────────────────────── */
.form-control, .form-select {
    border-radius: 10px;
    border: 2px solid #e5e7eb;
    padding: 0.6rem 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* ─── 动画 ─────────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-in {
    animation: fadeInUp 0.4s ease-out;
}

/* ─── 结果区域 ─────────────────────────────────────────────── */
.result-box {
    padding: 1.5rem;
    border-radius: 12px;
    margin-top: 1rem;
}

.result-box.success {
    background: #ecfdf5;
    border: 2px solid #a7f3d0;
}

.result-box.error {
    background: #fef2f2;
    border: 2px solid #fecaca;
}

.result-box.info {
    background: #eff6ff;
    border: 2px solid #bfdbfe;
}

/* ─── Toast 通知 ───────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

/* ─── loading ──────────────────────────────────────────────── */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 1rem auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
