/* ═══════════════════════════════════════════════════
   SHARED WIZARD — Single Panel Wizard Layout
   Versi    : 2.0
   Tanggal  : 2026-07-16
   Target   : Layout wizard satu kolom untuk semua modul
   ═══════════════════════════════════════════════════ */

/* ============================================
   WIZARD CONTAINER
   ============================================ */

.wizard-container {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 32px);
  width: 100%;
}

/* ============================================
   PROGRESS BAR (Dot-style)
   ============================================ */

.wizard-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: clamp(20px, 3vw, 36px);
  padding: 0 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.wizard-progress::-webkit-scrollbar {
  display: none;
}

.wizard-progress-step {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-md, 8px);
  transition: background var(--transition-fast, 0.15s ease);
  user-select: none;
}

.wizard-progress-step:hover {
  background: var(--color-bg-hover, rgba(0,0,0,0.04));
}

[data-theme="dark"] .wizard-progress-step:hover {
  background: var(--color-bg-hover, rgba(255,255,255,0.05));
}

.wizard-progress-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.25s ease;
  background: var(--color-stepper-default, #e2e8f0);
  color: var(--color-text-muted, #94a3b8);
  border: 2px solid var(--color-stepper-default, #e2e8f0);
  flex-shrink: 0;
}

.wizard-progress-dot.active {
  background: var(--color-stepper-active, #4f46e5);
  border-color: var(--color-stepper-active, #4f46e5);
  color: #ffffff;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--color-stepper-active, #4f46e5) 40%, transparent);
  transform: scale(1.08);
}

.wizard-progress-dot.done {
  background: var(--color-stepper-done, #16a34a);
  border-color: var(--color-stepper-done, #16a34a);
  color: #ffffff;
}

.wizard-progress-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted, #94a3b8);
  white-space: nowrap;
  transition: color 0.2s ease;
}

.wizard-progress-step.active .wizard-progress-label,
.wizard-progress-step.done .wizard-progress-label {
  color: var(--color-text-primary, #0f172a);
}

.wizard-progress-line {
  flex: 1;
  height: 2px;
  background: var(--color-stepper-default, #e2e8f0);
  min-width: 12px;
  max-width: 48px;
  border-radius: 1px;
  transition: background 0.3s ease;
  flex-shrink: 1;
}

.wizard-progress-line.done {
  background: var(--color-stepper-done, #16a34a);
}

/* ============================================
   WIZARD PROGRESS CARD (Card-style Stepper)
   Dipakai: analisis-cp, kartu-soal, dll
   ============================================ */

.wizard-progress-card {
  background: var(--color-bg-panel, #ffffff);
  border: 1px solid var(--color-border-panel, #e2e8f0);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 24px;
}

.wizard-progress-card-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border-panel, #e2e8f0);
}

.wizard-card-app-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-primary, #0f172a);
  margin: 0;
  letter-spacing: -0.02em;
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
}

.wizard-card-app-subtitle {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted, #94a3b8);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
}

.wizard-progress-card-identity {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--color-border-panel, #e2e8f0);
  font-size: 11px;
  color: var(--color-text-muted, #94a3b8);
  flex-wrap: wrap;
}

.wizard-progress-card-identity.visible {
  display: flex;
}

.wiz-id-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.wiz-id-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.wiz-id-item i[data-lucide] {
  flex-shrink: 0;
  opacity: 0.5;
}

.wiz-id-sep {
  opacity: 0.35;
  font-weight: 300;
  flex-shrink: 0;
}

.wiz-id-ttd-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.wiz-id-ttd-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.wiz-id-ttd-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  user-select: none;
}

.wiz-id-ttd-hint-text {
  font-size: 9px;
  color: var(--color-text-muted, #94a3b8);
  white-space: nowrap;
  line-height: 1;
  background: var(--color-accent-light, #E6F2DD);
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--color-accent, #659287) 20%, transparent);
}

.wiz-id-date {
  padding: 3px 6px;
  font-size: 10px;
  border: 1px solid var(--color-border-panel, #e2e8f0);
  border-radius: 5px;
  background: var(--color-bg-input, #ffffff);
  color: var(--color-text-primary, #0f172a);
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
  width: 112px;
  height: 26px;
}

.toggle-switch-sm {
  width: 32px;
  height: 18px;
}

.toggle-switch-sm .toggle-slider::before {
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
}

.toggle-switch-sm input:checked + .toggle-slider::before {
  transform: translateX(14px);
}

.wizard-progress-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.wizard-progress-card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 3px 10px;
  background: var(--color-accent, #659287);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 20px;
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
  transition: all 0.25s ease;
}

.wizard-progress-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary, #0f172a);
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
  transition: color 0.25s ease;
}

.wizard-progress-card-steps {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.wizard-progress-card-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border: 1px solid var(--color-border-panel, #e2e8f0);
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-muted, #94a3b8);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.wizard-progress-card-step:hover {
  background: var(--color-bg-hover, rgba(0,0,0,0.04));
  color: var(--color-text-primary, #0f172a);
}

.wizard-progress-card-step.active {
  background: var(--color-accent, #659287);
  border-color: var(--color-accent, #659287);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(101, 146, 135, 0.3);
}

.wizard-progress-card-step.done {
  background: var(--color-success-bg, #f0fdf4);
  border-color: var(--color-success-border, #86efac);
  color: #16a34a;
  font-weight: 600;
}

.wizard-progress-card-arrow {
  display: flex;
  align-items: center;
  color: var(--color-text-muted, #94a3b8);
  flex-shrink: 0;
}

/* ============================================
   STEP BODY
   ============================================ */

.wizard-step {
  display: none;
  animation: wizardFadeIn 0.3s ease-out;
}

.wizard-step.active {
  display: block;
}

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

/* ============================================
   STEP HEADER
   ============================================ */

.wizard-step-header {
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--color-bg-step-header, linear-gradient(135deg, #eef2ff, #e8f0fe));
  border-radius: var(--radius-lg, 12px);
  border: 1px solid var(--color-border-step-header, #c7d2fe);
}

[data-theme="dark"] .wizard-step-header {
  background: var(--color-bg-step-header, linear-gradient(135deg, rgba(99,102,241,0.08), rgba(79,70,229,0.05)));
  border-color: var(--color-border-step-header, rgba(99,102,241,0.15));
}

.wizard-step-number {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted, #94a3b8);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.wizard-step-title {
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 700;
  color: var(--color-text-primary, #0f172a);
  margin-bottom: 6px;
  line-height: 1.3;
}

.wizard-step-desc {
  font-size: 13px;
  color: var(--color-text-secondary, #475569);
  line-height: 1.5;
  max-width: 640px;
}

/* ============================================
   STEP CONTENT WRAPPER
   ============================================ */

.wizard-content {
  background: var(--color-bg-panel, #ffffff);
  border: 1px solid var(--color-border-panel, #e2e8f0);
  border-radius: var(--radius-lg, 12px);
  padding: clamp(16px, 2vw, 24px);
  margin-bottom: 24px;
}

.wizard-content:last-child {
  margin-bottom: 0;
}

/* ============================================
   NAVIGATION
   ============================================ */

.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 20px;
  margin-top: 28px;
  border-top: 1px solid var(--color-border-panel, #e2e8f0);
}

.wizard-nav-center {
  justify-content: center;
}

.wizard-nav-end {
  justify-content: flex-end;
}

.wizard-nav-start {
  justify-content: flex-start;
}

.wizard-nav .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md, 8px);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
  min-height: 40px;
  white-space: nowrap;
}

.wizard-nav .btn-prev {
  background: var(--color-btn-neutral, #f1f5f9);
  color: var(--color-btn-neutral-txt, #334155);
}

.wizard-nav .btn-prev:hover {
  background: var(--color-btn-neutral-hv, #e2e8f0);
  transform: translateX(-2px);
}

.wizard-nav .btn-next {
  background: var(--color-btn-primary, #659287);
  color: var(--color-btn-primary-txt, #ffffff);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.1));
  margin-left: auto;
}

.wizard-nav .btn-next:hover {
  background: var(--color-btn-primary-hv, #51746b);
  box-shadow: var(--shadow-md, 0 4px 6px rgba(0,0,0,0.07));
  transform: translateX(2px);
}

.wizard-nav .btn-primary {
  background: var(--color-btn-primary, #659287);
  color: var(--color-btn-primary-txt, #ffffff);
}

.wizard-nav .btn-primary:hover {
  background: var(--color-btn-primary-hv, #51746b);
  transform: translateY(-1px);
}

.wizard-nav .btn-secondary {
  background: var(--color-btn-secondary, #2563eb);
  color: var(--color-btn-secondary-txt, #ffffff);
}

.wizard-nav .btn-secondary:hover {
  background: var(--color-btn-secondary-hv, #1d4ed8);
}

/* ============================================
   PREVIEW AREA (Step 4)
   ============================================ */

.wizard-preview {
  background: var(--color-bg-preview, #e2e8f0);
  border-radius: var(--radius-lg, 12px);
  min-height: 300px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 0;
  scrollbar-width: thin;
}

.wizard-preview::-webkit-scrollbar {
  width: 6px;
}

.wizard-preview::-webkit-scrollbar-track {
  background: transparent;
}

.wizard-preview::-webkit-scrollbar-thumb {
  background: var(--color-border-panel, #cbd5e1);
  border-radius: 3px;
}

[data-theme="dark"] .wizard-preview::-webkit-scrollbar-thumb {
  background: var(--color-border-panel, #374151);
}

.wizard-preview #document-preview {
  padding: 20px;
}

/* ============================================
   ACTIONS BAR (in-preview buttons)
   ============================================ */

.wizard-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.wizard-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-md, 8px);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
  cursor: pointer;
  transition: all 0.15s ease;
}

.wizard-actions .btn-icon {
  padding: 10px 14px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet */
@media (max-width: 768px) {
  .wizard-container {
    padding: 16px;
  }

  .wizard-progress {
    gap: 4px;
    margin-bottom: 24px;
    padding: 0 2px;
  }

  .wizard-progress-dot {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .wizard-progress-label {
    font-size: 10px;
  }

  .wizard-progress-line {
    min-width: 8px;
    max-width: 32px;
  }

  .wizard-content {
    padding: 16px;
  }

  .wizard-nav {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .wizard-nav .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .wizard-nav .btn-next {
    margin-left: 0;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .wizard-container {
    padding: 12px;
  }

  .wizard-step-header {
    margin-bottom: 16px;
  }

  .wizard-step-title {
    font-size: 16px;
  }

  .wizard-step-desc {
    font-size: 12px;
  }

  .wizard-content {
    padding: 12px;
    border-radius: var(--radius-md, 8px);
  }

  .wizard-preview {
    min-height: 250px;
    max-height: 70vh;
  }

  .wizard-actions {
    gap: 6px;
  }

  .wizard-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 10px 12px;
    font-size: 12px;
  }
}

/* Responsive: wizard progress card */
@media (max-width: 600px) {
  .wizard-progress-card {
    padding: 10px 12px;
    border-radius: 10px;
  }

  .wizard-progress-card-title {
    font-size: 12px;
  }

  .wizard-progress-card-badge {
    font-size: 11px;
    min-width: 34px;
    padding: 2px 8px;
  }

  .wizard-progress-card-step {
    font-size: 11px;
    padding: 4px 8px;
  }

  .wizard-progress-card-identity {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .wiz-id-ttd-controls {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }

  .wiz-id-item {
    max-width: 160px;
  }
}

/* Print: sembunyikan wizard */
@media print {
  .wizard-progress-card {
    display: none !important;
  }
}

/* ============================================
   DARK MODE OVERRIDE
   ============================================ */

[data-theme="dark"] .wizard-content {
  background: var(--color-bg-panel, #111827);
  border-color: var(--color-border-panel, #1f2937);
}

[data-theme="dark"] .wizard-nav {
  border-top-color: var(--color-border-panel, #1f2937);
}

[data-theme="dark"] .wizard-nav .btn-prev {
  background: var(--color-btn-neutral, #1f2937);
  color: var(--color-btn-neutral-txt, #f1f5f9);
}

[data-theme="dark"] .wizard-nav .btn-prev:hover {
  background: var(--color-btn-neutral-hv, #374151);
}

[data-theme="dark"] .wizard-preview {
  background: var(--color-bg-preview, #0b1120);
}

[data-theme="dark"] .wizard-progress-label {
  color: var(--color-text-muted, #475569);
}

[data-theme="dark"] .wizard-progress-step.active .wizard-progress-label,
[data-theme="dark"] .wizard-progress-step.done .wizard-progress-label {
  color: var(--color-text-primary, #f1f5f9);
}

[data-theme="dark"] .wizard-progress-card {
  background: var(--color-bg-panel, #111827);
  border-color: var(--color-border-panel, #1f2937);
}

[data-theme="dark"] .wizard-progress-card-step {
  border-color: var(--color-border-panel, #1f2937);
}

[data-theme="dark"] .wizard-progress-card-step:hover {
  background: var(--color-bg-hover, rgba(255,255,255,0.05));
}

[data-theme="dark"] .wizard-progress-card-step.done {
  background: rgba(22, 163, 74, 0.1);
  border-color: rgba(22, 163, 74, 0.3);
}

[data-theme="dark"] .wizard-progress-card-title-row {
  border-bottom-color: var(--color-border-panel, #1f2937);
}

[data-theme="dark"] .wizard-progress-card-identity {
  border-bottom-color: var(--color-border-panel, #1f2937);
}

[data-theme="dark"] .wiz-id-date {
  background: var(--color-bg-input, #1e293b);
  border-color: var(--color-border-panel, #334155);
  color: var(--color-text-primary, #f1f5f9);
}
