/*
 * HMO Manager Pro – Multi-Step Onboarding Form Styles
 * Modern stepper layout compatible with Contact Form 7
 */

/* ── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  --hmo-primary:       #2c3e50;
  --hmo-accent:        #27ae60;
  --hmo-accent-light:  #d5f5e3;
  --hmo-danger:        #e74c3c;
  --hmo-warn:          #f39c12;
  --hmo-text:          #2d3436;
  --hmo-text-muted:    #636e72;
  --hmo-border:        #dfe6e9;
  --hmo-bg:            #f8fafb;
  --hmo-white:         #ffffff;
  --hmo-radius:        10px;
  --hmo-shadow:        0 4px 20px rgba(0,0,0,0.08);
  --hmo-transition:    all 0.25s ease;
  --hmo-step-size:     42px;
}

/* ── Outer Wrapper ─────────────────────────────────────────────────────────── */
.hmo-onboarding-form-wrap {
  max-width: 720px;
  margin: 0 auto;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--hmo-text);
}

/* ── Progress Header ───────────────────────────────────────────────────────── */
.hmo-steps-header {
  background: var(--hmo-white);
  border-radius: var(--hmo-radius) var(--hmo-radius) 0 0;
  padding: 28px 32px 20px;
  border: 1px solid var(--hmo-border);
  border-bottom: none;
}

.hmo-steps-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--hmo-primary);
  margin: 0 0 20px;
}

/* ── Stepper ────────────────────────────────────────────────────────────────── */
.hmo-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
}

.hmo-step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  cursor: default;
}

/* Connector line between steps */
.hmo-step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: calc(var(--hmo-step-size) / 2);
  left: calc(50% + var(--hmo-step-size) / 2);
  right: calc(-50% + var(--hmo-step-size) / 2);
  height: 2px;
  background: var(--hmo-border);
  z-index: 0;
  transition: background 0.4s ease;
}

.hmo-step-item.completed:not(:last-child)::after {
  background: var(--hmo-accent);
}

/* Step circle */
.hmo-step-circle {
  width: var(--hmo-step-size);
  height: var(--hmo-step-size);
  border-radius: 50%;
  background: var(--hmo-bg);
  border: 2px solid var(--hmo-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--hmo-text-muted);
  position: relative;
  z-index: 1;
  transition: var(--hmo-transition);
  flex-shrink: 0;
}

.hmo-step-item.active .hmo-step-circle {
  background: var(--hmo-primary);
  border-color: var(--hmo-primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(44, 62, 80, 0.15);
}

.hmo-step-item.completed .hmo-step-circle {
  background: var(--hmo-accent);
  border-color: var(--hmo-accent);
  color: #fff;
}

.hmo-step-item.completed .hmo-step-num {
  display: none;
}

.hmo-step-item.completed .hmo-step-check {
  display: block;
}

.hmo-step-check {
  display: none;
}

/* Step label */
.hmo-step-label {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--hmo-text-muted);
  text-align: center;
  white-space: nowrap;
  transition: color 0.25s;
}

.hmo-step-item.active .hmo-step-label {
  color: var(--hmo-primary);
}

.hmo-step-item.completed .hmo-step-label {
  color: var(--hmo-accent);
}

/* Progress bar */
.hmo-progress-bar-wrap {
  margin-top: 18px;
  height: 4px;
  background: var(--hmo-border);
  border-radius: 2px;
  overflow: hidden;
}

.hmo-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--hmo-primary), var(--hmo-accent));
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ── Form Card ──────────────────────────────────────────────────────────────── */
.hmo-onboarding-form-wrap .wpcf7 {
  background: var(--hmo-white);
  border: 1px solid var(--hmo-border);
  border-radius: 0 0 var(--hmo-radius) var(--hmo-radius);
  box-shadow: var(--hmo-shadow);
  overflow: hidden;
}

/* ── Step Section ───────────────────────────────────────────────────────────── */
.hmo-step-section {
  display: none;
  padding: 32px 36px;
  animation: hmoSlideIn 0.3s ease;
}

.hmo-step-section.hmo-step-active {
  display: block;
}

@keyframes hmoSlideIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

.hmo-step-section-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--hmo-border);
}

.hmo-step-section-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--hmo-primary);
  margin: 0 0 4px;
}

.hmo-step-section-header p {
  font-size: 13px;
  color: var(--hmo-text-muted);
  margin: 0;
}

/* ── Field Styling ──────────────────────────────────────────────────────────── */
.hmo-step-section .hmo-field {
  margin-bottom: 20px;
}

.hmo-step-section label,
.hmo-step-section .wpcf7-form-control-wrap > span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--hmo-text);
  margin-bottom: 6px;
}

