/* ============================================================
   凌铭商行 — CSS 样式系统
   ============================================================ */

/* ===== CSS Variables ===== */
:root {
  --bg-primary: #0d0f1a;
  --bg-secondary: #151829;
  --bg-card: #1a1d30;
  --bg-card-hover: #1f2340;
  --bg-input: #12142a;
  --border: #2a2d45;
  --border-focus: #3A76E0;
  --text-primary: #e8e8f0;
  --text-secondary: #a0a4c0;
  --text-muted: #6a6d80;
  --accent: #3A76E0;
  --accent-gradient: linear-gradient(135deg, #3A76E0, #5b9cf5);
  --accent-glow: 0 0 20px rgba(58,118,224,0.3);
  --gold: #ffd700;
  --gold-gradient: linear-gradient(135deg, #ffd700, #ffb800);
  --red: #ff4d4f;
  --green: #52c41a;
  --orange: #fa8c16;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset ===== */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Loading ===== */
.loading-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg-primary);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.4s ease;
}
.loading-overlay.fade-out { opacity: 0; pointer-events: none; }
.spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Layout ===== */
.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

/* ===== Step Indicator ===== */
.step-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.step-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 2px solid var(--border);
  transition: var(--transition);
  cursor: pointer;
}
.step-dot.active {
  background: var(--accent); color: #fff;
  border-color: var(--accent);
  box-shadow: var(--accent-glow);
}
.step-dot.done {
  background: var(--green); color: #fff;
  border-color: var(--green);
}
.step-line {
  width: 40px; height: 2px;
  align-self: center;
  background: var(--border);
  border-radius: 1px;
  transition: var(--transition);
}
.step-line.done { background: var(--green); }

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  transition: var(--transition);
}
.card:hover { border-color: rgba(58,118,224,0.2); }
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 12px; margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none;
}
.card-header h3 { font-size: 16px; color: var(--text-primary); }
.card-header .arrow {
  color: var(--text-muted);
  transition: var(--transition);
  font-size: 12px;
}
.card-header .arrow.open { transform: rotate(180deg); }
.card-body { transition: var(--transition); }
.card-body.hidden { display: none; }

/* Hero Card */
.hero-card {
  text-align: center;
  padding: 32px 20px;
  background: linear-gradient(180deg, rgba(58,118,224,0.05) 0%, var(--bg-card) 100%);
}
.hero-logo {
  width: 80px; height: 80px;
  border-radius: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.hero-title {
  font-size: 28px; font-weight: 800;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

.ratio-image {
  cursor: pointer;
  max-width: 100%;
  border-radius: var(--radius);
  transition: var(--transition);
}
.ratio-image:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 15px; font-weight: 600;
  border: none; cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn:disabled {
  opacity: 0.5; cursor: not-allowed; transform: none;
  box-shadow: none;
}
.btn-primary { background: var(--accent-gradient); color: #fff; }
.btn-primary:hover { box-shadow: var(--accent-glow); }
.btn-gold { background: var(--gold-gradient); color: #1a1a1a; }
.btn-gold:hover { box-shadow: 0 0 20px rgba(255,215,0,0.3); }
.btn-outline {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
}
.btn-outline:hover { background: rgba(58,118,224,0.1); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-group {
  display: flex; gap: 12px; flex-wrap: wrap;
}

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 14px; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-label .required { color: var(--red); margin-left: 2px; }

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 15px;
  transition: var(--transition);
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(58,118,224,0.15);
}
input.error, select.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255,77,79,0.1);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236a6d80' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-hint {
  font-size: 12px; color: var(--text-muted);
  margin-top: 4px; min-height: 18px;
}
.form-hint.error { color: var(--red); }
.form-hint.success { color: var(--green); }

textarea { resize: vertical; min-height: 80px; }

/* ===== Picker Tabs ===== */
.picker-tabs {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.picker-tab {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: var(--transition);
  white-space: nowrap;
  user-select: none;
}
.picker-tab:hover { border-color: var(--accent); color: var(--text-primary); }
.picker-tab.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ===== Checkbox Group ===== */
.checkbox-group {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.checkbox-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  user-select: none;
}
.checkbox-item:hover { border-color: var(--accent); }
.checkbox-item.checked {
  background: rgba(58,118,224,0.15);
  border-color: var(--accent);
  color: #fff;
}
.checkbox-item input { display: none; }

/* ===== Notice Bar ===== */
.notice-bar {
  background: rgba(250,140,22,0.1);
  border: 1px solid rgba(250,140,22,0.3);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--orange);
  word-break: break-word;
  line-height: 1.8;
  white-space: pre-wrap;
}

/* ===== Divider ===== */
.divider {
  height: 1px; background: var(--border);
  margin: 16px 0;
}
.divider-text {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0;
  color: var(--text-muted); font-size: 13px;
}
.divider-text::before,
.divider-text::after {
  content: ""; flex: 1;
  height: 1px; background: var(--border);
}

/* ===== Value Box ===== */
.value-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
}
.value-box .label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.value-box .number {
  font-size: 22px; font-weight: 700;
  color: var(--gold);
}
.value-box .unit { font-size: 14px; color: var(--text-secondary); margin-left: 4px; }

.value-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

/* ===== Result Card ===== */
.result-card {
  background: linear-gradient(135deg, rgba(58,118,224,0.1), rgba(90,156,245,0.05));
  border: 1px solid rgba(58,118,224,0.3);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.result-card.warning {
  background: linear-gradient(135deg, rgba(255,77,79,0.1), rgba(255,77,79,0.02));
  border-color: rgba(255,77,79,0.3);
}

/* ===== Tip Toggle ===== */
.tip-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--accent); cursor: pointer;
  font-size: 12px; margin-left: 4px;
  user-select: none;
}
.tip-toggle:hover { text-decoration: underline; }
.tip-content {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  display: none;
  text-align: left;
}
.tip-content.show { display: block; }

