/* ── Maxlab Multi-Step Form Modal ── */

.fm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 14, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
.fm-overlay.fm-open {
  opacity: 1;
  visibility: visible;
}

.fm-modal {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.22);
  transform: translateY(24px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.fm-overlay.fm-open .fm-modal {
  transform: translateY(0) scale(1);
}

/* Header */
.fm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 14px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.fm-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: #EA2B16;
  padding: 5px 14px;
  border-radius: 100px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.fm-badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
}
.fm-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  font-size: 20px;
  line-height: 1;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.fm-close:hover {
  background: #f5f5f5;
  color: #111;
  border-color: rgba(0, 0, 0, 0.15);
}

/* Progress */
.fm-progress-wrap {
  padding: 14px 24px 0;
  flex-shrink: 0;
}
.fm-progress-track {
  height: 3px;
  background: #f0f0f0;
  border-radius: 10px;
  overflow: hidden;
}
.fm-progress-fill {
  height: 100%;
  background: #EA2B16;
  border-radius: 10px;
  transition: width 0.4s ease;
}
.fm-progress-label {
  font-size: 12px;
  font-weight: 600;
  color: #aaa;
  margin-top: 7px;
  letter-spacing: 0.02em;
}

/* Body */
.fm-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 8px;
  position: relative;
}

/* Steps */
.fm-step {
  display: none;
}
.fm-step.active {
  display: block;
  animation: fmIn 0.28s ease;
}
.fm-step.slide-back.active {
  animation: fmInBack 0.28s ease;
}
@keyframes fmIn {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fmInBack {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}

.fm-step-title {
  font-size: 20px;
  font-weight: 800;
  color: #08080E;
  margin-bottom: 5px;
  line-height: 1.25;
}
.fm-step-sub {
  font-size: 13px;
  color: #999;
  margin-bottom: 22px;
  line-height: 1.5;
}

/* Single-select options */
.fm-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.fm-opt {
  padding: 14px 16px;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, color 0.18s;
  line-height: 1.3;
}
.fm-opt:hover {
  border-color: #EA2B16;
  background: rgba(234, 43, 22, 0.04);
}
.fm-opt.selected {
  border-color: #EA2B16;
  background: rgba(234, 43, 22, 0.06);
  color: #EA2B16;
}

/* Chips (multi-select) */
.fm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.fm-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 14px;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}
.fm-chip-label {
  font-size: 13px;
  font-weight: 700;
  color: #222;
  line-height: 1.2;
  transition: color 0.18s;
}
.fm-chip-service {
  font-size: 10px;
  font-weight: 600;
  color: #bbb;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  transition: color 0.18s;
}
.fm-chip:hover {
  border-color: #EA2B16;
  background: rgba(234, 43, 22, 0.04);
}
.fm-chip:hover .fm-chip-label { color: #EA2B16; }
.fm-chip.selected {
  border-color: #EA2B16;
  background: rgba(234, 43, 22, 0.07);
}
.fm-chip.selected .fm-chip-label  { color: #EA2B16; }
.fm-chip.selected .fm-chip-service { color: rgba(234, 43, 22, 0.5); }

/* Textarea */
.fm-textarea-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
}
.fm-textarea {
  width: 100%;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  font-family: inherit;
  color: #333;
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: border-color 0.18s;
  box-sizing: border-box;
}
.fm-textarea:focus { border-color: #EA2B16; }

/* Fields */
.fm-field { margin-bottom: 14px; }
.fm-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}
.fm-label-opt {
  font-weight: 400;
  color: #bbb;
  font-size: 12px;
}
.fm-input {
  width: 100%;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  color: #333;
  outline: none;
  transition: border-color 0.18s;
  box-sizing: border-box;
}
.fm-input:focus { border-color: #EA2B16; }
.fm-input.fm-error { border-color: #DC2626; }
.fm-err-msg {
  font-size: 11px;
  color: #DC2626;
  margin-top: 4px;
  font-weight: 500;
  display: none;
}
.fm-err-msg.show { display: block; }
.fm-submit-error {
  display: none;
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(220, 38, 38, 0.08);
  color: #B91C1C;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}
.fm-submit-error.show { display: block; }

/* Footer */
.fm-footer {
  padding: 14px 24px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
  gap: 12px;
}
.fm-back-btn {
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: #bbb;
  cursor: pointer;
  padding: 10px 0;
  transition: color 0.18s;
  flex-shrink: 0;
}
.fm-back-btn:hover:not(:disabled) { color: #333; }
.fm-back-btn:disabled { visibility: hidden; }

.fm-next-btn {
  background: #EA2B16;
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 13px 30px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: opacity 0.18s, transform 0.15s;
  white-space: nowrap;
}
.fm-next-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.fm-next-btn:not(:disabled):hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

/* Confirmation */
.fm-confirm {
  text-align: center;
  padding: 12px 0 16px;
}
.fm-confirm-icon {
  width: 58px;
  height: 58px;
  background: rgba(22, 163, 74, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}
.fm-confirm-icon svg {
  width: 26px;
  height: 26px;
  stroke: #16a34a;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fm-confirm-title {
  font-size: 24px;
  font-weight: 800;
  color: #08080E;
  margin-bottom: 8px;
}
.fm-confirm-sub {
  font-size: 14px;
  color: #888;
  margin-bottom: 24px;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}
.fm-ref-box {
  background: #F4F4F5;
  border-radius: 12px;
  padding: 16px 18px;
  text-align: left;
  margin-bottom: 16px;
}
.fm-ref-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #999;
}
.fm-ref-row + .fm-ref-row { margin-top: 10px; }
.fm-ref-val {
  font-weight: 700;
  color: #222;
  font-size: 13px;
}
.fm-next-steps {
  font-size: 13px;
  color: #aaa;
  line-height: 1.65;
  max-width: 380px;
  margin: 0 auto;
}

/* Mobile */
@media (max-width: 600px) {
  .fm-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .fm-modal {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
  }
  .fm-options {
    grid-template-columns: 1fr;
  }
}
