/* ============================================================================
   forms-pro.css — advanced form experience (wizard, validation, review)
   Layered on top of styles.css. Uses the existing dark palette variables and
   degrades gracefully: without JS every step is visible and the form is a
   normal single-page form.
   ========================================================================== */

.form-card {
  position: relative;
}

/* ---------------------------------------------------------------- stepper */
.wz-head {
  margin: 0 0 1.25rem;
}

.wz-progress {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, .18);
  overflow: hidden;
}

.wz-progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6, #6366f1 60%, #22d3ee);
  transition: width .35s cubic-bezier(.4, 0, .2, 1);
}

.wz-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin: .5rem 0 0;
  font-size: .78rem;
  letter-spacing: .01em;
  color: rgba(148, 163, 184, .95);
}

.wz-progress-meta strong {
  color: #e2e8f5;
  font-weight: 600;
}

.wz-steps {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  list-style: none;
  margin: .9rem 0 0;
  padding: 0;
}

.wz-steps li {
  flex: 1 1 auto;
}

.wz-step-btn {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 12px;
  background: rgba(15, 23, 42, .45);
  color: rgba(148, 163, 184, .95);
  font: inherit;
  font-size: .82rem;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s, background .2s, color .2s, transform .2s;
}

.wz-step-btn:hover {
  border-color: rgba(99, 102, 241, .45);
  color: #e2e8f5;
}

.wz-step-btn:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.wz-step-index {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-size: .7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.wz-step-btn[aria-current="step"] {
  border-color: rgba(99, 102, 241, .75);
  background: rgba(99, 102, 241, .16);
  color: #eef2ff;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, .25) inset;
}

.wz-step-btn.is-done {
  color: #a7f3d0;
  border-color: rgba(16, 185, 129, .4);
  background: rgba(16, 185, 129, .1);
}

.wz-step-btn.is-done .wz-step-index {
  background: rgba(16, 185, 129, .22);
}

.wz-step-btn.is-invalid {
  color: #fecaca;
  border-color: rgba(248, 113, 113, .5);
  background: rgba(248, 113, 113, .1);
}

.wz-step-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .wz-step-label { display: none; }
  .wz-steps li { flex: 0 0 auto; }
  .wz-step-btn { justify-content: center; padding: .45rem .55rem; }
}

/* ------------------------------------------------------------------ steps */
form.wz [data-step] {
  animation: wzIn .28s ease both;
}

form.wz [data-step][hidden] {
  display: none !important;
}

@keyframes wzIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  form.wz [data-step] { animation: none; }
  .wz-progress-bar { transition: none; }
}

.wz-step-head {
  margin: 0 0 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid rgba(148, 163, 184, .14);
}

.wz-step-head h2 {
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: -.01em;
}

.wz-step-head p {
  margin: .3rem 0 0;
  font-size: .85rem;
  color: rgba(148, 163, 184, .95);
}

/* ------------------------------------------------------------- navigation */
.wz-nav {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(148, 163, 184, .14);
}

.wz-nav .wz-spacer { flex: 1 1 auto; }

.wz-nav-hint {
  flex: 1 1 100%;
  order: 3;
  margin: 0;
  font-size: .75rem;
  color: rgba(148, 163, 184, .8);
}

/* -------------------------------------------------------- field validation */
.field.is-invalid input,
.field.is-invalid textarea,
.field.is-invalid select,
.check.is-invalid {
  border-color: rgba(248, 113, 113, .8) !important;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, .14);
}

.field.is-valid input:not([disabled]),
.field.is-valid textarea,
.field.is-valid select {
  border-color: rgba(16, 185, 129, .45);
}

.fmsg {
  display: flex;
  align-items: flex-start;
  gap: .35rem;
  margin: .4rem 0 0;
  font-size: .78rem;
  color: #fca5a5;
}

.fmsg[hidden] { display: none; }

.fmsg::before {
  content: "!";
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  border-radius: 50%;
  background: rgba(248, 113, 113, .18);
  font-size: .65rem;
  font-weight: 700;
}

/* live counters */
.f-count {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin: .4rem 0 0;
  font-size: .74rem;
  font-variant-numeric: tabular-nums;
  color: rgba(148, 163, 184, .85);
}

.f-count-meter {
  position: relative;
  flex: 1 1 auto;
  max-width: 180px;
  height: 4px;
  border-radius: 999px;
  background: rgba(148, 163, 184, .16);
  overflow: hidden;
}

