/* ========================================
   增強版多步驟精靈（Wizard）樣式
   全部範圍化於 .wizard-enhanced，避免影響其他表單
======================================== */

.wizard-enhanced {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 步驟指示器 */
.wizard-enhanced .wizard-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: 48px;
  position: relative;
}

.wizard-enhanced .wizard-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.wizard-enhanced .step-indicator {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 12px;
}

.wizard-enhanced .step-number {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #f3f4f6;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  transition: all 0.3s;
}

.wizard-enhanced .wizard-step.active .step-number {
  background: #2455A6;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(36, 85, 166, 0.1);
}

.wizard-enhanced .wizard-step.completed .step-number {
  background: #10b981;
  color: #fff;
}

.wizard-enhanced .step-connector {
  flex: 1;
  height: 2px;
  background: #e5e7eb;
  margin-left: 8px;
  transition: background 0.3s;
}

.wizard-enhanced .wizard-step:last-child .step-connector {
  display: none;
}

.wizard-enhanced .wizard-step.completed .step-connector {
  background: #10b981;
}

.wizard-enhanced .step-label {
  text-align: center;
}

.wizard-enhanced .step-title {
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 4px;
}

.wizard-enhanced .wizard-step.active .step-title {
  color: #2455A6;
}

.wizard-enhanced .wizard-step.completed .step-title {
  color: #10b981;
}

.wizard-enhanced .step-subtitle {
  font-size: 12px;
  color: #9ca3af;
}

/* 步驟內容 */
.wizard-enhanced .wizard-content {
  min-height: 360px;
  margin-bottom: 32px;
}

.wizard-enhanced .wizard-step-content {
  max-width: 800px;
  margin: 0 auto;
}

.wizard-enhanced .wizard-step-title {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 8px;
}

.wizard-enhanced .wizard-step-description {
  font-size: 16px;
  color: #6b7280;
  margin-bottom: 32px;
}

.wizard-enhanced .wizard-fields {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* 表單群組 */
.wizard-enhanced .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wizard-enhanced .form-group.has-error .form-input,
.wizard-enhanced .form-group.has-error .form-select,
.wizard-enhanced .form-group.has-error .form-textarea {
  border-color: #ef4444;
}

.wizard-enhanced .form-label {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wizard-enhanced .form-label.required::after {
  content: '*';
  color: #ef4444;
}

.wizard-enhanced .tooltip-icon {
  cursor: help;
  font-size: 16px;
}

.wizard-enhanced .form-input,
.wizard-enhanced .form-select,
.wizard-enhanced .form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  color: #111827;
  font-family: inherit;
  transition: all 0.2s;
}

.wizard-enhanced .form-input:focus,
.wizard-enhanced .form-select:focus,
.wizard-enhanced .form-textarea:focus {
  outline: none;
  border-color: #2455A6;
  box-shadow: 0 0 0 3px rgba(36, 85, 166, 0.1);
}

.wizard-enhanced .form-input.error,
.wizard-enhanced .form-select.error,
.wizard-enhanced .form-textarea.error {
  border-color: #ef4444;
}

.wizard-enhanced .form-error {
  font-size: 13px;
  color: #ef4444;
  display: flex;
  align-items: center;
  gap: 4px;
}

.wizard-enhanced .form-hint {
  font-size: 13px;
  color: #6b7280;
}

/* Checkbox 與 Radio */
.wizard-enhanced .checkbox-group,
.wizard-enhanced .radio-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wizard-enhanced .checkbox-label,
.wizard-enhanced .radio-label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.wizard-enhanced .checkbox-label:hover,
.wizard-enhanced .radio-label:hover {
  background: #f9fafb;
  border-color: #2455A6;
}

.wizard-enhanced .checkbox-label input[type="checkbox"],
.wizard-enhanced .radio-label input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

/* 導航按鈕 */
.wizard-enhanced .wizard-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
}

.wizard-enhanced .wizard-progress {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
}

/* 後備 Toast（頁面無 #toast 時） */
.mk-wizard-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #111827;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.mk-wizard-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.mk-wizard-toast-error {
  background: #ef4444;
}

.mk-wizard-toast-success {
  background: #10b981;
}

/* 響應式 */
@media (max-width: 768px) {
  .wizard-enhanced {
    padding: 20px;
  }

  .wizard-enhanced .wizard-steps {
    flex-direction: column;
    gap: 16px;
  }

  .wizard-enhanced .step-indicator {
    width: auto;
  }

  .wizard-enhanced .step-connector {
    display: none;
  }

  .wizard-enhanced .wizard-navigation {
    flex-direction: column;
  }

  .wizard-enhanced .wizard-navigation button {
    width: 100%;
  }
}

/* ========================================
   草稿自動儲存：恢復橫幅 + 儲存指示
======================================== */
.wizard-enhanced .wizard-draft-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: #dbeafe;
  border: 1px solid #3b82f6;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin-bottom: 24px;
}

.wizard-enhanced .wizard-draft-banner .draft-ic {
  font-size: 1.35rem;
  flex-shrink: 0;
}

.wizard-enhanced .wizard-draft-banner .draft-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  color: #1e3a8a;
}

.wizard-enhanced .wizard-draft-banner .draft-sub {
  font-size: 0.8rem;
  opacity: 0.85;
}

.wizard-enhanced .wizard-draft-banner .draft-actions {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
}

.wizard-enhanced .wizard-autosave {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: #10b981;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.wizard-enhanced .wizard-autosave.show {
  opacity: 1;
}

@media (max-width: 768px) {
  .wizard-enhanced .wizard-draft-banner .draft-actions {
    margin-left: 0;
    width: 100%;
  }
  .wizard-enhanced .wizard-draft-banner .draft-actions button {
    flex: 1;
  }
}
