/* ════════════════════════════════════════════════════════════════════════
   INK Admin Tool — wizard.css  (rewrite)
   Multi-step entity wizard. Pure CSS, Chromium/Electron.
   Depends on tokens defined in app.css :root (loaded first).
   ──────────────────────────────────────────────────────────────────────────
   Changelog vs. previous:
   · Removed undefined --bg-secondary / --text-primary usages → --bg / --text.
   · 'Courier New' / bare monospace → --font-mono.
   · Hard-coded status rgba() → --danger-bg / --success-bg tokens.
   · border-radius literals → --radius-sm / --radius scale.
   · Stepper: enlarged + pulsing active step; step-content slide/fade on change.
   · Review rows: faint separators. Focus glow on inputs.
   ════════════════════════════════════════════════════════════════════════ */

/* ── Wizard wrapper ── */
.wizard-wrap {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 560px;
}

/* ── Stepper ── */
.wizard-stepper {
  display: flex;
  align-items: center;
  gap: 0;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: width var(--transition-base), height var(--transition-base),
              background var(--transition-base), color var(--transition-base),
              font-size var(--transition-base);
}

/* Active step reads as the focus of attention: larger + pulsing ring. */
.step.active .step-num {
  width: 30px;
  height: 30px;
  font-size: 13px;
  background: var(--accent);
  color: #0d1117;
  animation: stepPulse 2s ease-in-out infinite;
}

.step.done .step-num {
  background: var(--success);
  color: #0d1117;
}

.step-label {
  font-size: 12px;
  color: var(--text-muted);
  transition: color var(--transition-base);
}

.step.active .step-label {
  color: var(--text);
  font-weight: 500;
}

.step.done .step-label {
  color: var(--text-muted);
}

.step-connector {
  flex: 1;
  height: 1px;
  background: var(--border);
  margin: 0 10px;
  min-width: 8px;
  max-width: 40px;
}

@keyframes stepPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(88, 166, 255, 0.45); }
  50%      { box-shadow: 0 0 0 6px rgba(88, 166, 255, 0); }
}

/* ── Wizard body ──
   Re-built on every step render, so this entrance animation replays each time
   the user advances or goes back. Default = slide in from the right.
   Optional hook: JS may add `.from-left` when navigating Back to reverse it. */
.wizard-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: stepIn var(--transition-base) backwards;
}

.wizard-body.from-left {
  animation-name: stepInLeft;
}

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

@keyframes stepInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Fields ── */
.wizard-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group.field-inline {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.field-hint {
  font-weight: 400;
  color: var(--text-dim);
}

.field-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  width: 100%;
}

.field-input::placeholder { color: var(--text-dim); }

/* Focus: border colour + subtle blue glow ring. */
.field-input:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.field-input.small {
  max-width: 100px;
}

.field-row {
  display: flex;
  gap: 12px;
}

.field-row.tight {
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.field-row.tight .field-input {
  flex: 1;
  min-width: 80px;
}

.field-row.tight .field-input.small {
  flex: 0 0 80px;
}

/* ── Wizard error ── */
.wizard-error {
  font-size: 12px;
  color: var(--danger);
  min-height: 16px;
}

/* ── Actions ── */
.wizard-actions {
  display: flex;
  gap: 8px;
  padding-top: 4px;
}

/* Hoist nav actions and errors to top of wizard-body so they appear before content */
.wizard-body .wizard-actions {
  order: -2;
  padding-top: 0;
  padding-bottom: 4px;
}

.wizard-body .wizard-error {
  order: -1;
  min-height: 0;
}

/* ── Users list (step 1) ── */
.wizard-users-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 40px;
  margin-top: 8px;
}

.wizard-user-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

/* ── Airline list (GH step) ── */
.wizard-airline-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 40px;
}

.wizard-empty-hint {
  font-size: 12px;
  color: var(--text-dim);
  padding: 8px 0;
}

.wizard-airline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  transition: border-color var(--transition-base), background var(--transition-base);
}