.f-count-meter i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: #6366f1;
  transition: width .2s linear, background .2s;
}

.f-count.is-short i { background: #f59e0b; }
.f-count.is-ok i    { background: #10b981; }
.f-count.is-near    { color: #fcd34d; }
.f-count.is-full    { color: #fca5a5; }
.f-count.is-full i  { background: #ef4444; }

/* -------------------------------------------------------- error summary */
.wz-errors {
  margin: 0 0 1rem;
  padding: .9rem 1rem;
  border: 1px solid rgba(248, 113, 113, .45);
  border-radius: 14px;
  background: rgba(248, 113, 113, .1);
}

.wz-errors[hidden] { display: none; }

.wz-errors h3 {
  margin: 0 0 .4rem;
  font-size: .9rem;
  color: #fecaca;
}

.wz-errors ol {
  margin: 0;
  padding-left: 1.1rem;
  font-size: .82rem;
  color: #fecaca;
}

.wz-errors a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* -------------------------------------------------------------- review */
.wz-review {
  margin: 0;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 14px;
  background: rgba(15, 23, 42, .4);
  overflow: hidden;
}

.wz-review-row {
  display: grid;
  grid-template-columns: minmax(140px, 34%) 1fr auto;
  gap: .6rem 1rem;
  align-items: start;
  padding: .7rem .9rem;
  border-top: 1px solid rgba(148, 163, 184, .12);
  font-size: .85rem;
}

.wz-review-row:first-child { border-top: 0; }

.wz-review-row dt {
  margin: 0;
  color: rgba(148, 163, 184, .95);
  font-weight: 500;
}

.wz-review-row dd {
  margin: 0;
  color: #e2e8f5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.wz-review-row dd.is-empty {
  color: rgba(148, 163, 184, .7);
  font-style: italic;
}

.wz-review-edit {
  border: 0;
  background: none;
  padding: 0;
  color: #93c5fd;
  font: inherit;
  font-size: .78rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 620px) {
  .wz-review-row { grid-template-columns: 1fr auto; }
  .wz-review-row dd { grid-column: 1 / -1; }
}

/* --------------------------------------------------------- autosave bar */
.draft-bar,
.wz-draft {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  font-size: .76rem;
  color: rgba(148, 163, 184, .9);
}

.wz-draft-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .18);
}

.wz-draft-dot.is-idle { background: rgba(148, 163, 184, .7); box-shadow: none; }

/* ------------------------------------------------------------ dropzone+ */
.dropzone.is-over {
  border-color: rgba(99, 102, 241, .8) !important;
  background: rgba(99, 102, 241, .1);
}

.dz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: .6rem;
  margin: .75rem 0 0;
  padding: 0;
  list-style: none;
}

.dz-item {
  position: relative;
  border: 1px solid rgba(148, 163, 184, .2);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(15, 23, 42, .5);
}

.dz-item img {
  display: block;
  width: 100%;
  height: 74px;
  object-fit: cover;
}

.dz-item figcaption {
  display: block;
  padding: .35rem .45rem;
  font-size: .68rem;
  line-height: 1.3;
  color: rgba(148, 163, 184, .95);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dz-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(2, 6, 23, .78);
  color: #fff;
  font-size: .8rem;
  line-height: 1;
  cursor: pointer;
}

.dz-remove:hover { background: #ef4444; }

.dz-item.is-bad { border-color: rgba(248, 113, 113, .7); }

.dz-note {
  margin: .5rem 0 0;
  font-size: .74rem;
  color: rgba(148, 163, 184, .85);
}

.dz-note.is-bad { color: #fca5a5; }

/* --------------------------------------------------------- misc polish */
.wz-tip {
  display: flex;
  gap: .55rem;
  margin: 0 0 1rem;
  padding: .7rem .85rem;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, .28);
  background: rgba(99, 102, 241, .08);
  font-size: .8rem;
  color: rgba(226, 232, 245, .92);
}

.wz-shake { animation: wzShake .32s ease; }

@keyframes wzShake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-3px); }
  40%, 60% { transform: translateX(3px); }
}

.wz-submitting {
  position: relative;
  pointer-events: none;
}

.wz-submitting::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(2, 6, 23, .35);
  backdrop-filter: blur(1px);
}
