/* =========================================
   onboarding.css - Company Onboarding Wizard
   ========================================= */

.onboarding-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-modal);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--transition-slow),
    visibility var(--transition-slow);
  overflow-y: auto;
  padding: 20px;
}

.onboarding-modal.show {
  opacity: 1;
  visibility: visible;
}

.company-onboarding-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-modal);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--transition-slow),
    visibility var(--transition-slow);
}

.company-onboarding-modal.show {
  opacity: 1;
  visibility: visible;
}

.onboarding-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: 0;
  background:
    radial-gradient(
      circle at 30% 30%,
      rgba(0, 220, 130, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 70% 70%,
      rgba(168, 85, 247, 0.08) 0%,
      transparent 50%
    );
  animation: floatBackground 30s ease-in-out infinite;
}

.onboarding-container {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 32px;
  padding: 48px;
  max-width: 720px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  z-index: 1;
  box-shadow:
    var(--shadow-xl),
    0 0 100px rgba(0, 220, 130, 0.1);
  animation: slideUp 0.6s var(--ease-out-expo);
}

.onboarding-container::-webkit-scrollbar {
  width: 6px;
}

.onboarding-container::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.onboarding-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent-gradient);
  border-radius: 32px 32px 0 0;
}

.onboarding-header {
  text-align: center;
  margin-bottom: 32px;
}

.onboarding-icon {
  width: 80px;
  height: 80px;
  background: var(--accent-gradient);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin: 0 auto 20px;
  box-shadow: var(--shadow-glow);
  animation: pulse 3s ease-in-out infinite;
}

.onboarding-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.onboarding-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
}

/* Progress Bar */
.onboarding-progress {
  margin-bottom: 40px;
}

.progress-bar {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 32px;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  width: 25%;
  transition: width 0.5s var(--ease-out-expo);
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  opacity: 0.5;
  transition: all var(--transition-base);
}

.progress-step.active {
  opacity: 1;
}

.progress-step.completed {
  opacity: 0.8;
}

.step-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  transition: all var(--transition-base);
}

.progress-step.active .step-dot {
  background: var(--accent-gradient);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 220, 130, 0.3);
}

.progress-step.completed .step-dot {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.progress-step.completed .step-dot::after {
  content: "✓";
  position: absolute;
}

.progress-step span {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.progress-step.active span {
  color: var(--text-primary);
}

/* Step Styles */
.onboarding-step {
  display: none;
  animation: fadeInUp 0.4s var(--ease-out-expo);
}

.onboarding-step.active {
  display: block;
}

.step-header {
  margin-bottom: 32px;
  text-align: center;
}

.step-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.step-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.step-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* Form Elements */

.form-group {
  position: relative;
  margin-bottom: 24px;
}

.onboarding-input {
  width: 100%;
  /* CHANGED: Increased top padding to make room for the label */
  padding: 24px 16px 8px 16px;
  border: 2px solid var(--border-color);
  border-radius: 14px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 15px;
  transition: all var(--transition-base);
  outline: none;
}

.onboarding-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(0, 220, 130, 0.1);
}

/* Important: This detects if user has typed something */
.onboarding-input:not(:placeholder-shown) {
  border-color: var(--border-hover);
}

.onboarding-textarea {
  width: 100%;
  /* CHANGED: Increased top padding */
  padding: 24px 16px 8px 16px;
  border: 2px solid var(--border-color);
  border-radius: 14px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 15px;
  transition: all var(--transition-base);
  outline: none;
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
  line-height: 1.5;
}

.onboarding-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(0, 220, 130, 0.1);
}

/* Floating Label Base Style */
.floating-label {
  position: absolute;
  left: 18px; /* Matches input padding-left + border */
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 15px;
  pointer-events: none; /* Allows clicking through label */
  transition: all 0.2s ease-in-out;
  background-color: transparent;
  font-weight: 500;
}

/* Adjust initial position for Textarea (top aligned, not centered) */
.onboarding-textarea + .floating-label {
  top: 24px;
  transform: translateY(0);
}

.onboarding-input:focus + .floating-label,
.onboarding-input:not(:placeholder-shown) + .floating-label,
.onboarding-textarea:focus + .floating-label,
.onboarding-textarea:not(:placeholder-shown) + .floating-label {
  top: 8px;
  transform: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-primary); /* Uses your theme's accent color */
  letter-spacing: 0.5px;
}

.input-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.input-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: -12px;
  margin-bottom: 16px;
}

.char-count {
  position: absolute;
  right: 16px;
  bottom: 8px;
  font-size: 11px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.section-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.helper-text {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

/* Dynamic List (Services, USPs) */
.dynamic-list {
  margin-bottom: 20px;
}

.dynamic-item {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  animation: fadeInUp 0.3s var(--ease-out-expo);
}

.dynamic-item input {
  flex: 1;
  padding: 12px 14px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all var(--transition-base);
}

.dynamic-item input:focus {
  border-color: var(--accent-primary);
}

.dynamic-item .remove-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--red-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition-base);
}

.dynamic-item .remove-btn:hover {
  background: rgba(244, 63, 94, 0.1);
  border-color: var(--red-accent);
}

.add-item-btn {
  width: 100%;
  padding: 12px;
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.add-item-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(0, 220, 130, 0.05);
}

/* Service Card */
.service-card {
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  transition: all var(--transition-base);
  animation: fadeInUp 0.3s var(--ease-out-expo);
}

.service-card:hover {
  border-color: var(--border-hover);
}

.service-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.service-number {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-primary);
  background: rgba(0, 220, 130, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
}

