/* ==========================================================================
   wizard.css — Modern SOP Guided Wizard & AI Assistance Styling
   ========================================================================== */

/* Wizard Backdrop & Container */
.wizard-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-dialog, 1050);
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.2s ease-in-out;
}

/* Hidden state for persistent SOP Wizard backdrop from wizard-engine.js */
#erp-wizard-backdrop:not(.is-open) {
  opacity: 0;
  pointer-events: none;
}

.wizard-backdrop.is-open {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.wizard-modal {
  background: var(--surface-1, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(0) scale(1);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#erp-wizard-backdrop:not(.is-open) .wizard-modal {
  transform: translateY(16px) scale(0.98);
}

.wizard-backdrop.is-open .wizard-modal {
  transform: translateY(0) scale(1);
}

/* Wizard Header */
.wizard-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: var(--surface-2, #f8fafc);
  position: relative;
}

.wizard-header__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.wizard-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wizard-header__icon {
  font-size: 28px;
  line-height: 1;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-1, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.wizard-header__title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: var(--text-1, #0f172a);
  display: flex;
  align-items: center;
  gap: 8px;
}

.wizard-header__subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-2, #64748b);
  line-height: 1.4;
}

.wizard-header__close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--text-2, #64748b);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  line-height: 1;
  transition: all 0.15s ease;
}

.wizard-header__close:hover {
  background: var(--border, #e2e8f0);
  color: var(--text-1, #0f172a);
}

/* Stepper Track */
.wizard-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.wizard-step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2, #64748b);
  background: var(--surface-1, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  white-space: nowrap;
  transition: all 0.2s ease;
  user-select: none;
}

.wizard-step-item__num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--border, #e2e8f0);
  color: var(--text-2, #64748b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

.wizard-step-item.is-active {
  color: #ffffff;
  background: var(--primary, #2563eb);
  border-color: var(--primary, #2563eb);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.wizard-step-item.is-active .wizard-step-item__num {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.wizard-step-item.is-completed {
  color: #059669;
  background: #ecfdf5;
  border-color: #a7f3d0;
  cursor: pointer;
}

.wizard-step-item.is-completed .wizard-step-item__num {
  background: #10b981;
  color: #ffffff;
}

.wizard-step-sep {
  flex: 1;
  height: 2px;
  background: var(--border, #e2e8f0);
  min-width: 12px;
}

/* Wizard Body */
.wizard-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* SOP Guidance Callout */
.wizard-guidance {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(59, 130, 246, 0.02));
  border-left: 4px solid var(--primary, #2563eb);
  border-radius: 6px;
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.wizard-guidance__icon {
  font-size: 20px;
  line-height: 1.2;
}

.wizard-guidance__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary, #2563eb);
  margin-bottom: 2px;
}

.wizard-guidance__text {
  font-size: 12px;
  color: var(--text-2, #64748b);
  line-height: 1.45;
  margin: 0;
}

/* Form Sections inside Wizard */
.wizard-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

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

.wizard-form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1, #0f172a);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wizard-form-hint {
  font-size: 11px;
  color: var(--text-2, #64748b);
}

.wizard-form-input,
.wizard-form-select,
.wizard-form-textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border, #e2e8f0);
  background: var(--surface-1, #ffffff);
  color: var(--text-1, #0f172a);
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wizard-form-input:focus,
.wizard-form-select:focus,
.wizard-form-textarea:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Radio Selection Cards (For Payment terms, Expense types, etc.) */
.wizard-card-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.wizard-option-card {
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  background: var(--surface-1, #ffffff);
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.wizard-option-card:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}

.wizard-option-card.is-selected {
  border-color: var(--primary, #2563eb);
  background: rgba(37, 99, 235, 0.05);
  box-shadow: 0 0 0 1px var(--primary, #2563eb);
}

.wizard-option-card__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1, #0f172a);
  display: flex;
  align-items: center;
  gap: 6px;
}

.wizard-option-card__sub {
  font-size: 11px;
  color: var(--text-2, #64748b);
  line-height: 1.35;
}

/* Dynamic Item Line Table */
.wizard-table-wrap {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-1, #ffffff);
}

.wizard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.wizard-table th {
  background: var(--surface-2, #f8fafc);
  padding: 10px 12px;
  font-weight: 600;
  color: var(--text-2, #64748b);
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.wizard-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  color: var(--text-1, #0f172a);
  vertical-align: middle;
}

.wizard-table tr:last-child td {
  border-bottom: none;
}

/* Wizard Summary Box */
.wizard-summary-box {
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wizard-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-2, #64748b);
}

.wizard-summary-row.is-total {
  border-top: 1px dashed var(--border, #cbd5e1);
  padding-top: 10px;
  margin-top: 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1, #0f172a);
}

/* Wizard Footer */
.wizard-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border, #e2e8f0);
  background: var(--surface-2, #f8fafc);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wizard-footer__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wizard-footer__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wizard-draft-badge {
  font-size: 11px;
  color: #059669;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Success Finish State */
.wizard-success-card {
  text-align: center;
  padding: 36px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.wizard-success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.2);
}

.wizard-success-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-1, #0f172a);
  margin: 0;
}

.wizard-success-sub {
  font-size: 14px;
  color: var(--text-2, #64748b);
  max-width: 480px;
  line-height: 1.5;
  margin: 0;
}

/* AI Assistance Hub Screen Styles */
.ai-hub-header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  padding: 32px;
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.25);
}

.ai-hub-header__pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.ai-hub-header__title {
  font-size: 26px;
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.5px;
}

.ai-hub-header__sub {
  font-size: 14px;
  color: #94a3b8;
  max-width: 680px;
  line-height: 1.5;
  margin: 0;
}

.ai-hub-section-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-1, #0f172a);
  margin: 28px 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px;
}

.ai-hub-card {
  background: var(--surface-1, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all 0.2s ease;
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.ai-hub-card:hover {
  border-color: #93c5fd;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.ai-hub-card__top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.ai-hub-card__icon {
  font-size: 28px;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-hub-card__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1, #0f172a);
  margin: 0 0 4px;
}

.ai-hub-card__desc {
  font-size: 13px;
  color: var(--text-2, #64748b);
  line-height: 1.45;
  margin: 0;
}

.ai-hub-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-hub-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--surface-2, #f1f5f9);
  color: var(--text-2, #475569);
}

.ai-hub-card__footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border, #f1f5f9);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Functional Consultant Card */
.ai-consultant-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(168, 85, 247, 0.03));
  border: 1.5px dashed #c084fc;
}

.ai-consultant-card.is-disabled {
  opacity: 0.65;
  filter: grayscale(0.5);
}

