/* Yuanheng site admin — Chinese maintenance console */
:root {
  --bg: #f2f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --navy: #0b1730;
  --navy-800: #122447;
  --primary: #0d6ebd;
  --primary-d: #0a5594;
  --teal: #0d9488;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --ok: #166534;
  --ok-bg: #ecfdf5;
  --warn-bg: #fff8e6;
  --warn: #8a5a00;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 6px 20px rgba(15, 23, 42, 0.07);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --focus-ring: 0 0 0 3px rgba(13, 110, 189, 0.35);
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --topbar-h: 3.4rem;
  --savebar-h: 4.75rem;
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 16px;
  padding-bottom: calc(var(--savebar-h) + 2.5rem);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(13, 110, 189, 0.2);
  color: var(--text);
}

button, input, select, textarea { font: inherit; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(13, 110, 189, 0.12), transparent 60%),
    var(--bg);
}

.login-card {
  width: min(400px, 100%);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 1.85rem;
  display: grid;
  gap: 0.9rem;
}

.login-card h1 {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--navy);
}

.login-card label {
  display: grid;
  gap: 0.4rem;
  font-weight: 600;
  color: #334155;
}

.login-card input {
  padding: 0.8rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-card input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--topbar-h);
  padding: 0.75rem 1.15rem;
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(45, 212, 191, 0.12);
  box-shadow: 0 4px 16px rgba(7, 15, 28, 0.18);
}

.topbar strong {
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.topbar-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.main.single-form {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.15rem 1.1rem 2rem;
  display: grid;
  gap: 1.1rem;
}

.block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.2rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.block.quiet {
  background: transparent;
  box-shadow: none;
  border-style: dashed;
}

.block h2 {
  margin: 0 0 0.65rem;
  font-size: 1.12rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--navy);
}

.block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.block-head h2 { margin: 0; }

.hint {
  color: var(--muted);
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  line-height: 1.55;
}

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

.empty {
  color: var(--muted);
  margin: 0.5rem 0;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  font-size: 0.92rem;
}

.form-simple {
  display: grid;
  gap: 0.85rem;
}

.form-simple.narrow { max-width: 360px; }

.form-simple label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: #334155;
  line-height: 1.35;
}

.form-simple input,
.form-simple select,
.form-simple textarea {
  width: 100%;
  padding: 0.78rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  line-height: 1.4;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-simple input:hover,
.form-simple select:hover,
.form-simple textarea:hover {
  border-color: #cbd5e1;
}

.form-simple input:focus,
.form-simple select:focus,
.form-simple textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

.form-simple textarea { resize: vertical; min-height: 4.5rem; }

.check {
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  grid-template-columns: none !important;
  font-weight: 600;
}

.check input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--primary);
}

.more-opts {
  margin-top: 0.2rem;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.9rem 0.85rem;
}

.more-opts summary {
  cursor: pointer;
  font-weight: 700;
  color: #475569;
  font-size: 0.92rem;
  line-height: 1.4;
  list-style-position: outside;
}

.more-opts summary:hover { color: var(--primary); }

.more-opts[open] summary {
  margin-bottom: 0.75rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line);
}

.more-opts label { margin-top: 0.6rem; }

.paypal-box {
  margin-top: 0.75rem;
  padding: 0.85rem;
  background: var(--warn-bg);
  border-radius: var(--radius-sm);
  border: 1px solid #f5e6b8;
}

.warn {
  color: var(--warn);
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
  line-height: 1.5;
}

.simple-list {
  display: grid;
  gap: 0.5rem;
}

.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: 100%;
  text-align: left;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfc;
  cursor: pointer;
  font-weight: 600;
  line-height: 1.35;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.list-row:hover {
  border-color: #b6d0ef;
  background: #f3f8fe;
}

.list-row:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.list-row.active {
  border-color: var(--primary);
  background: #e8f1fb;
  box-shadow: inset 3px 0 0 var(--primary);
}

