/* =========================================
   螃蟹兑换网站 - 全局样式表
   Crab Redemption Website - Global Styles
   ========================================= */

/* ---------- CSS Variables ---------- */
:root {
  --primary: #E85D3D;
  --primary-dark: #C94A2D;
  --primary-light: #F08060;
  --accent: #D94E1F;
  --bg: #FFF8F5;
  --card-bg: #FFFFFF;
  --text: #2D2D2D;
  --text-light: #666666;
  --text-muted: #999999;
  --border: #E8E0DC;
  --border-light: #F5EDE9;
  --success: #27AE60;
  --warning: #F39C12;
  --danger: #E74C3C;
  --info: #3498DB;
  --shadow-sm: 0 2px 8px rgba(232, 93, 61, 0.08);
  --shadow-md: 0 4px 16px rgba(232, 93, 61, 0.12);
  --shadow-lg: 0 8px 32px rgba(232, 93, 61, 0.16);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

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

a:hover {
  color: var(--primary-dark);
}

/* ---------- Layout ---------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Header / Navbar ---------- */
.site-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 0;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.site-logo:hover {
  color: rgba(255,255,255,0.9);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.nav-links li {
  flex-shrink: 0;        /* 防止单个导航项被挤压导致文字跳行 */
}

.nav-links a {
  color: rgba(255,255,255,0.9);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  transition: background-color 0.18s ease, color 0.18s ease;
  white-space: nowrap;
  display: inline-block;
}

.nav-links a:hover,
.nav-links a.active {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

/* ---------- Hero Banner ---------- */
.hero-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 50%, #C0392B 100%);
  color: #fff;
  text-align: center;
  padding: 60px 20px;
  position: relative;
  overflow: hidden;
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  animation: heroPulse 6s ease-in-out infinite;
}

@keyframes heroPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

.hero-emoji {
  font-size: 4rem;
  display: block;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.hero-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.hero-subtitle {
  font-size: 1rem;
  color: rgba(255,255,255,0.85);
  position: relative;
  z-index: 1;
}

/* ---------- Section Titles ---------- */
.section-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.section-subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 32px;
}

/* ---------- Product Cards ---------- */
.products-section {
  padding: 48px 0;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
  border: 1px solid var(--border-light);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.product-image {
  width: 100%;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  background: linear-gradient(135deg, #FFF0EB 0%, #FFE0D6 100%);
  position: relative;
}

.product-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

.product-info {
  padding: 16px 20px 20px;
}

.product-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.product-desc {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 12px;
  line-height: 1.5;
}

.product-code-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #FFF0EB;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 14px;
}

.btn-exchange {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  text-align: center;
  padding: 10px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

.btn-exchange:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, #A83D25 100%);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ---------- CTA Section ---------- */
.cta-section {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  padding: 48px 20px;
  text-align: center;
  color: #fff;
  margin-bottom: 0;
}

.cta-section h2 {
  color: #fff;
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.cta-section p {
  color: rgba(255,255,255,0.85);
  margin-bottom: 24px;
}

.cta-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.4;
}

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

.btn-primary:hover {
  background: #FFE0D6;
  color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.6);
}

.btn-outline:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-color: #fff;
}

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

.btn-danger:hover {
  background: #C0392B;
  color: #fff;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 1.05rem;
}

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
}

/* ---------- Form Styles ---------- */
.form-section {
  padding: 48px 0;
}

.form-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 32px 24px;
  max-width: 540px;
  margin: 0 auto;
  border: 1px solid var(--border-light);
}

.form-title {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.form-subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: 0.85rem;
  margin-bottom: 28px;
}

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

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

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--card-bg);
  transition: var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(232, 93, 61, 0.12);
}

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

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

.form-error {
  font-size: 0.78rem;
  color: var(--danger);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---------- Step Indicator ---------- */
.steps-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 32px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.step-item.active {
  color: var(--primary);
  font-weight: 700;
}

.step-item.done {
  color: var(--success);
}

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

.step-item.active .step-circle {
  background: var(--primary);
  color: #fff;
}

.step-item.done .step-circle {
  background: var(--success);
  color: #fff;
}

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

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

/* ---------- Alert / Success / Error ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.alert-success {
  background: #E8F8F0;
  color: #1A7A44;
  border: 1px solid #A8E6C8;
}

.alert-danger {
  background: #FDE8E8;
  color: #B83232;
  border: 1px solid #F5B8B8;
}

.alert-info {
  background: #E8F0FC;
  color: #2952A3;
  border: 1px solid #B8D0F5;
}

.alert-warning {
  background: #FEF8E8;
  color: #8A6000;
  border: 1px solid #F5E0A8;
}

/* ---------- Order Success Card ---------- */
.success-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 40px 24px;
  max-width: 540px;
  margin: 0 auto;
  text-align: center;
  border: 1px solid var(--border-light);
}