.service-remove {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: var(--red-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.service-remove:hover {
  background: rgba(244, 63, 94, 0.2);
}

.service-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 10px;
  outline: none;
  transition: all var(--transition-base);
}

.service-input:focus {
  border-color: var(--accent-primary);
}

/* Services List */
.services-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.service-item {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 12px;
  padding: 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  animation: slideIn 0.3s ease;
}

.add-service-btn,
.add-usp-btn {
  width: 100%;
  padding: 14px;
  border: 2px dashed var(--border-color);
  border-radius: 16px;
  background: transparent;
  color: var(--accent-primary);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.add-service-btn:hover,
.add-usp-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
}

.service-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.service-chip {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-base);
}

.service-chip:hover {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
}

/* USP List */
.usp-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.usp-item {
  display: flex;
  gap: 8px;
  align-items: center;
}

.usp-item input {
  flex: 1;
}

/* Tags Input (Industries) */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 14px;
  background: var(--bg-tertiary);
  min-height: 56px;
  margin-bottom: 16px;
  transition: all var(--transition-base);
}

.tags-container:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(0, 220, 130, 0.1);
}

.tag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--accent-gradient);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: white;
  animation: scaleIn 0.2s var(--ease-spring);
}

.tag-remove {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.3);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: background var(--transition-fast);
}

.tag-remove:hover {
  background: rgba(255, 255, 255, 0.5);
}

.tags-input {
  flex: 1;
  min-width: 120px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.tags-input::placeholder {
  color: var(--text-tertiary);
}

/* Preset Tags */
.preset-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.preset-tag {
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-base);
}

.preset-tag:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.preset-tag.selected {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
}

/* Industries Grid */
.industry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  padding: 12px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-base);
}

.checkbox-item:has(input:checked) {
  border-color: var(--accent-primary);
  background: rgba(0, 220, 130, 0.1);
}

.checkbox-item input {
  display: none;
}

.checkbox-item span {
  font-size: 14px;
  font-weight: 500;
}

/* Navigation Buttons */
.onboarding-nav {
  display: flex;
  gap: 16px;
  margin-top: 32px;
}

.nav-btn {
  flex: 1;
  padding: 16px;
  border: none;
  border-radius: 16px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.nav-btn.secondary {
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  color: var(--text-secondary);
}

.nav-btn.secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.nav-btn.primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 20px rgba(0, 220, 130, 0.3);
}

.nav-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 220, 130, 0.4);
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Review Step */
.review-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.review-section {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}

.review-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 12px;
}

.review-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-section p,
.review-section li {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.review-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.review-section li {
  padding: 4px 0;
}

.review-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.review-item:last-child {
  border-bottom: none;
}

.review-label {
  font-size: 13px;
  color: var(--text-tertiary);
}

.review-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

.review-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.review-tag {
  padding: 4px 10px;
  background: rgba(0, 220, 130, 0.15);
  border-radius: 12px;
  font-size: 12px;
  color: var(--accent-primary);
}

/* Skip Button/Option */
.skip-btn {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 13px;
  cursor: pointer;
  margin-top: 16px;
  transition: color var(--transition-base);
}

.skip-btn:hover {
  color: var(--text-secondary);
}

.skip-option {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
}

.skip-option a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: all var(--transition-base);
}

.skip-option a:hover {
  color: var(--text-secondary);
  text-decoration: underline;
}

/* Error/Success Messages */
.onboarding-error,
.onboarding-success {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  margin-top: 16px;
  display: none;
}

.onboarding-error:not(:empty) {
  display: block;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: var(--red-accent);
}

.onboarding-success:not(:empty) {
  display: block;
  background: rgba(0, 220, 130, 0.1);
  border: 1px solid rgba(0, 220, 130, 0.2);
  color: var(--accent-primary);
}

/* =========================================
   Mobile Onboarding Adjustments
   ========================================= */
@media (max-width: 1023px) {
  .onboarding-container {
    border-radius: 24px 24px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 100%;
    width: 100%;
    padding: 24px;
    padding-bottom: calc(24px + var(--safe-area-bottom));
    max-height: 95vh;
  }

  .onboarding-icon {
    width: 64px;
    height: 64px;
    font-size: 32px;
    border-radius: 20px;
  }

  .onboarding-title {
    font-size: 24px;
  }

  .step-title {
    font-size: 18px;
  }

  .onboarding-nav {
    flex-direction: column;
  }

  .nav-btn.secondary {
    order: 1;
  }

  .form-row,
  .industry-grid {
    grid-template-columns: 1fr;
  }

  .progress-step span {
    font-size: 10px;
  }

  .step-dot {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
}

/* ═══════════════════════════════════════
   AUTO-FILL SECTION
   ═══════════════════════════════════════ */

.autofill-section {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 8px;
}

.autofill-input-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.autofill-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s ease;
  height: 48px;
  min-width: 140px;
  justify-content: center;
  flex-shrink: 0;
}

.autofill-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.autofill-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.autofill-icon {
  font-size: 18px;
}

/* Spinner for loading state */
.autofill-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: autofill-spin 0.8s linear infinite;
}

@keyframes autofill-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Status messages */
.autofill-status {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 8px;
}

.autofill-status.loading {
  background: rgba(99, 102, 241, 0.1);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.autofill-status.success {
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.autofill-status.error {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Divider between auto-fill and manual */
.form-divider {
  display: flex;
  align-items: center;
  margin: 20px 0 16px;
  gap: 16px;
}

.form-divider::before,
.form-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.form-divider span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

/* Highlight auto-filled fields */
@keyframes autofill-glow {
  0% {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5);
  }
  100% {
    box-shadow: 0 0 0 0px rgba(99, 102, 241, 0);
  }
}

.autofilled {
  animation: autofill-glow 1.5s ease-out;
}

/* Responsive */
@media (max-width: 600px) {
  .autofill-input-row {
    flex-direction: column;
  }
  .autofill-btn {
    width: 100%;
    min-width: unset;
  }
}
