/* =====================
   自动发卡系统 - 前台样式
   ===================== */

:root {
  --primary: #6c63ff;
  --primary-dark: #5a52d5;
  --accent: #ff6584;
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-card2: #16213e;
  --border: rgba(108, 99, 255, 0.2);
  --text: #e8e8f0;
  --text-muted: #8888aa;
  --success: #4ade80;
  --warn: #facc15;
  --error: #f87171;
  --info: #60a5fa;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 4px 24px rgba(108, 99, 255, 0.12);
  --glow: 0 0 24px rgba(108, 99, 255, 0.3);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

/* ========= 容器 ========= */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ========= 导航栏 ========= */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 15, 26, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-links a {
  color: var(--text-muted);
  font-weight: 500;
  transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
}

/* ========= Hero ========= */
.hero {
  position: relative;
  overflow: hidden;
  padding: 100px 0 80px;
  text-align: center;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(108, 99, 255, 0.2) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(255, 101, 132, 0.12) 0%, transparent 60%);
}

.hero-content {
  position: relative;
}

.hero-content h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.7) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-content p {
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 36px;
}

.hero-btns {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ========= 按钮 ========= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 16px rgba(108, 99, 255, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(108, 99, 255, 0.5);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-buy {
  width: 100%;
  margin-top: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  padding: 10px;
}

.btn-buy:hover {
  transform: translateY(-2px);
  opacity: 0.9;
  color: #fff;
}

.btn-buy.disabled {
  background: #333;
  cursor: not-allowed;
}

.btn-full {
  width: 100%;
}

.btn-danger {
  background: var(--error);
  color: #fff;
}

/* ========= 公告栏 ========= */
.notice-bar {
  background: rgba(108, 99, 255, 0.1);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  font-size: 14px;
  color: var(--text-muted);
}

.notice-bar .container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.notice-icon {
  font-size: 16px;
}

/* ========= 主内容 ========= */
.main-content {
  padding: 48px 0 80px;
}

/* ========= Section Title ========= */
.section-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 24px;
  position: relative;
  padding-bottom: 12px;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
}

/* ========= 商品网格 ========= */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
  border-color: var(--primary);
}

.product-cover {
  height: 160px;
  background-size: cover;
  background-position: center;
}

.product-cover-default {
  background: linear-gradient(135deg, var(--bg-card2), rgba(108, 99, 255, 0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}

.product-info {
  padding: 20px;
}

.product-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.product-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.product-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

.product-stock {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
}

.in-stock {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
}

.out-stock {
  background: rgba(248, 113, 113, 0.15);
  color: var(--error);
}

/* ========= 特性 ========= */
.features-section {
  margin-top: 60px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.feature-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  transition: var(--transition);
}

.feature-item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 36px;
  margin-bottom: 16px;
}

.feature-item h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature-item p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ========= 页面小 Hero ========= */
.page-hero-sm {
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.1), rgba(255, 101, 132, 0.05));
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
}

.breadcrumb {
  font-size: 14px;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb span {
  margin: 0 8px;
}

/* ========= 商品详情 ========= */
.product-detail-wrap {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .product-detail-wrap {
    grid-template-columns: 1fr;
  }
}

.product-detail-card,
.order-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.product-detail-header {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  align-items: flex-start;
}

.product-detail-cover {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
}

.product-detail-title h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.product-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.price-tag {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.stock-badge {
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 20px;
}

.product-detail-desc h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.desc-content {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-muted);
}

.order-form-card h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 24px;
}

/* ========= 表单 ========= */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  transition: var(--transition);
  resize: vertical;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

/* 数量控制 */
.qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  width: 140px;
}

