/*
 * Multi-Step Form — Stylesheet
 * Credit: lautandigital.id
 * © 2026 lautandigital.id — All rights reserved.
 */

/* ─── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --clr-primary:      #4f46e5;
  --clr-primary-dark: #3730a3;
  --clr-primary-light:#eef2ff;
  --clr-accent:       #06b6d4;
  --clr-success:      #16a34a;
  --clr-error:        #dc2626;
  --clr-warning:      #d97706;
  --clr-bg:           #f8fafc;
  --clr-surface:      #ffffff;
  --clr-border:       #e2e8f0;
  --clr-text:         #1e293b;
  --clr-muted:        #64748b;
  --clr-placeholder:  #94a3b8;

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-full: 9999px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:  0 4px 16px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.05);
  --shadow-lg:  0 20px 40px rgba(79,70,229,.12);

  --transition: .2s ease;
  --font:       'Segoe UI', system-ui, -apple-system, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--clr-text);
  background: linear-gradient(135deg, #e0e7ff 0%, #f0fdfa 50%, #fdf4ff 100%);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px 60px;
}

/* ─── Page Wrapper ─────────────────────────────────────── */
.page-wrapper {
  width: 100%;
  max-width: 680px;
}

/* ─── Header ───────────────────────────────────────────── */
.page-header {
  text-align: center;
  margin-bottom: 28px;
}

.brand {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--clr-primary);
  background: var(--clr-primary-light);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-full);
  padding: 4px 14px;
  margin-bottom: 10px;
}

.page-header h1 {
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 800;
  color: var(--clr-text);
  letter-spacing: -.3px;
}

/* ─── Progress ─────────────────────────────────────────── */
.progress-container {
  background: var(--clr-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 28px;
  margin-bottom: 20px;
  border: 1px solid var(--clr-border);
}

.progress-track {
  height: 6px;
  background: var(--clr-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 18px;
}

.progress-fill {
  height: 100%;
  width: 25%;
  background: linear-gradient(90deg, var(--clr-primary), var(--clr-accent));
  border-radius: var(--radius-full);
  transition: width .4s cubic-bezier(.4,0,.2,1);
}

.steps-indicator {
  display: flex;
  justify-content: space-between;
}

.step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: default;
  flex: 1;
}

.dot-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--clr-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--clr-muted);
  background: var(--clr-bg);
  transition: all var(--transition);
}

.dot-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--clr-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  transition: color var(--transition);
}

.step-dot.active .dot-icon {
  background: var(--clr-primary);
  border-color: var(--clr-primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(79,70,229,.15);
}

.step-dot.active .dot-label {
  color: var(--clr-primary);
}

.step-dot.completed .dot-icon {
  background: var(--clr-success);
  border-color: var(--clr-success);
  color: #fff;
}

.step-dot.completed .dot-label {
  color: var(--clr-success);
}

/* checkmark for completed */
.step-dot.completed .dot-icon::after {
  content: '✓';
  font-size: 14px;
}

.step-dot.completed .dot-icon {
  font-size: 0;
}

/* ─── Form Card ────────────────────────────────────────── */
form {
  background: var(--clr-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--clr-border);
  padding: 36px 40px;
  overflow: hidden;
}

/* ─── Form Step ────────────────────────────────────────── */
.form-step {
  display: none;
  animation: fadeSlideIn .3s ease forwards;
}

.form-step.active {
  display: block;
}

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

@keyframes fadeSlideInReverse {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.form-step.going-back {
  animation: fadeSlideInReverse .3s ease forwards;
}

/* ─── Step Header ──────────────────────────────────────── */
.step-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--clr-border);
}

.step-number {
  font-size: 40px;
  font-weight: 900;
  color: var(--clr-primary-light);
  line-height: 1;
  letter-spacing: -2px;
  border: 2px solid #e0e7ff;
  border-radius: var(--radius-md);
  padding: 6px 12px;
  background: linear-gradient(135deg, var(--clr-primary-light), #fff);
  color: var(--clr-primary);
  min-width: 72px;
  text-align: center;
}

.step-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--clr-text);
}

.step-header p {
  font-size: 13px;
  color: var(--clr-muted);
  margin-top: 2px;
}

/* ─── Fields Grid ──────────────────────────────────────── */
.fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--clr-text);
}

.required {
  color: var(--clr-error);
  margin-left: 2px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--clr-text);
  background: var(--clr-bg);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
  appearance: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--clr-placeholder);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
  background: #fff;
}

input.is-invalid,
textarea.is-invalid,
select.is-invalid {
  border-color: var(--clr-error);
  box-shadow: 0 0 0 3px rgba(220,38,38,.1);
}

