/* Comprehensive wizard form fixes */

/* Fix wizard content layout and positioning */
.wizard-content {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  position: relative;
  overflow: hidden; /* Prevent content overflow */
  /* Remove fixed dimensions that cause issues */
  width: auto !important;
  max-width: 500px !important;
  min-height: auto !important;
  max-height: 90vh !important;
  height: auto !important;
}

/* Fix wizard header and progress */
.wizard-header {
  padding: 24px 24px 0 24px;
  flex-shrink: 0;
  border-bottom: none;
}

.wizard-progress {
  padding: 0 24px 20px 24px;
  flex-shrink: 0;
}

.wizard-progress-bar {
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.wizard-progress-fill {
  height: 100%;
  background: var(--accent-green);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.wizard-progress-text {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  display: block;
}

/* Wizard form should fill the content area properly */
#consult-wizard-form {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* Fix wizard step container */
.wizard-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 140px); /* Account for header and buttons */
}

.wizard-step.hidden {
  display: none;
}

.wizard-step-content {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 20px;
}

/* Fix submit button artifacts and positioning */
.wizard-buttons {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 20px 24px;
  margin: 0;
  border-top: 1px solid var(--line);
  background: #fff;
  /* Ensure buttons stay at bottom without overflow */
  flex-shrink: 0;
  border-bottom: none;
  border-radius: 0 0 16px 16px;
}

.wizard-buttons .btn {
  margin: 0; /* Remove all margins that might cause white lines */
  padding: 12px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  position: relative;
  overflow: hidden; /* Prevent any overflow artifacts */
  /* Ensure no box-shadow extends outside */
  box-sizing: border-box;
}

.wizard-buttons .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wizard-buttons .btn-primary {
  background: var(--brand-primary);
  color: var(--brand-contrast);
  border-color: var(--brand-primary);
  box-shadow: 0 2px 8px rgba(130, 196, 81, 0.3);
}

.wizard-buttons .btn-primary:hover {
  background: var(--accent-green);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(130, 196, 81, 0.4);
}

.wizard-buttons .btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(130, 196, 81, 0.3);
}

.wizard-buttons .btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.wizard-buttons .btn-ghost:hover {
  color: var(--text);
  border-color: var(--accent-olive);
  background: rgba(164, 158, 121, 0.05);
}

/* Fix wizard content container to prevent overflow */
.wizard-content {
  /* Ensure no bottom overflow */
  overflow: visible;
  padding-bottom: 0;
}

.wizard-step {
  /* Remove any bottom margins/padding that create white lines */
  margin-bottom: 0;
  padding-bottom: 0;
}

.wizard-step:last-child {
  /* Specifically target the last step (confirmation) */
  padding-bottom: 0;
  margin-bottom: 0;
}

.wizard-step-content {
  /* Ensure content doesn't create overflow */
  padding-bottom: 0;
  margin-bottom: 0;
}

/* Fix any modal content overflow issues */
.modal-content {
  overflow: visible;
}

/* Ensure form doesn't have extra bottom spacing */
#consult-wizard-form {
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Desktop specific fixes */
@media (min-width: 601px) {
  .wizard-content {
    width: 500px !important;
    max-width: 500px !important;
    padding: 0;
  }
  
  .wizard-step {
    padding: 32px;
  }
  
  .wizard-buttons {
    padding: 24px 32px;
  }
}

/* Tablet fixes */
@media (max-width: 768px) and (min-width: 601px) {
  .wizard-content {
    width: 90vw !important;
    max-width: 500px !important;
  }
}

/* Mobile fixes */
@media (max-width: 600px) {
  .wizard-content {
    width: 95vw !important;
    max-width: 95vw !important;
    height: auto !important;
    min-height: auto !important;
    max-height: 95vh !important;
    margin: 10px;
    border-radius: 12px;
  }
  
  .wizard-header {
    padding: 16px 20px 0 20px;
  }
  
  .wizard-progress {
    padding: 0 20px 16px 20px;
  }
  
  .wizard-step {
    padding: 20px;
    max-height: calc(95vh - 180px);
  }
  
  .wizard-step-content {
    padding-bottom: 16px;
  }
  
  .wizard-buttons {
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    border-radius: 0 0 12px 12px;
  }
  
  .wizard-buttons .btn {
    width: 100%;
    order: initial;
    margin: 0;
    padding: 14px 20px;
    font-size: 16px; /* Better touch target */
  }
  
  .wizard-buttons .btn-primary {
    order: 1; /* Submit button on top on mobile */
  }
  
  .wizard-buttons .btn-ghost {
    order: 2; /* Back button below submit on mobile */
  }
}

/* Extra small mobile fixes */
@media (max-width: 480px) {
  .wizard-content {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    margin: 0;
    border-radius: 0;
  }
  
  .wizard-header {
    padding: 12px 16px 0 16px;
  }
  
  .wizard-progress {
    padding: 0 16px 12px 16px;
  }
  
  .wizard-step {
    padding: 16px;
    max-height: calc(100vh - 160px);
  }
  
  .wizard-buttons {
    padding: 16px;
    border-radius: 0;
  }
  
  .wizard-buttons .btn {
    padding: 16px 20px;
    font-size: 16px;
  }
}

/* Short screen fixes */
@media (max-height: 600px) {
  .wizard-content {
    max-height: 100vh !important;
    height: 100vh !important;
  }
  
  .wizard-step {
    max-height: calc(100vh - 140px);
    padding: 16px;
  }
  
  .wizard-buttons {
    padding: 12px 20px;
  }
  
  .wizard-buttons .btn {
    padding: 10px 16px;
    font-size: 14px;
  }
}

/* Loading state for submit button */
.wizard-buttons .btn[disabled] {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.wizard-buttons .btn[disabled]:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(130, 196, 81, 0.3);
}