.wizard-airline-name {
  font-size: 13px;
  color: var(--text);
  flex: 1;
}

.btn-edit-airline {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-base), background var(--transition-base);
}

.btn-edit-airline:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

.wizard-airline-row.editing {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.form-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.form-section-label strong {
  color: var(--accent);
  font-weight: 700;
  text-transform: none;
}

.btn-remove-airline {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-base), background var(--transition-base);
}

.btn-remove-airline:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.wizard-add-airline-form {
  padding-top: 4px;
  animation: stepIn var(--transition-base) backwards;
}

/* ── Logo picker ── */
.logo-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.logo-placeholder {
  font-size: 12px;
  color: var(--text-dim);
  flex: 1;
}

.logo-filename {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.logo-preview {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.logo-preview-sm {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

/* ── App editor ── */
.apps-editor-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-editor-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.app-editor-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-hover);
  border-bottom: 1px solid var(--border);
}

.app-editor-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.app-editor-fields {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Logon scripts ── */
.logon-script-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.logon-script-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition-base), background var(--transition-base);
}

.logon-script-row:hover {
  background: var(--surface-hover);
}

.logon-script-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  min-width: 14px;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--transition-base), background var(--transition-base);
}

.logon-script-row input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--accent) url("data:image/svg+xml,%3Csvg viewBox='0 0 10 10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 5l2.5 2.5 5-5' stroke='%230d1117' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 10px no-repeat;
}

/* ── Generic custom checkbox ── */
.custom-check {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  min-width: 14px;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--transition-base), background var(--transition-base);
  vertical-align: middle;
}

.custom-check:checked {
  border-color: var(--accent);
  background: var(--accent) url("data:image/svg+xml,%3Csvg viewBox='0 0 10 10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 5l2.5 2.5 5-5' stroke='%230d1117' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 10px no-repeat;
}

.logon-script-name {
  font-size: 13px;
  color: var(--text);
  flex: 1;
}

.logon-script-file {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

/* ── Review ── */
.wizard-review {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.review-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  margin-bottom: 2px;
}

/* Faint separator between consecutive review rows. */
.review-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  padding-bottom: 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}

.review-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.review-row span:first-child {
  min-width: 90px;
  flex-shrink: 0;
}

.review-row strong {
  color: var(--text);
  font-weight: 500;
}

.review-row code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

.review-subsection-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 4px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border);
}

/* ── Status badges ── */
.badge-ok {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--success-bg);
  color: var(--success);
}

.badge-no {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: var(--danger);
}

/* ── Kill list ── */
.kill-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}

.kill-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.kill-item-name {
  flex: 1;
  color: var(--text);
  font-family: var(--font-mono);
}

.btn-kill-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 0 2px;
  line-height: 1;
  transition: color var(--transition-base);
}

.btn-kill-remove:hover { color: var(--danger); }

.kill-add-row {
  display: flex;
  gap: 6px;
}

.kill-add-input { flex: 1; }

/* ── Margin section title ── */
.margin-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin: 12px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* ── Radio group → tarjetas/chips seleccionables (look moderno) ── */
.field-radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  transition: border-color var(--transition-base), background var(--transition-base),
              box-shadow var(--transition-base);
}

.radio-option:hover {
  border-color: var(--text-dim);
  background: var(--surface-hover);
}

/* Estado seleccionado — requiere Chromium ≥105 (:has). */
.radio-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-bg);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.radio-option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  min-width: 15px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--transition-base);
}

.radio-option input[type="radio"]:checked {
  border-color: var(--accent);
  background: radial-gradient(circle at center, var(--accent) 38%, transparent 40%);
}

/* ── Textarea field ── */
.field-textarea {
  resize: vertical;
  min-height: 64px;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ── Margins review two-column grid ── */
.review-margins-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: center;
}

.rmg-key {
  font-size: 12px;
  color: var(--text-muted);
}

.review-margins-grid code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  justify-self: end;
}
