@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600&display=swap");

:root {
  --bg: #0f141b;
  --card: #151c26;
  --text: #e6edf6;
  --muted: #91a0b3;
  --accent: #5cc8ff;
  --danger: #ff6b6b;
  --ok: #6ee7b7;
  --border: #263245;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at top, #1a2636 0%, #0f141b 60%);
  color: var(--text);
  min-height: 100vh;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

h1,
h2 {
  margin: 0 0 12px;
}

label {
  display: block;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 6px;
}

input,
button,
textarea {
  font: inherit;
}

input,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0c1118;
  color: var(--text);
}

button {
  background: var(--accent);
  color: #0b1118;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

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

.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #1f2b3b;
  color: var(--muted);
}

.status-active {
  background: rgba(94, 234, 212, 0.15);
  color: var(--ok);
}

.status-expired {
  background: rgba(255, 107, 107, 0.2);
  color: var(--danger);
}

.list {
  display: grid;
  gap: 12px;
}

.qr-box {
  width: 260px;
  height: 260px;
  background: #0b1118;
  border: 1px solid var(--border);
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
}

.qr-box img {
  width: 240px;
  height: 240px;
  object-fit: contain;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.inline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.code {
  background: #0c1118;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  word-break: break-all;
  font-family: "SFMono-Regular", "JetBrains Mono", monospace;
  font-size: 13px;
}

.hidden {
  display: none;
}

.scan-wrapper {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  background: #0b1118;
  border: 1px solid var(--border);
}

.scan-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scan-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 3px solid #00e676;
}

.scan-corner.tl {
  top: 16px;
  left: 16px;
  border-right: none;
  border-bottom: none;
}

.scan-corner.tr {
  top: 16px;
  right: 16px;
  border-left: none;
  border-bottom: none;
}

.scan-corner.bl {
  bottom: 16px;
  left: 16px;
  border-right: none;
  border-top: none;
}

.scan-corner.br {
  bottom: 16px;
  right: 16px;
  border-left: none;
  border-top: none;
}

.scan-line {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 16px;
  height: 2px;
  background: #00e676;
  opacity: 0;
}

.scan-line.active {
  opacity: 1;
  animation: scanLine 1.6s ease-in-out infinite;
}

.scan-tip {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
}

@keyframes scanLine {
  0% {
    top: 16px;
    opacity: 0.2;
  }
  50% {
    top: calc(100% - 16px);
    opacity: 1;
  }
  100% {
    top: 16px;
    opacity: 0.2;
  }
}

body.admin-page {
  --bg: #f3eee5;
  --card: rgba(255, 255, 255, 0.88);
  --text: #221a12;
  --muted: #6b6157;
  --accent: #ff7a45;
  --accent-strong: #f0552f;
  --danger: #e5484d;
  --ok: #2aa97b;
  --border: rgba(46, 34, 23, 0.16);
  background: radial-gradient(900px circle at 10% 15%, #ffe8cf 0%, #f5efe5 45%, #eee7dc 100%);
  color: var(--text);
  font-family: "Space Grotesk", "IBM Plex Sans", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  position: relative;
  overflow-x: hidden;
}

body.admin-page::before,
body.admin-page::after {
  content: "";
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  z-index: -1;
}

body.admin-page::before {
  top: -220px;
  left: -140px;
  background: radial-gradient(circle at top, #ffd4b8 0%, transparent 70%);
}

body.admin-page::after {
  bottom: -240px;
  right: -160px;
  background: radial-gradient(circle at top, #b8dcff 0%, transparent 70%);
}

.admin-page .container {
  max-width: 1100px;
}

.admin-page .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 50px rgba(34, 26, 18, 0.12);
  animation: adminFadeUp 0.7s ease both;
  animation-delay: var(--delay, 0s);
}

.admin-page h1 {
  font-size: 32px;
  letter-spacing: -0.02em;
}

.admin-page h2 {
  font-size: 20px;
}

.admin-page label {
  color: var(--muted);
  font-weight: 500;
}

.admin-page input,
.admin-page textarea,
.admin-page select {
  background: #f8f4ee;
  border: 1px solid rgba(37, 28, 19, 0.16);
  color: var(--text);
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.admin-page select {
  width: 100%;
  padding: 10px 36px 10px 12px;
  border-radius: 8px;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5L6 6.5L11 1.5' stroke='%23514236' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
}

.admin-page input:focus,
.admin-page textarea:focus,
.admin-page select:focus {
  outline: none;
  border-color: rgba(255, 122, 69, 0.7);
  box-shadow: 0 0 0 3px rgba(255, 122, 69, 0.18);
}

.admin-page button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #24160e;
  border: 1px solid rgba(34, 26, 18, 0.12);
  box-shadow: 0 10px 18px rgba(255, 122, 69, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.admin-page button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 22px rgba(255, 122, 69, 0.32);
}

.admin-page button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(38, 28, 20, 0.2);
  box-shadow: none;
}

.admin-page button.ghost {
  background: rgba(255, 255, 255, 0.6);
  color: var(--text);
  border: 1px dashed rgba(38, 28, 20, 0.25);
  box-shadow: none;
}

.admin-page button.danger {
  background: #f06b6b;
  color: #fff;
  border: none;
  box-shadow: 0 10px 18px rgba(240, 107, 107, 0.28);
}

.admin-page .muted {
  color: var(--muted);
}

.admin-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.95), rgba(255, 239, 223, 0.7));
  border: 1px solid rgba(255, 130, 86, 0.35);
}