.success-icon {
  font-size: 4rem;
  display: block;
  margin-bottom: 16px;
}

.success-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 8px;
}

.success-desc {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.order-detail-card {
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: left;
  margin-bottom: 20px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.88rem;
}

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

.detail-label {
  color: var(--text-light);
  font-weight: 500;
  flex-shrink: 0;
}

.detail-value {
  color: var(--text);
  font-weight: 600;
  text-align: right;
  word-break: break-all;
  max-width: 60%;
}

/* ---------- Query Results ---------- */
.query-results {
  padding: 48px 0;
}

.order-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border-light);
  transition: var(--transition);
}

.order-card:hover {
  box-shadow: var(--shadow-md);
}

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.order-no {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-family: "Courier New", monospace;
}

.order-status {
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-0 {
  background: #FEF3E8;
  color: #B8600A;
}

.status-1 {
  background: #E8F8F0;
  color: #1A7A44;
}

.status-2 {
  background: #F5F5F5;
  color: #888;
}

.order-product {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 8px;
}

.order-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.order-info-item {
  font-size: 0.82rem;
  color: var(--text-light);
}

.order-info-item span {
  color: var(--text);
  font-weight: 600;
}

.express-info {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 10px;
  font-size: 0.85rem;
}

.express-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
}

/* 快递实时追踪详情 */
.express-tracking-detail {
  margin-top: 10px;
}

/* ============ 快递100 实时追踪时间线（用户截图样式） ============ */
.express-timeline {
  position: relative;
  padding: 4px 0 4px 0;
}

.express-timeline-item {
  position: relative;
  display: flex;
  gap: 12px;
  padding-bottom: 14px;
  min-height: 50px;
}

.express-timeline-item:last-child {
  padding-bottom: 0;
}

.express-timeline-dot {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #F0F2F5;
  border: 2px solid #DDD;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  z-index: 1;
  position: relative;
}

.express-timeline-item.latest .express-timeline-dot {
  background: linear-gradient(135deg, #E85D3D, #C94A2D);
  border-color: #E85D3D;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(232, 93, 61, 0.15);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(232, 93, 61, 0.15); }
  50% { box-shadow: 0 0 0 8px rgba(232, 93, 61, 0.05); }
}

.express-timeline-line {
  position: absolute;
  left: 15px;
  top: 32px;
  bottom: 0;
  width: 2px;
  background: #E5E7EB;
  z-index: 0;
}

.express-timeline-content {
  flex: 1;
  min-width: 0;
  padding-top: 4px;
}

.express-timeline-time {
  font-size: 0.72rem;
  color: #999;
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  margin-bottom: 3px;
}

.express-timeline-text {
  font-size: 0.85rem;
  color: #555;
  line-height: 1.5;
  word-break: break-all;
}

.express-timeline-item.latest .express-timeline-text {
  color: #222;
  font-weight: 600;
}

.express-timeline-item.latest .express-timeline-time {
  color: var(--primary);
  font-weight: 600;
}

/* ---------- Admin Layout ---------- */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
  background: #F0F2F5;
}

.admin-sidebar {
  width: 220px;
  background: linear-gradient(180deg, #2C3E50 0%, #1A252F 100%);
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 200;
  flex-shrink: 0;
}

.admin-sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  text-align: center;
}

.admin-sidebar-header .logo-text {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}

.admin-sidebar-header .logo-sub {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}

.admin-nav {
  list-style: none;
  padding: 12px 0;
}

.admin-nav-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: rgba(255,255,255,0.7);
  font-size: 0.88rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: var(--transition);
  text-decoration: none;
}

.admin-nav-item a:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.admin-nav-item.active a {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-left-color: var(--primary);
}

.admin-nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.admin-main {
  margin-left: 220px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  background: #fff;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-topbar-left {
  font-size: 0.9rem;
  color: var(--text-light);
  font-weight: 500;
}

.admin-topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-content {
  padding: 24px;
  flex: 1;
}

