/* ============================================================
   LAS FOR LIFE — Formulário de Qualificação
   Identidade visual: lasforlife.com.br
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=Inter:wght@400;500&display=swap');

/* ── Variáveis de Design ── */
:root {
  --las-navy:       #0B2545;
  --las-blue:       #1A4B8C;
  --las-blue-light: #2D6BC4;
  --las-accent:     #E8332A;
  --las-accent-soft:#FFF0EF;
  --las-teal:       #1D9E75;

  --surface:        #FFFFFF;
  --surface-alt:    #F7F8FA;
  --surface-hover:  #EEF2F8;
  --border:         #DDE3EE;
  --border-focus:   #2D6BC4;

  --text-primary:   #0B2545;
  --text-secondary: #4A5568;
  --text-muted:     #8896AA;
  --text-error:     #C0392B;
  --text-success:   #0F6E56;

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --shadow-sm:  0 1px 3px rgba(11,37,69,0.08);
  --shadow-md:  0 4px 16px rgba(11,37,69,0.10);
  --shadow-lg:  0 8px 32px rgba(11,37,69,0.12);

  --transition: 180ms ease;
  --font-head: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--surface-alt);
  min-height: 100vh;
}

/* ── Header ── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.header-logo img { height: 36px; width: auto; }
.header-logo-text {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
}
.header-badge .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--las-teal);
}

/* ── Layout principal ── */
.page-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* ── Hero do formulário ── */
.form-hero {
  background: var(--las-navy);
  border-radius: var(--radius-xl);
  padding: 40px 40px 32px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.form-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(45, 107, 196, 0.18);
  pointer-events: none;
}

.form-hero::after {
  content: '';
  position: absolute;
  bottom: -40px; left: 40px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(232, 51, 42, 0.10);
  pointer-events: none;
}

.form-hero-eyebrow {
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 10px;
}

.form-hero h1 {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.25;
  margin-bottom: 12px;
}

.form-hero h1 span { color: #5DA8FF; }

.form-hero-sub {
  font-size: 14px;
  color: rgba(255,255,255,0.65);
  line-height: 1.6;
  max-width: 480px;
}

.form-hero-divider {
  height: 1px;
  background: rgba(255,255,255,0.10);
  margin: 24px 0 20px;
}

.form-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
}
.meta-item svg { flex-shrink: 0; opacity: 0.7; }

/* ── Barra de progresso ── */
.progress-bar-wrap {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.progress-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 16px;
}

.progress-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
}

.progress-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 16px;
  left: calc(50% + 18px);
  right: calc(-50% + 18px);
  height: 2px;
  background: var(--border);
  transition: background var(--transition);
}

.progress-step.done:not(:last-child)::after,
.progress-step.active:not(:last-child)::after {
  background: var(--las-blue-light);
}

.step-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--transition);
  position: relative;
  z-index: 1;
}

.progress-step.active .step-circle {
  border-color: var(--las-blue-light);
  background: var(--las-blue-light);
  color: white;
  box-shadow: 0 0 0 4px rgba(45,107,196,0.15);
}

.progress-step.done .step-circle {
  border-color: var(--las-teal);
  background: var(--las-teal);
  color: white;
}

.step-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}
.progress-step.active .step-label { color: var(--las-blue); font-weight: 600; }
.progress-step.done .step-label { color: var(--las-teal); }

/* ── Cards de seção ── */
.form-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
  display: none;
}

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

.section-header {
  padding: 20px 28px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.section-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  background: var(--surface-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--las-blue);
}

.section-header-text h2 {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.section-header-text p {
  font-size: 13px;
  color: var(--text-muted);
}

.section-body { padding: 24px 28px; }

/* ── Tela de seleção de tipo ── */
.tipo-cadastro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.tipo-card {
  position: relative;
  cursor: pointer;
}

.tipo-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tipo-card-inner {
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  transition: all var(--transition);
  background: var(--surface);
  user-select: none;
}

.tipo-card:hover .tipo-card-inner {
  border-color: var(--las-blue-light);
  background: var(--surface-hover);
}

.tipo-card input:checked + .tipo-card-inner {
  border-color: var(--las-blue);
  background: #EEF2F8;
  box-shadow: 0 0 0 4px rgba(45,107,196,0.10);
}

.tipo-card-icon {
  font-size: 36px;
  margin-bottom: 14px;
  display: block;
}

.tipo-card-title {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.tipo-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.tipo-card input:checked + .tipo-card-inner .tipo-card-title {
  color: var(--las-blue);
}

/* ── Campos de formulário ── */
.field-group {
  margin-bottom: 20px;
}

.field-group:last-child { margin-bottom: 0; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-row.three { grid-template-columns: 1fr 1fr 1fr; }

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

label .req {
  color: var(--las-accent);
  margin-left: 2px;
  font-size: 12px;
}

label .opt {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 400;
  margin-left: 4px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

textarea {
  height: auto;
  padding: 12px 14px;
  resize: vertical;
  min-height: 96px;
}

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='%238896AA' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(45,107,196,0.12);
}

input.readonly-field, input[readonly] {
  background: var(--surface-alt);
  color: var(--text-muted);
  border-color: var(--border);
  cursor: default;
}

input.readonly-field:focus, input[readonly]:focus {
  box-shadow: none;
  border-color: var(--border);
}

input.error, select.error, textarea.error {
  border-color: var(--text-error);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.10);
}

.field-error {
  font-size: 12px;
  color: var(--text-error);
  margin-top: 4px;
  display: none;
  align-items: center;
  gap: 4px;
}
.field-error.visible { display: flex; }

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

/* ── Representante readonly ── */
.rep-card {
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.rep-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--las-navy);
  color: white;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rep-info { flex: 1; min-width: 0; }
.rep-name {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rep-empresa {
  font-size: 12px;
  color: var(--text-muted);
}

.rep-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: #E8F4EC;
  color: var(--las-teal);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Checkboxes e Radios ── */
.radio-group, .check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.radio-option, .check-option {
  position: relative;
  cursor: pointer;
}

.radio-option input, .check-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-label, .check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  cursor: pointer;
  user-select: none;
  background: var(--surface);
}

.radio-option:hover .radio-label,
.check-option:hover .check-label {
  border-color: var(--las-blue-light);
  background: var(--surface-hover);
}

.radio-option input:checked + .radio-label,
.check-option input:checked + .check-label {
  border-color: var(--las-blue);
  background: #EEF2F8;
  color: var(--las-blue);
}

.radio-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.5;
}
.radio-option input:checked + .radio-label .radio-dot { opacity: 1; }
.radio-option input:checked + .radio-label .radio-dot::after {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--las-blue);
}

