/* ===================================================
   INOVE Dent – cadastro.css  (multi-step wizard)
=================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:       #1A6FC4;
  --blue-dark:  #0F4A8A;
  --blue-faint: #EBF4FF;
  --gray-dark:  #1E2D3D;
  --gray-mid:   #4A5568;
  --gray-bg:    #F3F7FB;
  --white:      #FFFFFF;
  --green:      #25D366;
  --green-dk:   #128C7E;
  --red:        #E53E3E;
  --green-ok:   #38A169;
  --tr:         .3s cubic-bezier(.4,0,.2,1);
  --font:       'Inter', system-ui, sans-serif;
  --shadow:     0 4px 24px rgba(26,111,196,.10);
  --shadow-lg:  0 12px 48px rgba(26,111,196,.16);
}

/* body styles removidos — agora controlados pelo .cad-overlay em style.css */
img { max-width: 100%; display: block; }
a   { text-decoration: none; color: inherit; }

/* ── HEADER ── */
.cad-header {
  background: var(--white);
  border-bottom: 1px solid rgba(26,111,196,.10);
  position: sticky;
  top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.cad-header__inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cad-header__logo img { height: 42px; width: auto; }
.cad-header__back {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .85rem; font-weight: 600; color: var(--blue);
  padding: 8px 16px; border-radius: 8px;
  border: 1.5px solid rgba(26,111,196,.25);
  transition: var(--tr);
  background: none;
  font-family: inherit;
  cursor: pointer;
}
.cad-header__back:hover { background: var(--blue-faint); border-color: var(--blue); }

/* ── STRIPE ── */
.cad-stripe {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 100%);
  padding: 32px 24px;
}
.cad-stripe__inner {
  max-width: 860px; margin: 0 auto;
  display: flex; align-items: center; gap: 18px;
}
.cad-stripe__icon {
  width: 60px; height: 60px;
  background: rgba(255,255,255,.15);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: var(--white); flex-shrink: 0;
}
.cad-stripe__title {
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  font-weight: 800; color: var(--white);
}
.cad-stripe__sub { font-size: .9rem; color: rgba(255,255,255,.8); margin-top: 3px; }

/* ── DOB (data de nascimento) ── */
.dob-grid {
  display: grid;
  grid-template-columns: 76px 1fr 96px;
  gap: 8px;
}

/* ── MAIN ── */
.cad-main { flex: 1; max-width: 860px; width: 100%; margin: 0 auto; padding: 36px 24px 72px; }

/* ── CARD ── */
.cad-card {
  background: var(--white);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* ── PROGRESS BAR ── */
.progress-bar {
  height: 4px;
  background: #E2E8F0;
}
.progress-bar__fill {
  height: 100%;
  background: linear-gradient(to right, var(--blue-dark), var(--blue));
  width: 33.33%;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}

/* ── STEP INDICATORS ── */
.steps-header {
  display: flex;
  align-items: center;
  padding: 28px 40px 0;
  gap: 0;
}
.step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.step-indicator__dot {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid #CBD5E0;
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transition: var(--tr);
}
.step-indicator__num {
  font-size: .88rem; font-weight: 700; color: #A0AEC0;
  transition: var(--tr);
}
.step-indicator__check {
  position: absolute;
  opacity: 0;
  color: var(--white);
  transition: var(--tr);
}
.step-indicator__label {
  font-size: .72rem; font-weight: 600; color: #A0AEC0;
  white-space: nowrap; transition: var(--tr);
}

/* Estado: ativo */
.step-indicator.active .step-indicator__dot {
  border-color: var(--blue);
  background: var(--blue);
  box-shadow: 0 0 0 5px rgba(26,111,196,.15);
}
.step-indicator.active .step-indicator__num { color: var(--white); }
.step-indicator.active .step-indicator__label { color: var(--blue); font-weight: 700; }

/* Estado: concluído */
.step-indicator.done .step-indicator__dot {
  border-color: var(--green-ok);
  background: var(--green-ok);
}
.step-indicator.done .step-indicator__num { opacity: 0; }
.step-indicator.done .step-indicator__check { opacity: 1; }
.step-indicator.done .step-indicator__label { color: var(--green-ok); }

/* Conector */
.step-connector {
  flex: 1;
  height: 2px;
  background: #E2E8F0;
  margin: 0 8px 22px;
  transition: background .4s ease;
}
.step-connector.done { background: var(--green-ok); }

/* ── STEPS WRAPPER ── */
.steps-wrapper {
  padding: 32px 40px 40px;
}

/* ── STEP PANEL ── */
.step-panel {
  display: none;
}
.step-panel.active {
  display: block;
}
.step-panel.anim-forward {
  animation: slideIn .38s cubic-bezier(.4,0,.2,1) both;
}
.step-panel.anim-back {
  animation: slideInBack .38s cubic-bezier(.4,0,.2,1) both;
}

@keyframes slideIn     { from { opacity:0; transform: translateX(48px);  } to { opacity:1; transform: translateX(0); } }
@keyframes slideInBack { from { opacity:0; transform: translateX(-48px); } to { opacity:1; transform: translateX(0); } }

/* ── PANEL HEADER ── */
.step-panel__header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid #EEF2F7;
}
.step-panel__icon {
  width: 48px; height: 48px;
  background: var(--blue-faint);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--blue); flex-shrink: 0;
}
.step-panel__title {
  font-size: 1.15rem; font-weight: 800; color: var(--gray-dark);
}
.step-panel__sub {
  font-size: .83rem; color: var(--gray-mid); margin-top: 2px;
}