input.is-valid,
textarea.is-valid,
select.is-valid {
  border-color: var(--clr-success);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* ─── Error & Hint ─────────────────────────────────────── */
.error-msg {
  font-size: 12px;
  color: var(--clr-error);
  min-height: 16px;
  display: none;
}

.error-msg.visible {
  display: block;
}

.field-hint {
  font-size: 12px;
  color: var(--clr-muted);
}

/* ─── Radio & Checkbox ─────────────────────────────────── */
.radio-group {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.radio-option,
.checkbox-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 400;
  color: var(--clr-text);
  cursor: pointer;
  user-select: none;
}

.radio-option input[type="radio"],
.checkbox-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--clr-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.link {
  color: var(--clr-primary);
  text-decoration: none;
  font-weight: 600;
}

.link:hover {
  text-decoration: underline;
}

/* ─── Password Toggle ──────────────────────────────────── */
.input-password-wrap {
  position: relative;
}

.input-password-wrap input {
  padding-right: 44px;
}

.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--clr-muted);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}

.toggle-pw:hover {
  color: var(--clr-primary);
}

.toggle-pw .icon-eye {
  width: 18px;
  height: 18px;
}

/* ─── Password Strength ────────────────────────────────── */
.strength-bar {
  height: 4px;
  background: var(--clr-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 6px;
}

.strength-fill {
  height: 100%;
  width: 0;
  border-radius: var(--radius-full);
  transition: width .3s ease, background .3s ease;
}

.strength-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  min-height: 14px;
}

/* ─── Summary / Confirmation ───────────────────────────── */
.summary-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.summary-section {
  background: var(--clr-bg);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}

.summary-section h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--clr-primary);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--clr-border);
}

.summary-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
}

.summary-list dt {
  font-size: 13px;
  font-weight: 600;
  color: var(--clr-muted);
  white-space: nowrap;
}

.summary-list dd {
  font-size: 14px;
  color: var(--clr-text);
  word-break: break-word;
}

/* ─── Navigation Buttons ───────────────────────────────── */
.form-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--clr-border);
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1;
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-secondary {
  background: var(--clr-bg);
  color: var(--clr-muted);
  border: 1.5px solid var(--clr-border);
}

.btn-secondary:hover:not(:disabled) {
  background: #f1f5f9;
  color: var(--clr-text);
  border-color: #cbd5e1;
}

.btn-primary {
  background: var(--clr-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79,70,229,.3);
  margin-left: auto;
}

.btn-primary:hover:not(:disabled) {
  background: var(--clr-primary-dark);
  box-shadow: 0 4px 16px rgba(79,70,229,.4);
  transform: translateY(-1px);
}

.btn-submit {
  background: linear-gradient(135deg, var(--clr-success), #15803d);
  color: #fff;
  box-shadow: 0 2px 8px rgba(22,163,74,.3);
  margin-left: auto;
}

.btn-submit:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(22,163,74,.4);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none !important;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

/* ─── Success Screen ───────────────────────────────────── */
.success-screen {
  background: var(--clr-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--clr-border);
  padding: 60px 40px;
  text-align: center;
  animation: fadeSlideIn .4s ease;
}

.success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  color: var(--clr-success);
}

.success-icon svg {
  width: 100%;
  height: 100%;
  stroke: var(--clr-success);
}

.success-icon circle {
  animation: drawCircle .6s ease forwards;
}

.success-icon polyline {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: drawCheck .4s .5s ease forwards;
}

@keyframes drawCircle {
  from { stroke-dasharray: 0 160; }
  to   { stroke-dasharray: 160 160; }
}

@keyframes drawCheck {
  to { stroke-dashoffset: 0; }
}

.success-screen h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--clr-text);
  margin-bottom: 10px;
}

.success-screen p {
  font-size: 14px;
  color: var(--clr-muted);
  margin-bottom: 28px;
}

/* ─── Footer ───────────────────────────────────────────── */
.page-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: var(--clr-muted);
}

.page-footer a {
  color: var(--clr-primary);
  text-decoration: none;
  font-weight: 600;
}

.page-footer a:hover {
  text-decoration: underline;
}

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 600px) {
  body {
    padding: 16px 12px 48px;
  }

  form {
    padding: 24px 20px;
  }

  .fields-grid {
    grid-template-columns: 1fr;
  }

  .field-group.full-width {
    grid-column: unset;
  }

  .progress-container {
    padding: 16px 20px;
  }

  .dot-label {
    display: none;
  }

  .step-number {
    font-size: 28px;
    min-width: 56px;
    padding: 4px 10px;
  }

  .step-header h2 {
    font-size: 18px;
  }

  .form-navigation {
    flex-wrap: wrap;
  }

  .btn-primary,
  .btn-submit {
    margin-left: unset;
    flex: 1;
    justify-content: center;
  }

  .btn-secondary {
    flex: 1;
    justify-content: center;
  }
}