.qty-btn {
  width: 40px;
  height: 44px;
  background: rgba(108, 99, 255, 0.2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
}

.qty-btn:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.qty-btn:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.qty-btn:hover {
  background: var(--primary);
}

.qty-control input {
  border-radius: 0;
  border-left: none;
  border-right: none;
  text-align: center;
  width: 60px;
}

/* 支付方式选择 */
.payment-methods {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.pay-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.pay-option:hover {
  border-color: var(--primary);
}

.pay-option.active {
  border-color: var(--primary);
  background: rgba(108, 99, 255, 0.1);
}

.pay-option input {
  display: none;
}

.pay-name {
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 7px;
}

.pay-name svg {
  flex-shrink: 0;
  border-radius: 50%;
}

/* 订单小计 */
.order-summary {
  background: rgba(108, 99, 255, 0.1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.total-price {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

/* ========= 支付页 ========= */
.pay-page {
  padding: 40px 0 80px;
  max-width: 560px;
}

.pay-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.pay-header {
  margin-bottom: 24px;
}

.pay-header h2 {
  font-size: 22px;
  font-weight: 700;
}

.order-timer {
  font-size: 14px;
  color: var(--warn);
  margin-top: 8px;
}

#countdown {
  font-family: monospace;
  font-size: 18px;
  font-weight: 700;
}

.order-info-table {
  margin: 24px 0;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.info-row:last-child {
  border-bottom: none;
}

.info-row span {
  color: var(--text-muted);
  font-size: 14px;
}

.info-row strong {
  font-size: 14px;
}

.info-row.highlight strong {
  color: var(--primary);
}

.big-price {
  font-size: 24px !important;
}

.pay-method-display {
  margin: 16px 0;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius);
  font-size: 14px;
}

.qrcode-area {
  text-align: center;
  margin: 20px 0;
}

.qrcode-wrap img {
  max-width: 200px;
  border-radius: var(--radius);
}

.pay-actions {
  margin: 20px 0;
}

.pay-tips {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* ========= 查询页 ========= */
.query-wrap {
  max-width: 700px;
  margin: 0 auto;
}

.query-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
}

.query-form-card h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 24px;
}

.query-form .form-group {
  margin-bottom: 0;
}

.order-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.order-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.order-result-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.cards-delivery {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.cards-delivery h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
}

.cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.2);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.card-num {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
  flex-shrink: 0;
}

.card-data {
  font-family: monospace;
  font-size: 14px;
  flex: 1;
  word-break: break-all;
}

.copy-btn {
  flex-shrink: 0;
  background: rgba(74, 222, 128, 0.2);
  border: 1px solid rgba(74, 222, 128, 0.3);
  color: var(--success);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
}

.copy-btn:hover {
  background: rgba(74, 222, 128, 0.3);
}

.cards-tips {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 16px;
}

.pay-pending {
  text-align: center;
  padding: 20px 0;
}

.mono {
  font-family: monospace;
}

/* ========= 公告 ========= */
.notices-section {
  margin-bottom: 48px;
}

.notices-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notice-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.notice-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.notice-card p {
  font-size: 13px;
  color: var(--text-muted);
}

.notice-card small {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-top: 8px;
}

/* ========= 空状态 ========= */
.empty-state {
  text-align: center;
  padding: 60px 0;
}

.empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 15px;
}

/* ========= 提醒 ========= */
.alert {
  padding: 14px 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 14px;
}

.alert-success {
  background: rgba(74, 222, 128, 0.15);
  border: 1px solid rgba(74, 222, 128, 0.3);
  color: var(--success);
}

.alert-error {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--error);
}

/* ========= Badge ========= */
.badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.badge-success {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
}

.badge-error {
  background: rgba(248, 113, 113, 0.15);
  color: var(--error);
}

.badge-warn {
  background: rgba(250, 204, 21, 0.15);
  color: var(--warn);
}

.badge-info {
  background: rgba(96, 165, 250, 0.15);
  color: var(--info);
}

/* ========= 页脚 ========= */
.footer {
  margin-top: 60px;
  border-top: 1px solid var(--border);
  padding: 40px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.footer p+p {
  margin-top: 8px;
}

.footer a {
  color: var(--text-muted);
}

.footer a:hover {
  color: var(--primary);
}

/* ========= 响应式 ========= */
@media (max-width: 600px) {
  .hero {
    padding: 60px 0 40px;
  }

  .hero-content h1 {
    font-size: 1.8rem;
  }

  .products-grid {
    grid-template-columns: 1fr;
  }

  .features-grid {
    grid-template-columns: 1fr 1fr;
  }

  .pay-page {
    max-width: 100%;
  }
}