/* ── FIELD GRID ── */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 24px;
}
.field--full        { grid-column: 1 / -1; }
.field--cep-block   { grid-column: 1; }
.field--num         { grid-column: 2; }

/* ── FIELD ── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: .8rem; font-weight: 600; color: var(--gray-dark); letter-spacing: .01em;
}
.req { color: var(--blue); margin-left: 2px; }
.opt { color: var(--gray-mid); font-weight: 400; font-size: .76rem; }

.field input,
.field textarea {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid #CBD5E0;
  border-radius: 8px;
  font-family: var(--font); font-size: .92rem; color: var(--gray-dark);
  background: var(--white);
  transition: border-color var(--tr), box-shadow var(--tr);
  outline: none;
}
.field input:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,111,196,.12);
}
.field input.invalid, .field textarea.invalid { border-color: var(--red); }
.field input[readonly] {
  background: #F7FAFC; color: var(--gray-mid);
  cursor: default; border-style: dashed;
}
.field textarea { resize: vertical; min-height: 96px; }

.field__err {
  font-size: .74rem; color: var(--red);
  display: none;
}
.field input.invalid ~ .field__err,
.field textarea.invalid ~ .field__err { display: block; }

/* ── SELECT ── */
.select-wrap { position: relative; }
.select-wrap select {
  width: 100%; padding: 11px 36px 11px 14px;
  border: 1.5px solid #CBD5E0; border-radius: 8px;
  font-family: var(--font); font-size: .92rem; color: var(--gray-dark);
  background: var(--white); appearance: none; cursor: pointer; outline: none;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.select-wrap select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,111,196,.12); }
.select-wrap.invalid select { border-color: var(--red); }
.select-wrap.invalid ~ .field__err { display: block; }
.select-arrow {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--gray-mid); pointer-events: none;
}

/* ── CEP ── */
.cep-input-wrap { position: relative; display: flex; align-items: center; }
.cep-input-wrap input { padding-right: 40px; }
.cep-status {
  position: absolute; right: 12px;
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
}
.cep-spinner {
  width: 18px; height: 18px;
  border: 2px solid #CBD5E0;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.cep-ok  { color: var(--green-ok); }
.cep-err { color: var(--red); }

/* Endereço auto-preenchido */
.addr-field { display: grid !important; gap: 0; }
.addr-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr 0.6fr;
  gap: 12px;
  padding: 16px;
  background: var(--blue-faint);
  border: 1px solid rgba(26,111,196,.15);
  border-radius: 10px;
  animation: fadeSlideUp .4s ease both;
}
.field--uf { min-width: 52px; }
.addr-tag {
  display: flex; align-items: center; gap: 6px;
  font-size: .74rem; color: var(--blue); font-weight: 600;
  margin-top: 8px;
}

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

