/* =====================================================
   MERCATU — Formulário de Franquia
   Paleta de cores baseada em www.minimercatu.com
   ===================================================== */

/* === VARIÁVEIS === */
:root {
  --green-primary: #02F049;
  --green-dark: #1A7D38;
  --green-deeper: #144021;
  --green-glow: rgba(2, 240, 73, 0.3);
  --green-subtle: rgba(2, 240, 73, 0.08);
  --bg-dark: #0D141A;
  --bg-card: #141C24;
  --bg-input: #1A242E;
  --bg-input-focus: #1E2A36;
  --surface: #1D1E20;
  --text-primary: #FFFFFF;
  --text-secondary: #A0AEC0;
  --text-muted: #6B7A8D;
  --border-color: #2A3544;
  --border-focus: #02F049;
  --error: #FF4D6A;
  --error-bg: rgba(255, 77, 106, 0.1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(2, 240, 73, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Poppins', 'Inter', sans-serif;
}

/* === RESET & BASE === */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
}

/* === PARTÍCULAS DE FUNDO === */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: var(--green-primary);
  opacity: 0;
  animation: floatParticle linear infinite;
}

@keyframes floatParticle {
  0% {
    opacity: 0;
    transform: translateY(100vh) scale(0);
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    opacity: 0;
    transform: translateY(-10vh) scale(1);
  }
}

/* === FUNDO GRADIENTE === */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 20% 50%, rgba(2, 240, 73, 0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(26, 125, 56, 0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 80%, rgba(2, 240, 73, 0.04) 0%, transparent 50%);
  animation: bgShift 20s ease-in-out infinite alternate;
  z-index: 0;
}

@keyframes bgShift {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-2%, -2%) rotate(3deg); }
}

/* === CONTAINER PRINCIPAL === */
.main-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 680px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  overflow: hidden;
  animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* === HEADER === */
.form-header {
  text-align: center;
  padding: 48px 40px 24px;
  position: relative;
}

.form-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

.logo-wrapper {
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
}

.logo {
  height: 70px;
  width: auto;
  filter: drop-shadow(0 4px 12px rgba(2, 240, 73, 0.2));
  transition: var(--transition);
}

.logo:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 6px 20px rgba(2, 240, 73, 0.35));
}

.form-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  line-height: 1.2;
}

.highlight {
  background: linear-gradient(135deg, var(--green-primary), var(--green-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.form-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 420px;
  margin: 0 auto;
}

/* === BARRA DE PROGRESSO === */
.progress-bar {
  padding: 28px 40px 8px;
  position: relative;
}

.progress-track {
  width: 100%;
  height: 4px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-fill {
  height: 100%;
  width: 33.33%;
  background: linear-gradient(90deg, var(--green-primary), var(--green-dark));
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px var(--green-glow);
}

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

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

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  border: 2px solid var(--border-color);
  background: var(--bg-dark);
  color: var(--text-muted);
  transition: var(--transition);
}

.step.active .step-circle {
  border-color: var(--green-primary);
  background: var(--green-primary);
  color: var(--bg-dark);
  box-shadow: 0 0 20px var(--green-glow);
}

.step.completed .step-circle {
  border-color: var(--green-dark);
  background: var(--green-dark);
  color: var(--text-primary);
}

.step-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: var(--transition);
  text-align: center;
}

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

.step.completed .step-label {
  color: var(--text-secondary);
}

/* === FORMULÁRIO === */
form {
  padding: 8px 40px 32px;
}

.form-step {
  display: none;
  animation: fadeInStep 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

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

.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.step-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--green-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green-primary);
  flex-shrink: 0;
}

.step-header h2 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* === CAMPOS DO FORMULÁRIO === */
.form-group {
  margin-bottom: 20px;
}

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

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.required {
  color: var(--green-primary);
  font-weight: 700;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  transition: var(--transition);
  z-index: 1;
  pointer-events: none;
  flex-shrink: 0;
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 14px 14px 44px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

textarea {
  resize: vertical;
  min-height: 100px;
  padding-top: 14px;
}

.textarea-wrapper {
  align-items: flex-start;
}

.textarea-wrapper .input-icon {
  top: 16px;
}

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

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(2, 240, 73, 0.3);
  background: var(--bg-input-focus);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green-primary);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 4px rgba(2, 240, 73, 0.1);
}

input:focus ~ .input-icon,
select:focus ~ .input-icon,
.input-wrapper:focus-within .input-icon {
  color: var(--green-primary);
}

/* Select arrow */
.select-wrapper::after {
  content: '';
  position: absolute;
  right: 16px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg) translateY(-2px);
  pointer-events: none;
  transition: var(--transition);
}

.select-wrapper:focus-within::after {
  border-color: var(--green-primary);
}

select {
  cursor: pointer;
  padding-right: 40px;
}

