/* ===== Variables ===== */
:root {
  --purple-dark: #1a0a3e;
  --purple: #6F3BF0;
  --purple-light: #ede9fe;
  --orange: #F5A623;
  --orange-hover: #e09500;
  --green: #10b981;
  --red: #ef4444;
  --bg: #f8f7fc;
  --white: #ffffff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 4px 24px rgba(26, 10, 62, 0.08);
  --shadow-lg: 0 8px 40px rgba(26, 10, 62, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 24px 16px 80px;
}

/* ===== Layout ===== */
.cadastro-wrapper {
  max-width: 720px;
  margin: 0 auto;
}

.cadastro-header {
  text-align: center;
  padding: 16px 0 24px;
}
.cadastro-header .logo {
  height: 48px;
  width: auto;
}

/* ===== Progress Nav ===== */
.progress-nav {
  position: relative;
  margin-bottom: 24px;
}

.progress-track {
  position: absolute;
  top: 18px;
  left: 10%;
  right: 10%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  z-index: 0;
}
.progress-fill {
  height: 100%;
  background: var(--purple);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  outline: none;
}
.progress-step:disabled { cursor: default; }

.step-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.progress-step.active .step-dot,
.progress-step.completed .step-dot {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}
.progress-step.completed .step-dot {
  background: var(--green);
  border-color: var(--green);
}

.step-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}
.progress-step.active .step-label { color: var(--purple); font-weight: 600; }
.progress-step.completed .step-label { color: var(--green); }

/* ===== Form Card ===== */
.form-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  position: relative;
  overflow: hidden;
}

/* ===== Steps ===== */
.step { display: none; animation: fadeIn 0.3s ease; }
.step.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.step-header {
  text-align: center;
  margin-bottom: 28px;
}
.step-icon {
  font-size: 32px;
  color: var(--purple);
  margin-bottom: 8px;
}
.step-header h2 {
  font-size: 22px;
  color: var(--purple-dark);
  margin-bottom: 4px;
}
.step-header p {
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== Fields Grid ===== */
.fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.field.full { grid-column: 1 / -1; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.required { color: var(--red); }

.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.field input:focus,
.field select:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(111, 59, 240, 0.1);
}
.field input.error,
.field select.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
.field input.autofilled,
.field select.autofilled {
  background: #fefce8;
  border-color: #fbbf24;
}
.field {
  position: relative;
}
.field input.loading,
.field select.loading {
  background: #f3f4f6;
  color: var(--text-muted);
  cursor: wait;
  border-color: var(--border);
}
.field .field-spinner {
  position: absolute;
  right: 12px;
  bottom: 14px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  pointer-events: none;
}

.field-hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.error-msg {
  font-size: 12px;
  color: var(--red);
  margin-top: 4px;
  display: block;
}

/* ===== Radio Cards ===== */
.radio-row {
  display: flex;
  gap: 12px;
}
.radio-card {
  flex: 1;
  cursor: pointer;
}
.radio-card input { display: none; }
.radio-card span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s;
}
.radio-card input:checked + span {
  border-color: var(--purple);
  background: var(--purple-light);
  color: var(--purple);
}

/* ===== Conditional Fields ===== */
.conditional-fields {
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  margin-bottom: 8px;
}

/* ===== Divider & Subsection ===== */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}
.subsection-title {
  font-size: 15px;
  color: var(--purple-dark);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.subsection-title i { color: var(--purple); }
.subsection-title small { color: var(--text-muted); font-weight: 400; font-size: 13px; }

/* ===== Replicate Toggle ===== */
.replicate-toggle {
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--purple-light);
  border-radius: var(--radius-sm);
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--purple-dark);
}
.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--purple);
}

/* ===== Buttons ===== */
.step-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn-primary {
  background: var(--purple);
  color: #fff;
}
.btn-primary:hover { background: #5a2fc7; transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  color: var(--purple);
  border: 1.5px solid var(--purple);
}
.btn-outline:hover { background: var(--purple-light); }

.btn-submit {
  background: var(--orange);
  color: #fff;
  font-size: 16px;
  padding: 14px 32px;
}
.btn-submit:hover { background: var(--orange-hover); transform: translateY(-1px); }
.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ===== Review Table ===== */
.review-table {
  margin-bottom: 24px;
}
.review-group {
  margin-bottom: 16px;
}
.review-group-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--purple);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--purple-light);
}
.review-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid #f3f4f6;
}
.review-row .label { color: var(--text-muted); }
.review-row .value { font-weight: 500; text-align: right; max-width: 60%; word-break: break-word; }

/* ===== Upload ===== */
.upload-section { margin-bottom: 16px; }
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.upload-area:hover {
  border-color: var(--purple);
  background: var(--purple-light);
}
.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.upload-placeholder i { font-size: 32px; color: var(--purple); }
.upload-placeholder small { font-size: 12px; }
.upload-preview { position: relative; }
.upload-preview img {
  max-height: 120px;
  max-width: 100%;
  border-radius: var(--radius-sm);
}
.btn-remove-img {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Success ===== */
.success-screen {
  text-align: center;
  padding: 40px 20px;
}
.success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  animation: scaleIn 0.5s ease;
}
@keyframes scaleIn {
  from { transform: scale(0); }
  to { transform: scale(1); }
}
.success-screen h2 { font-size: 24px; color: var(--purple-dark); margin-bottom: 8px; }
.success-screen p { color: var(--text-muted); margin-bottom: 24px; line-height: 1.6; }

/* ===== WhatsApp Bubble ===== */
.whatsapp-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #25D366;
  color: #fff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
  text-decoration: none;
  transition: transform 0.2s;
  z-index: 100;
}
.whatsapp-bubble:hover { transform: scale(1.1); }
.whatsapp-text {
  position: absolute;
  right: 64px;
  background: #fff;
  color: #333;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.whatsapp-bubble:hover .whatsapp-text { opacity: 1; }

/* ===== Confetti ===== */
.confetti {
  position: fixed;
  top: -10px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  z-index: 1000;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { top: 110vh; transform: rotate(720deg); opacity: 0; }
}

/* ===== Loading Spinner ===== */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Responsive ===== */
@media (max-width: 600px) {
  body { padding: 16px 12px 80px; }
  .form-card { padding: 20px 16px; }
  .fields-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: 1; }
  .step-label { display: none; }
  .step-dot { width: 32px; height: 32px; font-size: 13px; }
  .step-actions { flex-direction: column-reverse; gap: 12px; }
  .step-actions .btn { width: 100%; justify-content: center; }
  .review-row { flex-direction: column; gap: 2px; }
  .review-row .value { text-align: left; max-width: 100%; }
}