/* ── CONVÊNIO field ── */
.convenio-field {
  animation: fadeSlideUp .35s ease both;
}

/* ── LGPD ── */
.cad-lgpd {
  margin: 24px 0 0;
  padding: 18px 20px;
  background: var(--blue-faint);
  border: 1.5px solid rgba(26,111,196,.20);
  border-radius: 10px;
  transition: border-color .25s, background .25s;
}
.cad-lgpd .lgpd-obrig {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  color: var(--red);
  background: #FFF5F5;
  border: 1px solid rgba(229,62,62,.25);
  border-radius: 50px;
  padding: 2px 10px;
  margin-left: 8px;
  vertical-align: middle;
  letter-spacing: .04em;
}
.lgpd--required {
  border-color: var(--red) !important;
  background: #FFF5F5 !important;
  animation: shake .45s ease both;
}
.lgpd-check {
  display: flex; align-items: flex-start; gap: 12px;
  cursor: pointer; font-size: .84rem; color: var(--gray-mid); line-height: 1.55;
}
.lgpd-check input[type=checkbox] { display: none; }
.lgpd-check__box {
  width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px;
  border: 2px solid #CBD5E0; border-radius: 5px; background: var(--white);
  display: flex; align-items: center; justify-content: center;
  transition: var(--tr);
}
.lgpd-check input:checked ~ .lgpd-check__box {
  background: var(--blue); border-color: var(--blue);
}
.lgpd-check input:checked ~ .lgpd-check__box::after {
  content: '';
  display: block; width: 5px; height: 9px;
  border: 2px solid var(--white); border-top: none; border-left: none;
  transform: rotate(45deg) translateY(-1px);
}
.lgpd-check strong { color: var(--gray-dark); }
.lgpd-err {
  font-size: .75rem; color: var(--red);
  margin-top: 8px; margin-left: 32px;
  display: none;
}
.lgpd-err.show { display: block; }

/* ── ACTIONS ── */
.step-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 32px; padding-top: 24px;
  border-top: 1px solid #EEF2F7;
}

.btn-next, .btn-submit {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 28px;
  background: var(--blue); color: var(--white);
  border: none; border-radius: 50px;
  font-family: var(--font); font-size: .93rem; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(26,111,196,.35);
  transition: var(--tr);
}
.btn-next:hover, .btn-submit:hover {
  background: var(--blue-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(26,111,196,.45);
}
.btn-submit--locked {
  opacity: .45 !important;
  cursor: not-allowed !important;
  pointer-events: none;
  box-shadow: none !important;
}

.btn-back {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  background: transparent; color: var(--gray-mid);
  border: 1.5px solid #CBD5E0; border-radius: 50px;
  font-family: var(--font); font-size: .88rem; font-weight: 600;
  cursor: pointer; transition: var(--tr);
}
.btn-back:hover { border-color: var(--blue); color: var(--blue); }

/* ── SUCESSO ── */
.cad-success {
  display: none;
  flex-direction: column; align-items: center;
  text-align: center;
  padding: 56px 32px;
  gap: 16px;
  animation: fadeSlideUp .5s ease both;
}
.cad-success.show { display: flex; }
.success-icon {
  width: 96px; height: 96px;
  background: #F0FFF4; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--green-ok); margin-bottom: 8px;
}
.cad-success h2 { font-size: 1.6rem; font-weight: 800; color: var(--gray-dark); }
.cad-success p  { font-size: .95rem; color: var(--gray-mid); max-width: 420px; line-height: 1.65; }
.success-contacts { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 4px; }
.success-wa {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--green); color: var(--white);
  padding: 11px 22px; border-radius: 50px;
  font-size: .88rem; font-weight: 700; transition: var(--tr);
}
.success-wa:hover { background: var(--green-dk); }