.check-box {
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.5;
}
.check-option input:checked + .check-label .check-box {
  opacity: 1;
  background: var(--las-blue);
  border-color: var(--las-blue);
}
.check-option input:checked + .check-label .check-box::after {
  content: '';
  width: 9px; height: 5px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg) translateY(-1px);
}

/* ── Checkbox inline "Mesmo endereço" ── */
.inline-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin-bottom: 16px;
}

.inline-check input[type="checkbox"] {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  accent-color: var(--las-blue);
  cursor: pointer;
  flex-shrink: 0;
}

.inline-check span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ── Fieldset secretaria / faturamento ── */
.conditional-fieldset {
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 4px;
  display: none;
}

.conditional-fieldset.open { display: block; }

.fieldset-label {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── Caracteres restantes (textarea) ── */
.char-count {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}

/* ── Bloco de declaração ANVISA ── */
.declaracao-box {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  background: var(--surface-alt);
  margin-bottom: 20px;
  max-height: 240px;
  overflow-y: auto;
}

.declaracao-box h3 {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.declaracao-box p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.declaracao-box p:last-child { margin-bottom: 0; }

.declaracao-box strong { color: var(--text-primary); }

/* ── Alerta de não-aceite ── */
.aceite-alerta {
  background: #FFF5F5;
  border: 1.5px solid #FECACA;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: none;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  font-size: 13px;
  color: #991B1B;
}
.aceite-alerta.visible { display: flex; }

/* ── Navegação entre etapas ── */
.form-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  margin-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  height: 46px;
  border-radius: var(--radius-md);
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--las-navy);
  color: white;
}
.btn-primary:hover { background: var(--las-blue); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-alt); border-color: var(--las-blue-light); }

.btn-submit {
  background: var(--las-accent);
  color: white;
  padding: 0 32px;
  height: 52px;
  font-size: 15px;
}
.btn-submit:hover { background: #C0392B; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(232,51,42,0.30); }
.btn-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Tela de erro de token ── */
#token-error-screen {
  display: none;
  text-align: center;
  padding: 60px 20px;
}

#token-error-screen.visible { display: block; }

.error-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: #FFF0EF;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

.error-icon svg { color: var(--las-accent); }

#token-error-screen h2 {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

#token-error-screen p {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto;
}

/* ── Loading inicial ── */
#loading-screen {
  text-align: center;
  padding: 80px 20px;
}

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--las-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin { to { transform: rotate(360deg); } }

#loading-screen p {
  font-size: 14px;
  color: var(--text-muted);
}

/* ── Tela de sucesso ── */
#success-screen {
  display: none;
  text-align: center;
  padding: 60px 20px;
}
#success-screen.visible { display: block; }

.success-icon {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: #E8F4EC;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

#success-screen h2 {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

#success-screen .protocol-box {
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin: 24px auto;
  max-width: 420px;
  text-align: left;
}

.protocol-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.protocol-number {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: var(--las-blue);
  word-break: break-all;
}

#success-screen .success-note {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 440px;
  margin: 0 auto;
  line-height: 1.65;
}

/* ── Badge ANVISA ── */
.anvisa-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  margin-top: 12px;
}

/* ── Divisor de seção ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ── Footer ── */
.site-footer {
  background: var(--las-navy);
  color: rgba(255,255,255,0.5);
  text-align: center;
  padding: 24px 20px;
  font-size: 12px;
  margin-top: 40px;
}

.site-footer a { color: rgba(255,255,255,0.7); text-decoration: none; }
.site-footer a:hover { color: white; }

/* ── Responsivo ── */
@media (max-width: 640px) {
  .form-hero { padding: 28px 24px 24px; }
  .form-hero h1 { font-size: 20px; }
  .tipo-cadastro-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .field-row.three { grid-template-columns: 1fr; }
  .section-body { padding: 18px 18px; }
  .section-header { padding: 16px 18px 14px; }
  .progress-steps { gap: 0; }
  .step-label { display: none; }
  .form-hero-meta { gap: 12px; }
  .header-inner { height: 56px; }
  .header-logo img { height: 28px; }
}

@media (max-width: 380px) {
  .page-wrap { padding: 20px 12px 60px; }
}

/* ── Animação de entrada de seção ── */
@keyframes sectionIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.form-section.active {
  animation: sectionIn 0.25s ease forwards;
}

/* ── Tooltip de campo ── */
.field-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  color: var(--text-muted);
  cursor: help;
}

/* ── Grupo de endereço ── */
.address-group {
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  padding: 18px;
}

.address-title {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ── CRM field layout ── */
.crm-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.crm-uf-select { width: 90px; }

/* ── Visible utility ── */
.hidden { display: none !important; }