select option {
  background: var(--bg-dark);
  color: var(--text-primary);
}

/* === ERRO === */
.error-msg {
  display: block;
  font-size: 0.78rem;
  color: var(--error);
  margin-top: 6px;
  min-height: 18px;
  transition: var(--transition);
}

.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
  border-color: var(--error);
  background: var(--error-bg);
}

.form-group.has-error .input-icon {
  color: var(--error);
}

/* === RADIO BUTTONS === */
.radio-group {
  display: flex;
  gap: 24px;
  margin-top: 4px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: 0;
  transition: var(--transition);
}

.radio-label:hover {
  color: var(--text-primary);
}

.radio-label input[type="radio"] {
  display: none;
}

.radio-custom {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: var(--bg-input);
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}

.radio-label input[type="radio"]:checked + .radio-custom {
  border-color: var(--green-primary);
  background: var(--green-subtle);
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green-primary);
  box-shadow: 0 0 8px var(--green-glow);
}

/* === CHECKBOX === */
.checkbox-group {
  margin-top: 8px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 400;
  line-height: 1.5;
  margin-bottom: 0;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 6px;
  border: 2px solid var(--border-color);
  background: var(--bg-input);
  position: relative;
  transition: var(--transition);
  margin-top: 1px;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
  border-color: var(--green-primary);
  background: var(--green-primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 6px;
  width: 6px;
  height: 10px;
  border: solid var(--bg-dark);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.link {
  color: var(--green-primary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.link:hover {
  text-decoration: underline;
  filter: brightness(1.2);
}

/* === BOTÕES === */
.form-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn-next,
.btn-submit {
  background: linear-gradient(135deg, var(--green-primary), var(--green-dark));
  color: var(--bg-dark);
  box-shadow: 0 4px 16px rgba(2, 240, 73, 0.25);
}

.btn-next:hover,
.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(2, 240, 73, 0.35);
}

.btn-next:active,
.btn-submit:active {
  transform: translateY(0);
}

.btn-prev {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border-color);
}

.btn-prev:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

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

/* === TELA DE SUCESSO === */
.success-screen {
  text-align: center;
  padding: 60px 20px;
}

.success-animation {
  animation: successPop 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes successPop {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.success-checkmark {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--green-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  color: var(--green-primary);
  animation: checkPulse 2s ease-in-out infinite;
}

@keyframes checkPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(2, 240, 73, 0.2); }
  50% { box-shadow: 0 0 0 20px rgba(2, 240, 73, 0); }
}

.success-screen h2 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--green-primary);
}

.success-screen p {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 400px;
  margin: 0 auto 32px;
}

/* === FOOTER === */
.form-footer {
  text-align: center;
  padding: 20px 40px 28px;
  border-top: 1px solid var(--border-color);
}

.form-footer p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.footer-links a {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--green-primary);
}

.footer-links .divider {
  color: var(--text-muted);
  font-size: 0.7rem;
}

/* === LOADING SPINNER === */
.btn-submit.loading {
  pointer-events: none;
  position: relative;
}

.btn-submit.loading .btn-text {
  opacity: 0;
}

.spinner {
  display: none;
  width: 22px;
  height: 22px;
  border: 3px solid rgba(13, 20, 26, 0.3);
  border-top-color: var(--bg-dark);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  position: absolute;
}

.btn-submit.loading .spinner {
  display: block;
}

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

/* === SHAKE ANIMATION === */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.shake {
  animation: shake 0.4s ease-in-out;
}

/* === RESPONSIVIDADE === */
@media (max-width: 640px) {
  body {
    padding: 12px;
    align-items: flex-start;
  }

  .main-container {
    border-radius: var(--radius-lg);
  }

  .form-header {
    padding: 32px 24px 20px;
  }

  .logo {
    height: 55px;
  }

  .form-title {
    font-size: 1.6rem;
  }

  .form-subtitle {
    font-size: 0.88rem;
  }

  .progress-bar {
    padding: 20px 24px 8px;
  }

  form {
    padding: 8px 24px 24px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .step-label {
    font-size: 0.65rem;
  }

  .step-circle {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }

  .btn {
    padding: 12px 20px;
    font-size: 0.9rem;
  }

  .form-footer {
    padding: 16px 24px 20px;
  }

  .step-header h2 {
    font-size: 1.15rem;
  }
}

@media (max-width: 380px) {
  .form-header {
    padding: 24px 16px 16px;
  }

  .progress-bar {
    padding: 16px 16px 8px;
  }

  form {
    padding: 8px 16px 20px;
  }

  .form-footer {
    padding: 12px 16px 16px;
  }

  .form-title {
    font-size: 1.4rem;
  }
}

/* === SCROLLBAR CUSTOM === */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* === SELECTION === */
::selection {
  background: rgba(2, 240, 73, 0.25);
  color: var(--text-primary);
}