/* ── FOOTER ── */
.cad-footer {
  text-align: center; padding: 28px 24px;
  border-top: 1px solid #E2E8F0;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.cad-footer__logo { height: 34px; width: auto; filter: grayscale(1) opacity(.4); }
.cad-footer p { font-size: .78rem; color: #A0AEC0; }

/* ── PAINEL DUPLICADO ── */
.dup-icon {
  background: #FEF3C7 !important;
  color: #B45309 !important;
}
.cad-duplicate h2 { color: #92400E; }

/* ── CPF DUPLICADO (step 1 - removido, mantido por compatibilidade) ── */
.cpf-dup-err {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #FFFBEB;
  border: 1.5px solid #F59E0B;
  border-radius: 12px;
  padding: 18px 20px;
  animation: fadeSlideUp .35s ease both;
}
.cpf-dup-err__icon {
  width: 46px; height: 46px; flex-shrink: 0;
  background: #FEF3C7;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #B45309;
}
.cpf-dup-err__body { flex: 1; min-width: 0; }
.cpf-dup-err__title {
  font-size: .95rem; font-weight: 700; color: #92400E; margin-bottom: 6px;
}
.cpf-dup-err__text {
  font-size: .84rem; color: #78350F; line-height: 1.55; margin-bottom: 14px;
}
.cpf-dup-err__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cpf-dup-wa {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--green); color: var(--white);
  padding: 9px 16px; border-radius: 50px;
  font-size: .82rem; font-weight: 700; transition: var(--tr);
}
.cpf-dup-wa:hover { background: var(--green-dk); }

/* ── RESPONSIVE ── */

/* Tablet (≤700px) */
@media (max-width: 700px) {
  .cad-main { padding: 24px 16px 60px; }
  .cad-card { border-radius: 14px; }
  .steps-wrapper { padding: 24px 24px 32px; }
  .steps-header  { padding: 22px 24px 0; }
  .field-grid    { grid-template-columns: 1fr; gap: 16px; }
  .field--cep-block, .field--num { grid-column: 1; }
  .dob-grid  { grid-template-columns: 1fr 1fr 1fr; }
  .addr-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .field--uf { grid-column: 2; }
  .step-actions  { gap: 10px; flex-wrap: wrap; }
  .btn-next, .btn-submit { width: 100%; justify-content: center; order: -1; }
  .btn-back      { width: 100%; justify-content: center; }
  .cad-stripe__inner { gap: 14px; }
  .cad-stripe__title { font-size: 1.3rem; }
}

/* Mobile (≤480px) */
@media (max-width: 480px) {
  .cpf-dup-err { padding: 14px; gap: 10px; }
  .cpf-dup-err__icon { width: 38px; height: 38px; }
  .cpf-dup-err__title { font-size: .88rem; }
  .cpf-dup-err__text  { font-size: .8rem; }
  .cpf-dup-err__actions { flex-direction: column; }
  .cpf-dup-wa { justify-content: center; }
  .cad-header__inner { padding: 0 16px; height: 58px; }
  .cad-header__logo img { height: 36px; }
  .cad-header__back { padding: 7px 12px; font-size: .8rem; }
  .cad-header__back span { display: none; }

  .cad-stripe { padding: 22px 16px; }
  .cad-stripe__icon  { display: none; }
  .cad-stripe__title { font-size: 1.2rem; }
  .cad-stripe__sub   { font-size: .82rem; }

  .steps-header  { padding: 18px 16px 0; }
  .steps-wrapper { padding: 20px 16px 28px; }

  /* Indicadores: mostra só o número */
  .step-indicator__label { display: none; }
  .step-indicator__dot   { width: 34px; height: 34px; }

  .step-panel__header { gap: 10px; margin-bottom: 20px; padding-bottom: 16px; }
  .step-panel__icon   { width: 40px; height: 40px; border-radius: 10px; }
  .step-panel__title  { font-size: 1rem; }
  .step-panel__sub    { font-size: .78rem; }

  .field label { font-size: .78rem; }
  .field input,
  .field textarea,
  .select-wrap select { font-size: .88rem; padding: 10px 12px; }

  .addr-grid { grid-template-columns: 1fr; gap: 10px; }
  .field--uf { grid-column: 1; }

  .cad-lgpd { padding: 14px; }
  .lgpd-check { font-size: .8rem; }

  .progress-bar { height: 3px; }

  .cad-success { padding: 36px 16px; }
  .success-icon { width: 76px; height: 76px; }
  .cad-success h2 { font-size: 1.3rem; }
  .success-contacts { flex-direction: column; align-items: stretch; }
  .success-wa { justify-content: center; }
}