.hero-eyebrow {
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #b35322;
  font-weight: 700;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.hero-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(179, 83, 34, 0.3);
  background: rgba(255, 229, 206, 0.7);
  color: #b35322;
  font-weight: 600;
}

.hero-stats {
  display: grid;
  gap: 12px;
  min-width: 220px;
}

.stat {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(46, 34, 23, 0.12);
  border-radius: 14px;
  padding: 12px 14px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 16px;
  font-weight: 600;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.toolbar {
  justify-content: space-between;
  align-items: center;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hint {
  background: rgba(255, 239, 223, 0.7);
  border: 1px dashed rgba(179, 83, 34, 0.25);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  color: #8a4a26;
}

.field-toggle {
  display: grid;
  gap: 10px;
}

.field-toggle-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field-toggle-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.field-toggle-status {
  font-size: 12px;
  font-weight: 600;
  color: #9a8f82;
}

.field-toggle:has(.toggle-switch input:checked) .field-toggle-status {
  color: #b35322;
}

.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 46px;
  height: 28px;
  cursor: pointer;
}

.toggle-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(37, 28, 19, 0.14);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(37, 28, 19, 0.18);
  transition: transform 0.2s ease;
}

.toggle-switch input:checked + .toggle-track {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: inset 0 0 0 1px rgba(34, 26, 18, 0.08);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(18px);
}

.toggle-switch input:focus-visible + .toggle-track {
  box-shadow: 0 0 0 3px rgba(255, 122, 69, 0.18);
}

.admin-page .badge {
  background: rgba(255, 233, 214, 0.8);
  color: #8a4a26;
}

.admin-page .status-active {
  background: rgba(42, 169, 123, 0.18);
  color: var(--ok);
}

.admin-page .status-expired {
  background: rgba(229, 72, 77, 0.18);
  color: var(--danger);
}

.admin-page .type-pp {
  background: rgba(255, 210, 139, 0.6);
  color: #8a4a26;
}

.admin-page .type-dp {
  background: rgba(0, 60, 106, 0.12);
  color: #003c6a;
}

.admin-page .type-hy {
  background: rgba(184, 220, 255, 0.6);
  color: #1f4a77;
}

.admin-page .type-zx {
  background: rgba(200, 16, 46, 0.12);
  color: #a30f24;
}

.admin-page .list {
  gap: 16px;
}

.session-card {
  display: grid;
  gap: 16px;
}

.session-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.session-title {
  font-size: 18px;
  font-weight: 600;
}

.session-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.session-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.session-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px 16px;
}

.meta-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9a8f82;
}

.meta-value {
  font-size: 14px;
  margin-top: 4px;
}

.link-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  background: rgba(249, 243, 235, 0.8);
  border: 1px dashed rgba(46, 34, 23, 0.18);
  border-radius: 12px;
  padding: 10px 12px;
}

.link-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.link-block {
  flex: 1;
  min-width: 220px;
}

.admin-page .code {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(46, 34, 23, 0.12);
  color: #3a2b1f;
}

.link-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.session-edit {
  margin-top: 12px;
  border-top: 1px dashed rgba(46, 34, 23, 0.12);
  padding-top: 10px;
}

.session-edit summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
  user-select: none;
}

.session-edit[open] summary {
  margin-bottom: 12px;
}

.create-row {
  align-items: end;
}

.session-edit-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(46, 34, 23, 0.08);
}

.session-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  align-items: end;
}

.session-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.empty-state {
  padding: 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px dashed rgba(46, 34, 23, 0.18);
  color: var(--muted);
  text-align: center;
}

@keyframes adminFadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 840px) {
  .admin-hero {
    flex-direction: column;
  }

  .hero-stats {
    width: 100%;
  }

  .session-controls {
    grid-template-columns: 1fr;
  }

  .session-edit-footer {
    justify-content: flex-end;
  }
}

.lang-tab {
  opacity: 0.5;
  transition: opacity 0.2s, background 0.2s;
  font-weight: 500;
}
.lang-tab.active {
  opacity: 1;
  background: rgba(94, 234, 212, 0.15);
  color: var(--ok);
}
