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

:root {
  --primary: #1a6fb5;
  --primary-dark: #155a8e;
  --primary-light: #e8f4fd;
  --success: #27ae60;
  --success-light: #eafaf1;
  --danger: #e74c3c;
  --danger-light: #fdf0ee;
  --warning: #f39c12;
  --warning-light: #fef9e7;
  --text: #2c3e50;
  --text-secondary: #5a6c7d;
  --text-light: #95a5a6;
  --border: #e0e6ed;
  --bg: #f5f7fa;
  --bg-white: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 0.25s ease;
}

html {
  font-size: 16px;
}

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

/* ========== 容器 ========== */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

/* ========== 头部 ========== */
.header {
  text-align: center;
  padding: 30px 0 20px;
}

.header .logo {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary), #2ecc71);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
  margin-bottom: 12px;
}

.header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

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

/* ========== 卡片 ========== */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon {
  width: 24px;
  height: 24px;
  background: var(--primary-light);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* ========== 表单 ========== */
.form-group {
  margin-bottom: 18px;
}

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

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-input,
.form-select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font-size: 0.95rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--bg-white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  font-family: inherit;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 111, 181, 0.12);
}

.form-input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

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

.form-hint {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 4px;
}

.form-error {
  font-size: 0.78rem;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}

.form-error.visible {
  display: block;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ========== 单选按钮组 ========== */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.radio-option:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.radio-option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
}

.radio-check {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 50%;
  margin-right: 12px;
  margin-top: 1px;
  flex-shrink: 0;
  position: relative;
  transition: all var(--transition);
}

.radio-option.selected .radio-check {
  border-color: var(--primary);
}

.radio-option.selected .radio-check::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
}

.radio-content {
  flex: 1;
}

.radio-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.radio-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.radio-price {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.05rem;
  white-space: nowrap;
}

/* ========== 信息确认区 ========== */
.confirm-section {
  background: var(--primary-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 20px;
}

.confirm-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 10px;
}

.confirm-list {
  list-style: none;
}

.confirm-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.88rem;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}

.confirm-item:last-child {
  border-bottom: none;
}

.confirm-label {
  color: var(--text-secondary);
}

.confirm-value {
  color: var(--text);
  font-weight: 500;
  text-align: right;
}

.confirm-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1.5px solid rgba(0, 0, 0, 0.1);
}

.confirm-total .label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.confirm-total .amount {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--danger);
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 28px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  font-family: inherit;
  width: 100%;
}

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

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

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(26, 111, 181, 0.3);
}

.btn-primary:disabled {
  background: #a0c4df;
  cursor: not-allowed;
  box-shadow: none;
}

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

.btn-success:hover {
  background: #219a52;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary-light);
}

.btn-sm {
  height: 36px;
  padding: 0 16px;
  font-size: 0.85rem;
  width: auto;
}

/* ========== 步骤指示器 ========== */
.steps {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-light);
}

.step .number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.step.active .number {
  background: var(--primary);
}

.step.done .number {
  background: var(--success);
}

.step .text {
  display: none;
}

@media (min-width: 480px) {
  .step .text {
    display: inline;
  }
}

.step-divider {
  width: 40px;
  height: 2px;
  background: var(--border);
  margin: 0 8px;
}

.step-divider.done {
  background: var(--success);
}

/* ========== 支付页面 ========== */
.pay-card {
  text-align: center;
}

.pay-amount {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--danger);
  margin: 8px 0 20px;
}

.pay-amount .symbol {
  font-size: 1.2rem;
}

.qr-container {
  display: inline-block;
  padding: 16px;
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 8px 0 16px;
}

.qr-container img {
  display: block;
}

.qr-placeholder {
  width: 280px;
  height: 280px;
  background: var(--bg);
  border: 3px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  color: var(--text-light);
}

.qr-placeholder .icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.pay-tips {
  margin-top: 16px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.8;
}

.pay-tips strong {
  color: var(--text);
}

.pay-status {
  margin-top: 20px;
  padding: 12px;
  border-radius: var(--radius);
  font-size: 0.88rem;
}

.pay-status.checking {
  background: var(--warning-light);
  color: var(--warning);
}

.pay-status.success {
  background: var(--success-light);
  color: var(--success);
  font-weight: 600;
}

/* ========== 成功页面 ========== */
.success-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--success), #2ecc71);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 36px;
  color: white;
  animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
  from {
    transform: scale(0);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.success-card {
  text-align: center;
  padding: 36px 24px;
}

.success-card h2 {
  font-size: 1.3rem;
  margin-bottom: 8px;
  color: var(--success);
}

.success-card .order-id {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-family: 'Courier New', monospace;
  background: var(--bg);
  padding: 6px 12px;
  border-radius: 4px;
  display: inline-block;
  margin: 8px 0;
}

.success-info {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
  text-align: left;
}

.success-info .row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 0.88rem;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.06);
}

.success-info .row:last-child {
  border-bottom: none;
}

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

.success-info .value {
  font-weight: 500;
  color: var(--text);
}

/* ========== 管理后台 ========== */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.admin-header h3 {
  font-size: 1.05rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.table-container {
  overflow-x: auto;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 900px;
}

thead {
  background: var(--bg);
}

th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.82rem;
  white-space: nowrap;
  border-bottom: 2px solid var(--border);
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--bg);
  color: var(--text);
}

tr:hover td {
  background: var(--primary-light);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-paid {
  background: var(--success-light);
  color: var(--success);
}

.badge-pending {
  background: var(--warning-light);
  color: var(--warning);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 8px;
}

/* ========== Toast通知 ========== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: var(--radius);
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  opacity: 1;
}

.toast-error {
  background: var(--danger);
}

.toast-success {
  background: var(--success);
}

.toast-info {
  background: var(--primary);
}

/* ========== 加载动画 ========== */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.btn .loading {
  width: 18px;
  height: 18px;
}

/* ========== 页脚 ========== */
.footer {
  text-align: center;
  padding: 16px;
  font-size: 0.78rem;
  color: var(--text-light);
}

/* ========== 响应式 ========== */
@media (max-width: 480px) {
  .container {
    padding: 12px 12px 40px;
  }

  .header {
    padding: 20px 0 12px;
  }

  .header h1 {
    font-size: 1.2rem;
  }

  .card {
    padding: 20px 16px;
    border-radius: var(--radius);
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .form-row .form-group {
    margin-bottom: 18px;
  }

  .stats {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ========== 打印样式 ========== */
@media print {
  .btn,
  .header,
  .footer {
    display: none;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