.list-name { flex: 1; min-width: 0; }
.list-price {
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.editor-sheet {
  margin-top: 0.9rem;
  padding: 1.1rem;
  border: 2px solid #cfe0f5;
  border-radius: var(--radius);
  background: #f7fbff;
  box-shadow: var(--shadow-sm);
}

.editor-sheet h3 {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--navy);
}

.row-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 0.45rem;
}

.video-rows { display: grid; gap: 0.75rem; }

.video-row {
  display: grid;
  gap: 0.6rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfc;
}

.video-row .btn-del { justify-self: start; }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  line-height: 1.25;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover { background: #f8fafc; border-color: #cbd5e1; }

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

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

.btn.primary:hover {
  background: var(--primary-d);
  border-color: var(--primary-d);
}

.btn.danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
  /* Slightly more deliberate: not the default focus look of primary */
}

.btn.danger:hover {
  background: #fee2e2;
  border-color: #f87171;
}

.btn.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(45, 212, 191, 0.45);
}

.btn.ghost:focus-visible {
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.45);
}

.btn.sm {
  padding: 0.4rem 0.7rem;
  font-size: 0.88rem;
}

.btn.big {
  padding: 0.95rem 1.25rem;
  font-size: 1.08rem;
  border-radius: 10px;
}

.btn.block { width: 100%; }

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.save-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.08);
  z-index: 40;
}

.save-bar > .btn {
  max-width: 720px;
  margin: 0 auto;
  display: block;
}

.log-details {
  max-width: 720px;
  margin: 0.65rem auto 0;
}

.log-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.log {
  margin: 0.5rem 0 0;
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  overflow: auto;
  max-height: 220px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.78rem;
  line-height: 1.45;
}

.msg {
  margin: 0;
  padding: 0.8rem 0.95rem;
  border-radius: var(--radius-sm);
  background: var(--ok-bg);
  color: var(--ok);
  font-weight: 600;
  line-height: 1.4;
  border: 1px solid #bbf7d0;
}

.msg.error {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

.error {
  color: var(--danger);
  margin: 0;
  line-height: 1.4;
}

.nav-rows { display: grid; gap: 0.75rem; }

.nav-row {
  display: grid;
  gap: 0.6rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfc;
}

.nav-row label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: #334155;
}

.nav-row input {
  width: 100%;
  padding: 0.72rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.nav-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

.nav-ops {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.upload-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 0.85rem;
}

.upload-grid {
  display: grid;
  gap: 0.7rem;
}

.upload-card {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.55rem 0.7rem;
  align-items: center;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfc;
}

.upload-thumb {
  width: 52px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: #e8eef6;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #4a6280;
}

.upload-thumb.vid {
  background: #1a2740;
  color: #9ad7c8;
}

.upload-meta { min-width: 0; }

.upload-meta .path {
  display: block;
  font-size: 0.78rem;
  word-break: break-all;
  line-height: 1.4;
}

.upload-meta .size {
  color: var(--muted);
  font-size: 0.82rem;
}

.row-actions.left { justify-content: flex-start; }

@media (max-width: 560px) {
  body {
    font-size: 15px;
    padding-bottom: calc(var(--savebar-h) + 3rem);
  }

  .main.single-form {
    padding: 0.85rem 0.85rem 1.5rem;
    gap: 0.95rem;
  }

  .block {
    padding: 1rem;
  }

  .topbar {
    padding: 0.7rem 0.9rem;
  }

  .topbar strong {
    font-size: 0.92rem;
  }

  .btn.big {
    width: 100%;
  }

  .row-actions {
    justify-content: stretch;
  }

  .row-actions .btn {
    flex: 1 1 auto;
    text-align: center;
  }

  .upload-card {
    grid-template-columns: 1fr 1fr;
  }

  .upload-thumb { grid-column: 1 / -1; }

  .list-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .save-bar > .btn {
    width: 100%;
  }
}