/* ===== Toast ===== */
.toast-container {
  position: fixed; top: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  animation: toastIn 0.3s ease;
  pointer-events: auto;
  border: 1px solid var(--border);
  text-align: center;
  max-width: 360px;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.toast.error { border-color: var(--red); color: var(--red); }
.toast.success { border-color: var(--green); color: var(--green); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 420px; width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: none; }
}
.modal-title {
  font-size: 18px; font-weight: 700;
  margin-bottom: 12px;
  color: var(--gold);
}
.modal-content {
  color: var(--text-secondary);
  font-size: 14px; line-height: 1.8;
  margin-bottom: 20px;
  white-space: pre-wrap;
}
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; }

/* ===== Lightbox ===== */
.lightbox {
  position: fixed; inset: 0; z-index: 9500;
  background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.lightbox.hidden { display: none; }
.lightbox img {
  max-width: 90vw; max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius);
}
.lightbox-close {
  position: absolute; top: 20px; right: 20px;
  color: #fff; font-size: 30px;
  cursor: pointer;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  transition: var(--transition);
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }

/* ===== Canvas ===== */
.canvas-wrapper {
  position: relative; overflow: hidden;
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.canvas-wrapper canvas { display: block; max-width: 100%; }

/* ===== Page Transitions ===== */
.page { display: none; }
.page.active { display: block; animation: fadeSlideIn 0.35s ease; }
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ===== Navigation Tabs ===== */
.nav-tabs {
  display: flex; gap: 8px; margin-bottom: 20px;
  background: var(--bg-card);
  padding: 6px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow-x: auto;
}
.nav-tab {
  flex: 1; min-width: fit-content;
  text-align: center; padding: 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px; font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
  user-select: none;
}
.nav-tab:hover { color: var(--text-primary); }
.nav-tab.active {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: var(--accent-glow);
}

/* ===== History ===== */
.history-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 13px; color: var(--text-secondary);
}
.history-item .time {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
  margin-left: 8px;
}

/* ===== Customer Service Card ===== */
.cs-card {
  text-align: center;
  padding: 24px;
}
.cs-qrcode {
  width: 200px; height: 200px;
  object-fit: contain;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  margin-bottom: 12px;
}
.cs-wechat {
  font-size: 18px; font-weight: 700;
  color: var(--gold); margin-bottom: 8px;
}
.cs-label {
  font-size: 14px; color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ===== Admin ===== */
.admin-item {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  background: var(--bg-input);
  border-radius: var(--radius);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.admin-item .cs-name { font-weight: 700; min-width: 80px; }
.admin-item .status {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 20px;
}
.admin-item .status.working { background: rgba(82,196,26,0.15); color: var(--green); }
.admin-item .status.resting { background: rgba(255,77,79,0.15); color: var(--red); }
.admin-item .status.hidden-status { background: rgba(106,109,128,0.15); color: var(--text-muted); }
.admin-item input[type="number"] { width: 70px; text-align: center; }
.admin-item input[type="date"],
.admin-item input[type="time"] {
  width: auto;
  padding: 6px 10px;
  color-scheme: dark;
}

/* ===== Footer ===== */
.footer {
  text-align: center; padding: 24px;
  color: var(--text-muted); font-size: 12px;
  line-height: 2;
}
.footer a {
  color: var(--accent);
  text-decoration: none;
}
.footer a:hover { text-decoration: underline; }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .app-container { padding: 10px; }
  .nav-tabs { flex-wrap: nowrap; overflow-x: auto; gap: 4px; }
  .nav-tab { font-size: 12px; padding: 8px 6px; white-space: nowrap; }
  .hero-title { font-size: 22px; }
  .value-grid { grid-template-columns: repeat(2, 1fr); }
  .btn-group { flex-direction: column; }
  .btn-group .btn { width: 100%; }
  .card { padding: 14px; }
  .hero-card { padding: 20px 14px; }
  .modal { padding: 16px; margin: 10px; }
  .step-line { width: 24px; }
  .step-dot { width: 30px; height: 30px; font-size: 12px; }
  .picker-tabs { gap: 4px; }
  .picker-tab { padding: 6px 10px; font-size: 12px; }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .app-container { max-width: 700px; }
}

@media (min-width: 1025px) {
  .app-container { max-width: 900px; }
  .value-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ===== Print ===== */
@media print {
  body { background: #fff; color: #000; }
  .btn, .nav-tabs, .footer, .step-indicator { display: none; }
  .card { border: 1px solid #ccc; break-inside: avoid; }
}
