// ─── Wrapper ───────────────────────────────────────────────────────
.wizard-wrapper {
  background: #f3f4f6;
  min-height: 100%;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

// ─── Wizard Body (steps 1–3) ───────────────────────────────────────
.wizard-body {
  max-width: 1060px;
  margin: 0 auto;
  padding: 40px 32px;
  animation: fadeSlideIn 0.22s ease-out;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0);    }
}

// ─── Step Header ──────────────────────────────────────────────────
.step-header {
  margin-bottom: 32px;

  .step-title {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 6px;
  }

  .step-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
  }
}

// ─── Step 1: 2×2 Space Grid ───────────────────────────────────────
.space-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.space-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;

  &:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
  }

  &.selected {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
  }
}

// ─── Step 2: Type Groups ──────────────────────────────────────────
.type-group {
  margin-bottom: 28px;

  .group-label {
    font-size: 13px;
    font-weight: 500;
    color: #9ca3af;
    letter-spacing: 0.02em;
    margin: 0 0 12px;
  }
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.type-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;

  &:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
  }

  &.selected {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
  }
}

// ─── Step 3: Template Grid ────────────────────────────────────────
.template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.template-card {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;

  &:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.12);
    transform: translateY(-2px);
  }

  &.selected {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  }

  .template-preview {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;

    .template-preview-icon {
      font-size: 48px;
      opacity: 0.6;
    }
  }

  .template-info {
    padding: 16px;

    .template-name {
      font-size: 15px;
      font-weight: 600;
      color: #111827;
      margin: 0 0 4px;
    }

    .template-desc {
      font-size: 12px;
      color: #6b7280;
      margin: 0;
    }
  }
}

// ─── Shared Card Parts ────────────────────────────────────────────
.card-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;

  .icon { font-size: 20px; }
}

.card-info {
  .card-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px;
  }
  .card-desc {
    font-size: 13px;
    color: #9ca3af;
    margin: 0;
  }
}

