/* ===================================================================
   SparkQuiz Admin — layered on top of styles.css. Reuses the same
   --bg/--surface/--primary/etc. tokens so light/dark stay in sync
   with the main app; nothing here redefines them.
   =================================================================== */

.topbar__admin-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-tint);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ---------- Palette swatch ---------- */
.palette-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  flex: none;
}

/* ---------- Key gate ---------- */
.gate {
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.gate[hidden] { display: none; }
.gate-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}
.gate-card h1 { margin: 0; font-size: 22px; }
.gate-card p { margin: 0; color: var(--text-soft); font-size: 14px; line-height: 1.5; }
.gate-card code {
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 13px;
}
.gate-card input[type="password"] {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
.gate-card input[type="password"]:focus {
  outline: none;
  border-color: var(--primary);
}
.gate-error { color: var(--wrong); font-size: 13px; margin: 0; }

/* ---------- Shell + tabs ---------- */
.admin-shell {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}
.tab-btn {
  border: none;
  background: none;
  color: var(--text-soft);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn--active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.tab-panel__header h2 { margin: 0; font-size: 19px; }

.btn--sm { padding: 8px 14px; font-size: 13px; border-radius: var(--radius-sm); }

.scope-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 18px;
  max-width: 360px;
}
.scope-picker select {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

/* ---------- Data rows ---------- */
.data-list { display: flex; flex-direction: column; gap: 10px; }
.empty-hint { color: var(--text-soft); font-size: 14px; padding: 16px 0; }

.data-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.data-row__content { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.data-row__content strong { font-size: 14.5px; line-height: 1.4; }
.row-sub { font-size: 12.5px; color: var(--text-soft); }
.data-row__actions { display: flex; gap: 4px; flex-shrink: 0; }
.text-btn--danger { color: var(--wrong); }
.text-btn--danger:hover { background: var(--wrong-tint); }

/* ---------- Add/edit form overlay ---------- */
.form-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.form-overlay[hidden] { display: none; }

.form-card {
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.form-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.form-card__header h3 { margin: 0; font-size: 18px; }

.form-fields { display: flex; flex-direction: column; gap: 14px; }
.form-fields label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-soft);
  font-weight: 600;
}
.form-fields input,
.form-fields textarea,
.form-fields select {
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  resize: vertical;
}
.form-fields input:focus,
.form-fields textarea:focus,
.form-fields select:focus {
  outline: none;
  border-color: var(--primary);
}
.options-label { gap: 8px; }
.options-grid { display: flex; flex-direction: column; gap: 8px; }

.table-data-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.table-data-fields[hidden] { display: none; }

.form-card__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

/* ---------- Toast ---------- */
.flash {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 12px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}
.flash--show { opacity: 1; transform: translate(-50%, 0); }
.flash--error { background: var(--wrong); color: #fff; }

/* ---------- Bulk import ---------- */
.import-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 640px;
}
.import-card > p { margin: 0; font-size: 14px; color: var(--text-soft); line-height: 1.6; }

.import-shape summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--primary);
}
.import-shape pre {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 14px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
  margin: 12px 0;
}
.import-note {
  font-size: 12.5px;
  color: var(--text-soft);
  line-height: 1.6;
  margin: 0;
}
.import-note code, .import-shape code { font-size: 12px; }

.file-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-soft);
  text-align: center;
}
.file-drop:hover { border-color: var(--primary); color: var(--primary); }
.file-drop--picked { border-style: solid; color: var(--text); }

.import-result {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.7;
}
.import-result h4 { margin: 0 0 6px; font-size: 14px; }
.import-result ul { margin: 8px 0 0; padding-left: 18px; }
.import-result li { color: var(--wrong); }

@media (max-width: 560px) {
  .data-row { flex-direction: column; align-items: flex-start; }
  .data-row__actions { align-self: flex-end; }
}