/* ---------- Admin Dashboard Cards ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-light);
  font-weight: 500;
}

.stat-card.primary .stat-value { color: var(--primary); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.info .stat-value { color: var(--info); }

/* ---------- Admin Tables ---------- */
.admin-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.admin-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.admin-table-wrapper {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th {
  background: #F8F9FA;
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  color: var(--text);
  border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
}

.admin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover td {
  background: #FFFAF8;
}

.admin-table .mono {
  font-family: "Courier New", monospace;
  font-size: 0.82rem;
}

/* ---------- Status Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-pending { background: #FEF3E8; color: #B8600A; }
.badge-shipped { background: #E8F8F0; color: #1A7A44; }
.badge-cancelled { background: #F0F0F0; color: #888; }
.badge-unused { background: #E8F0FC; color: #2952A3; }
.badge-used { background: #E8F8F0; color: #1A7A44; }
.badge-invalid { background: #FDE8E8; color: #B83232; }

/* ---------- Filter Bar ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-select {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text);
  background: var(--card-bg);
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.filter-select:focus {
  border-color: var(--primary);
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-light);
  text-decoration: none;
  transition: var(--transition);
}

.pagination a:hover {
  background: var(--border-light);
  color: var(--primary);
}

.pagination .active {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

/* ---------- Modal ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

.modal-close {
  float: right;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
}

.modal-close:hover {
  color: var(--text);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ---------- Footer ---------- */
.site-footer {
  background: #2C3E50;
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 20px;
  font-size: 0.82rem;
}

.site-footer a {
  color: rgba(255,255,255,0.8);
}

.site-footer a:hover {
  color: #fff;
}

/* ---------- Code Input ---------- */
.code-input-group {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.code-input-group .form-input {
  flex: 1;
  font-family: "Courier New", monospace;
  font-size: 1.1rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.scratch-card {
  background: linear-gradient(135deg, #2C3E50 0%, #34495E 100%);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  margin-bottom: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.scratch-text {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 6px;
  color: #E85D3D;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  font-family: "Courier New", monospace;
}

.scratch-hint {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.6);
  margin-top: 6px;
}

/* ---------- Loading ---------- */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(255,255,255,0.8);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
}

.loading-overlay.active {
  display: flex;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 16px;
    gap: 8px;
  }

  /* 窄屏导航：不换行，水平滚动（避免出现「文字跳到第二行」） */
  .nav-links {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;          /* Firefox */
    padding-bottom: 4px;
    width: 100%;
  }
  .nav-links::-webkit-scrollbar { display: none; }  /* Chrome/Safari */

  .nav-links li {
    flex-shrink: 0;
  }

  .nav-links a {
    max-width: none;            /* 移动端不再截断（横滚保证完整可见） */
  }

  .hero-banner {
    padding: 40px 20px;
  }

  .hero-emoji {
    font-size: 3rem;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .form-card {
    padding: 24px 16px;
    border-radius: var(--radius-lg);
  }

  .admin-sidebar {
    width: 60px;
    overflow: visible;
  }

  .admin-sidebar-header .logo-text,
  .admin-sidebar-header .logo-sub,
  .admin-nav-item a span {
    display: none;
  }

  .admin-sidebar-header {
    padding: 14px 8px;
    text-align: center;
  }

  .admin-nav-item a {
    justify-content: center;
    padding: 12px 8px;
    border-left: none;
    border-bottom: 2px solid transparent;
  }

  .admin-nav-item.active a {
    border-left: none;
    border-bottom-color: var(--primary);
  }

  .admin-main {
    margin-left: 60px;
  }

  .admin-content {
    padding: 12px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-table-wrapper {
    font-size: 0.78rem;
  }

  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }

  .order-info-grid {
    grid-template-columns: 1fr;
  }

  .detail-value {
    max-width: 55%;
  }

  .modal {
    padding: 20px 16px;
  }

  .filter-bar {
    width: 100%;
  }

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

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .products-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Print / Utility ---------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.hidden { display: none !important; }

/* ============================================
 * 防导航闪烁机制（与 head 同步脚本配合）
 * ============================================ */
/* 重要：不再让 nav 文字"首次透明"——这样 fetch 失败时文字永久不可见（用户反馈过此问题）。
 * 现在策略：
 *   1. head 同步脚本立即给 .nav-links 加 .nav-ready，让 nav 文字永远可见（用 HTML 静态值）
 *   2. JS fetch 完成后，如果后端值与 HTML 不一致，再平滑替换
 *   3. 二次访问：head 脚本先用 localStorage 覆盖 HTML 静态值，再加 nav-ready → 文字立即正确显示
 */
.nav-links a {
  color: rgba(255, 255, 255, 0.9);
  transition: color 0.15s ease;
}
/* 当 fetch 完成后，nav-ready 仍生效；保留此选择器用于未来扩展 */
.nav-links.nav-ready a {
  color: rgba(255, 255, 255, 0.9);
}