// ─── Back Button / Step Footer ────────────────────────────────────
.step-footer {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  color: #374151;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;

  &:hover { background: #f9fafb; border-color: #9ca3af; }
}

// ─── Step 4: Header Bar ───────────────────────────────────────────
.wizard-header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 32px;

  .wizard-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
  }

  .nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .nav-back-btn {
    font-size: 13px;
    color: #6b7280;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 0;

    &:hover { color: #111827; }
  }

  .step-info {
    display: flex;
    flex-direction: column;

    .step-label {
      font-size: 15px;
      font-weight: 700;
      color: #111827;
    }

    .step-sub {
      font-size: 12px;
      color: #9ca3af;
      margin-top: 2px;
    }
  }

  .nav-actions {
    display: flex;
    gap: 10px;
  }

  .btn-previous {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    transition: background 0.2s;

    &:hover { background: #f9fafb; }
  }

  .btn-create {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;

    &:hover { background: #4f46e5; }
  }

  // 4-segment progress bar
  .progress-bar {
    display: flex;
    gap: 4px;
    margin: 0 -32px;

    .progress-segment {
      flex: 1;
      height: 4px;
      background: #e5e7eb;
      transition: background 0.3s;

      &.active { background: #6366f1; }
    }
  }
}

// ─── Step 4: Title row ────────────────────────────────────────────
.step4-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 32px 0;

  .step4-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 4px;
  }

  .step4-sub {
    font-size: 13px;
    color: #9ca3af;
    margin: 0;
  }

  .step4-actions {
    display: flex;
    gap: 10px;

    .btn-ai {
      padding: 8px 16px;
      font-size: 13px;
      font-weight: 500;
      border: 1px solid #d1d5db;
      border-radius: 8px;
      background: #fff;
      color: #374151;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
      transition: border-color 0.2s, color 0.2s, background 0.2s;

      &:hover { border-color: #6366f1; color: #6366f1; background: #f5f3ff; }
    }

    .btn-preview {
      padding: 8px 16px;
      font-size: 13px;
      font-weight: 500;
      border: 1px solid #d1d5db;
      border-radius: 8px;
      background: #fff;
      color: #374151;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
      transition: background 0.2s;

      &:hover { background: #f9fafb; }
    }
  }
}

// ─── Step 4: Form Layout ──────────────────────────────────────────
.form-overview {
  padding: 24px 32px;
  height: calc(100vh - 200px);
  overflow-y: auto;
}

.content-tab-group {
  .mat-mdc-tab-header {
    background: transparent;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 24px;
  }

  .mat-mdc-tab {
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    min-width: auto;
    padding: 0 16px;

    &.mdc-tab--active { color: #111827; }
  }

  .mdc-tab-indicator__content--underline {
    border-color: #111827 !important;
  }
}

.tab-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

// ─── Form Section Cards ───────────────────────────────────────────
.form-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;

  .section-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 20px;
  }

  .section-sub {
    font-size: 13px;
    color: #6b6bd6;
    margin: -14px 0 18px;
    cursor: pointer;

    &:hover { text-decoration: underline; }
  }

  .section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;

    .section-title { margin: 0; }
  }
}

// ─── Field Groups ─────────────────────────────────────────────────
.field-group {
  margin-bottom: 20px;

  &:last-child { margin-bottom: 0; }

  .field-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;

    .required { color: #ef4444; margin-left: 2px; }
  }

  gb-input, gb-textarea, gb-date {
    display: block;
    width: 100%;

    input, textarea {
      width: 100%;
      border: 1px solid #d1d5db;
      border-radius: 8px;
      padding: 10px 14px;
      font-size: 14px;
      color: #111827;
      background: #fff;
      outline: none;
      transition: border-color 0.2s;
      box-sizing: border-box;

      &::placeholder { color: #9ca3af; }

      &:focus {
        border-color: #6366f1;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
      }
    }

    textarea { resize: vertical; min-height: 100px; }
  }

  gb-richtexteditor {
    display: block;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    min-height: 220px;
  }
}

// ─── Upload Zone ──────────────────────────────────────────────────
.upload-zone {
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: #fafafa;

  &:hover { border-color: #6366f1; background: #f5f3ff; }

  .upload-hint {
    display: block;
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 12px;
  }

  .upload-btn {
    display: inline-block;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    transition: background 0.2s;

    &:hover { background: #f3f4f6; }
  }

  .preview-img {
    max-height: 180px;
    max-width: 100%;
    border-radius: 6px;
    object-fit: cover;
    display: block;
    margin: 0 auto 10px;
  }

  .remove-btn {
    display: inline-block;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    background: #fff;
    color: #ef4444;
    cursor: pointer;
    transition: background 0.2s;

    &:hover { background: #fee2e2; }
  }

  .hidden-input { display: none; }
}

// ─── Add Link Button ──────────────────────────────────────────────
.add-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;

  &:hover { background: #4f46e5; }

  .plus-icon { font-size: 16px; line-height: 1; }
}

// ─── Empty State ──────────────────────────────────────────────────
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  gap: 6px;

  .empty-icon { font-size: 28px; color: #d1d5db; margin-bottom: 4px; }
  .empty-title { font-size: 14px; font-weight: 500; color: #6b7280; margin: 0; }
  .empty-sub   { font-size: 12px; color: #9ca3af; margin: 0; }
}

// ─── Integration Cards ────────────────────────────────────────────
.integration-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
  background: #fafafa;

  &:last-child { margin-bottom: 0; }

  .integration-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;

    &.lms-icon  { background: #fff7ed; }
    &.tour-icon { background: #f0fdf4; }
    &.api-icon  { background: #eff6ff; }
  }

  .integration-body {
    flex: 1;

    .field-label {
      display: block;
      font-size: 13px;
      font-weight: 500;
      color: #374151;
      margin-bottom: 6px;
    }
  }
}

// ─── Responsive ───────────────────────────────────────────────────
@media (max-width: 768px) {
  .space-grid { grid-template-columns: 1fr; }
  .type-grid  { grid-template-columns: repeat(2, 1fr); }
  .template-grid { grid-template-columns: repeat(2, 1fr); }
  .wizard-body { padding: 24px 16px; }
}

@media (max-width: 480px) {
  .type-grid, .template-grid { grid-template-columns: 1fr; }
}