.hmo-step-section input[type="text"],
.hmo-step-section input[type="email"],
.hmo-step-section input[type="tel"],
.hmo-step-section input[type="date"],
.hmo-step-section input[type="number"],
.hmo-step-section select,
.hmo-step-section textarea {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  border: 1.5px solid var(--hmo-border);
  border-radius: 8px;
  background: #fff;
  color: var(--hmo-text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
}

.hmo-step-section input:focus,
.hmo-step-section select:focus,
.hmo-step-section textarea:focus {
  border-color: var(--hmo-primary);
  box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.hmo-step-section input.wpcf7-not-valid,
.hmo-step-section select.wpcf7-not-valid,
.hmo-step-section textarea.wpcf7-not-valid {
  border-color: var(--hmo-danger);
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.hmo-step-section .wpcf7-not-valid-tip {
  color: var(--hmo-danger);
  font-size: 12px;
  margin-top: 4px;
  display: block;
}

/* Two-column grid */
.hmo-field-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.hmo-field-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .hmo-field-row-2,
  .hmo-field-row-3 {
    grid-template-columns: 1fr;
  }
}

/* Consent / checkbox fields */
.hmo-step-section .hmo-consent-field {
  background: var(--hmo-bg);
  border: 1px solid var(--hmo-border);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.hmo-step-section .hmo-consent-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex-shrink: 0;
  accent-color: var(--hmo-accent);
}

/* File upload */
.hmo-step-section .hmo-upload-area {
  border: 2px dashed var(--hmo-border);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  transition: var(--hmo-transition);
  cursor: pointer;
  background: var(--hmo-bg);
}

.hmo-step-section .hmo-upload-area:hover,
.hmo-step-section .hmo-upload-area.dragover {
  border-color: var(--hmo-primary);
  background: rgba(44, 62, 80, 0.04);
}

.hmo-step-section .hmo-upload-area .hmo-upload-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 8px;
}

/* ── Navigation Buttons ─────────────────────────────────────────────────────── */
.hmo-step-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 36px 28px;
  border-top: 1px solid var(--hmo-border);
  background: var(--hmo-bg);
}

.hmo-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--hmo-transition);
  border: none;
  text-decoration: none;
  font-family: inherit;
}

.hmo-btn-prev {
  background: var(--hmo-white);
  border: 1.5px solid var(--hmo-border);
  color: var(--hmo-text-muted);
}

.hmo-btn-prev:hover {
  border-color: var(--hmo-primary);
  color: var(--hmo-primary);
  background: var(--hmo-white);
}

.hmo-btn-next {
  background: var(--hmo-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(44, 62, 80, 0.25);
}

.hmo-btn-next:hover {
  background: #1a252f;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(44, 62, 80, 0.3);
}

.hmo-btn-submit {
  background: var(--hmo-accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

.hmo-btn-submit:hover {
  background: #219a52;
  transform: translateY(-1px);
}

.hmo-btn:disabled,
.hmo-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.hmo-btn-invisible {
  visibility: hidden;
}

/* Step counter */
.hmo-step-counter {
  font-size: 13px;
  color: var(--hmo-text-muted);
}

.hmo-step-counter strong {
  color: var(--hmo-primary);
}

/* ── Step Review (final step summary) ──────────────────────────────────────── */
.hmo-review-section {
  padding: 32px 36px;
}

.hmo-review-block {
  margin-bottom: 24px;
  padding: 20px;
  background: var(--hmo-bg);
  border-radius: 8px;
  border: 1px solid var(--hmo-border);
}

.hmo-review-block h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--hmo-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 12px;
}

.hmo-review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  font-size: 14px;
}

.hmo-review-row {
  display: contents;
}

.hmo-review-key {
  color: var(--hmo-text-muted);
  font-weight: 500;
}

.hmo-review-val {
  color: var(--hmo-text);
  font-weight: 600;
}

/* ── Validation Alert ───────────────────────────────────────────────────────── */
.hmo-step-error {
  display: none;
  background: #fdecea;
  border: 1px solid #fbb;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--hmo-danger);
  margin: 0 36px 16px;
}

.hmo-step-error.visible {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── CF7 Response Output ────────────────────────────────────────────────────── */
.hmo-onboarding-form-wrap .wpcf7-response-output {
  margin: 16px 36px !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  border: 1.5px solid var(--hmo-border) !important;
}

.hmo-onboarding-form-wrap .wpcf7-mail-sent-ok {
  background: var(--hmo-accent-light);
  border-color: var(--hmo-accent) !important;
  color: #155724 !important;
}

.hmo-onboarding-form-wrap .wpcf7-validation-errors {
  background: #fdecea;
  border-color: var(--hmo-danger) !important;
  color: #721c24 !important;
}

/* ── Success Screen ─────────────────────────────────────────────────────────── */
.hmo-form-success {
  display: none;
  text-align: center;
  padding: 48px 36px;
  background: var(--hmo-white);
  border: 1px solid var(--hmo-border);
  border-radius: var(--hmo-radius);
  box-shadow: var(--hmo-shadow);
}

.hmo-form-success.visible {
  display: block;
  animation: hmoFadeIn 0.4s ease;
}

@keyframes hmoFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.hmo-success-icon {
  width: 72px;
  height: 72px;
  background: var(--hmo-accent-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 36px;
}

.hmo-form-success h3 {
  font-size: 24px;
  color: var(--hmo-primary);
  margin: 0 0 10px;
}

.hmo-form-success p {
  color: var(--hmo-text-muted);
  font-size: 15px;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hmo-steps-header,
  .hmo-step-section,
  .hmo-step-nav {
    padding-left: 20px;
    padding-right: 20px;
  }

  .hmo-stepper {
    gap: 0;
  }

  .hmo-step-label {
    display: none;
  }

  .hmo-step-item.active .hmo-step-label {
    display: block;
    position: absolute;
    top: calc(var(--hmo-step-size) + 6px);
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: var(--hmo-primary);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
  }

  .hmo-steps-header {
    padding-bottom: 36px;
  }
}
