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

:root {
  --primary: #212492;
  --primary-dark: #1a1d75;
  --primary-light: rgba(33, 36, 146, 0.08);
  --primary-ring: rgba(33, 36, 146, 0.2);
  --text-dark: #1a1a2e;
  --text-base: #374151;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --bg-page-from: #f8f9fb;
  --bg-page-to: #f1f2f6;
  --bg-white: #ffffff;
  --bg-input: #f5f5f7;
  --bg-info: #eff6ff;
  --border-color: #e5e7eb;
  --border-input: #D1D5DC;
  --border-focus: var(--primary);
  --red: #ef4444;
  --radius: 0.75rem;
  --radius-full: 9999px;
  --shadow-card: 0 4px 24px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-btn: 0 2px 8px rgba(33,36,146,0.25);
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
  --btn-height: 3rem;
}

@media (min-width: 768px) {
  :root { --btn-height: 3.5rem; }
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(180deg, var(--bg-page-from) 0%, var(--bg-page-to) 100%);
  min-height: 100vh;
  color: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== LAYOUT ===== */
.page-wrapper {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}
@media (max-width: 480px) {
  .page-wrapper { max-width: 412px; padding: 1.5rem 1rem 2rem; }
}

/* ===== HEADER ===== */
.header { margin-bottom: 2rem; }
.header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}
.header p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; }
.header .required-note {
  font-size: 0.8rem; color: var(--text-light);
  font-style: italic; margin-top: 0.5rem;
}
.header .required-note span { color: var(--red); }

@media (min-width: 768px) {
  .header h1 { font-size: 2rem; }
}

/* ===== CARD ===== */
.form-card {
  background: var(--bg-white);
  border-radius: 1rem;
  box-shadow: var(--shadow-card);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
}
@media (min-width: 768px) { .form-card { padding: 2.5rem; } }

/* ===== STEPPER ===== */
.stepper { display: flex; align-items: flex-start; gap: 0; margin-bottom: 2rem; }
.step-item { display: flex; align-items: flex-start; flex: 1; }
.step-item:last-child .step-line { display: none; }

.step-circle-wrap { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.step-circle {
  width: 2.25rem; height: 2.25rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 600;
  transition: all var(--transition);
  background: #e5e7eb; color: var(--text-light);
}
.step-circle.active {
  background: var(--primary); color: #fff;
  box-shadow: 0 0 0 4px var(--primary-ring);
}
.step-circle.done { background: var(--primary); color: #fff; }
.step-circle .check-icon { display: none; }
.step-circle.done .check-icon { display: block; }
.step-circle.done .step-num { display: none; }

.step-label {
  font-size: 0.65rem; margin-top: 0.35rem;
  color: var(--text-light); text-align: center;
  white-space: nowrap; transition: color var(--transition);
}
.step-label.active { color: var(--primary); font-weight: 600; }

.step-line {
  flex: 1; height: 2.25rem;
  display: flex; align-items: center; padding: 0 0.5rem;
}
.step-line-inner {
  width: 100%; height: 3px;
  border-radius: 2px; background: #e5e7eb;
  transition: background var(--transition);
}
.step-line-inner.filled { background: var(--primary); }

@media (min-width: 768px) {
  .step-circle { width: 2.5rem; height: 2.5rem; font-size: 0.95rem; }
  .step-label { font-size: 0.75rem; }
  .step-line { padding: 0 0.75rem; }
}

/* ===== FORM STEPS ===== */
.form-step { display: none; animation: fadeSlideIn 0.35s ease; }
.form-step.active { display: block; }

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

.step-title {
  font-size: 1.15rem; font-weight: 700;
  color: var(--primary); margin-bottom: 0.35rem;
}
.step-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.step-subtitle span { color: var(--red); }

@media (min-width: 768px) { .step-title { font-size: 1.3rem; } }

/* ===== GRID ===== */
.row { display: grid; gap: 1.25rem; }
.row.cols-2 { grid-template-columns: 1fr; }
.row.cols-3 { grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .row.cols-2 { grid-template-columns: 1fr 1fr; }
  .row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
}

.fields-group { display: flex; flex-direction: column; gap: 1.25rem; }

/* ===== FIELDSET RESET ===== */
fieldset {
  border: none;
  padding: 0;
  margin: 0;
  min-inline-size: 0;
}

/* ===== FLOATING LABEL INPUT ===== */
.float-field { position: relative; }

.float-field input,
.float-field textarea,
.float-field select {
  width: 100%;
  padding: 1.15rem 0.9rem 0.45rem;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1.382px solid #D1D5DC;
  border-radius: 10px;
  background: #FFF;
  color: var(--text-dark);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.float-field textarea { resize: vertical; min-height: 120px; line-height: 1.5; }

.float-field input:focus,
.float-field textarea:focus,
.float-field select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-ring);
  background: #FFF;
}

.float-field label {
  position: absolute;
  left: 0.9rem; top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem; font-weight: 400;
  color: var(--text-light);
  pointer-events: none;
  transition: all 0.2s ease;
  background: transparent;
}

.float-field textarea ~ label { top: 1.1rem; transform: translateY(0); }

.float-field input:focus ~ label,
.float-field input.has-value ~ label,
.float-field select:focus ~ label,
.float-field select.has-value ~ label,
.float-field textarea:focus ~ label,
.float-field textarea.has-value ~ label {
  top: 0.35rem; transform: translateY(0);
  font-size: 0.7rem; font-weight: 500;
  color: var(--primary);
}

.float-field textarea:focus ~ label,
.float-field textarea.has-value ~ label { top: 0.3rem; }

/* Select arrow */
.float-field.select-field::after {
  content: '';
  position: absolute; right: 1rem; top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-muted);
  pointer-events: none;
}

/* Disabled select */
.float-field select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f9fafb;
}
.float-field select:disabled ~ label {
  opacity: 0.5;
}

/* Char counter */
.char-counter {
  text-align: right; font-size: 0.7rem;
  color: var(--text-light); margin-top: 0.25rem;
}

/* Error state */
.float-field.error input,
.float-field.error textarea,
.float-field.error select {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(239,68,68,0.12);
}
.float-field.error label { color: var(--red); }
.error-msg { font-size: 0.75rem; color: var(--red); margin-top: 0.3rem; display: none; }
.float-field.error .error-msg { display: block; }

/* ===== RADIO GROUP ===== */
.radio-group-label {
  font-size: 0.9rem; font-weight: 500;
  color: var(--text-base); margin-bottom: 0.6rem; display: block;
}

.radio-options { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; }
.radio-options.vertical { flex-direction: column; gap: 0.6rem; }

.radio-option {
  display: flex; align-items: center; gap: 0.5rem;
  cursor: pointer; font-size: 0.9rem; color: var(--text-base);
}
.radio-option input[type="radio"] { display: none; }
.radio-dot {
  width: 1.15rem; height: 1.15rem;
  border: 2px solid var(--border-input);
  border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.radio-dot::after {
  content: ''; width: 0.5rem; height: 0.5rem;
  border-radius: 50%; background: var(--primary);
  transform: scale(0); transition: transform 0.2s ease;
}
.radio-option input:checked + .radio-dot { border-color: var(--primary); }
.radio-option input:checked + .radio-dot::after { transform: scale(1); }

.radio-group.error .radio-dot { border-color: var(--red); }
.radio-group .error-msg { margin-top: 0.35rem; }
.radio-group.error .error-msg { display: block; }

/* Tooltip */
.tooltip-wrap { position: relative; display: inline-flex; align-items: center; margin-left: 0.3rem; }
.tooltip-icon {
  width: 1rem; height: 1rem; cursor: help;
  color: var(--text-light); transition: color var(--transition);
}
.tooltip-icon:hover { color: var(--primary); }
.tooltip-text {
  display: none; position: absolute;
  left: 1.5rem; top: 50%; transform: translateY(-50%);
  background: var(--text-dark); color: #fff;
  font-size: 0.78rem; line-height: 1.45;
  padding: 0.6rem 0.85rem; border-radius: 0.5rem;
  width: max-content; max-width: 260px;
  z-index: 50; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  pointer-events: none;
}
.tooltip-wrap:hover .tooltip-text { display: block; }

/* ===== CONDITIONAL SECTIONS ===== */
.conditional-section { display: none; animation: fadeSlideIn 0.3s ease; }
.conditional-section.visible { display: flex; flex-direction: column; gap: 1.25rem; }

/* ===== PRIVACY NOTICE ===== */
.privacy-notice {
  background: var(--bg-input); border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  text-align: center; font-size: 0.9rem; color: var(--text-base);
  margin-top: 1.5rem;
}
.privacy-notice a { color: var(--primary); text-decoration: underline; font-weight: 500; }
.privacy-notice a:hover { color: var(--primary-dark); }

/* ===== BUTTONS (uniform height) ===== */
.nav-buttons {
  display: flex; gap: 0.75rem;
  padding-top: 1.5rem; margin-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.btn {
  flex: 1;
  height: var(--btn-height);
  border-radius: var(--radius-full);
  font-family: inherit; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  border: none; outline: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 16px rgba(33,36,146,0.35); }
.btn-primary:active { transform: scale(0.98); }

.btn-outline {
  background: transparent; color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-outline:active { transform: scale(0.98); }

.btn-full { width: 100%; flex: none; }

.btn svg { width: 1.1rem; height: 1.1rem; }

/* Button spinner (reCAPTCHA loading) */
.btn-spinner {
  display: inline-block;
  width: 1rem; height: 1rem;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btnSpin 0.6s linear infinite;
}
@keyframes btnSpin {
  to { transform: rotate(360deg); }
}
.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

@media (min-width: 768px) {
  .btn { font-size: 0.95rem; }
}

/* ===== THANK YOU PAGE ===== */
.thankyou { text-align: center; animation: fadeSlideIn 0.4s ease; }

.success-icon-wrap { display: flex; justify-content: center; margin-bottom: 1.5rem; }
.success-icon { width: 5rem; height: 5rem; position: relative; }
.success-icon::before {
  content: ''; position: absolute; inset: -0.5rem;
  background: var(--primary-ring); border-radius: 50%;
  animation: pulseRing 2s ease-in-out infinite;
}
.success-icon svg { width: 100%; height: 100%; position: relative; z-index: 1; }

@keyframes pulseRing {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.2; transform: scale(1.15); }
}

.thankyou h2 { font-size: 1.4rem; font-weight: 700; color: var(--primary); margin-bottom: 0.5rem; }
.thankyou .ty-subtitle { font-size: 0.9rem; color: var(--text-muted); padding: 0 1rem; line-height: 1.6; }

.info-cards { display: grid; grid-template-columns: 1fr; gap: 1rem; margin: 1.5rem 0; }
@media (min-width: 640px) { .info-cards { grid-template-columns: 1fr 1fr; } }

.info-card {
  background: var(--bg-input); border: 2px solid var(--border-color);
  border-radius: var(--radius); padding: 1.25rem; text-align: center;
}
.info-card.full { grid-column: 1 / -1; }
.info-card .ic-label {
  font-size: 0.75rem; font-weight: 500;
  color: var(--text-muted); margin-bottom: 0.35rem;
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
}
.info-card .ic-label svg { width: 1rem; height: 1rem; color: var(--primary); }
.info-card .ic-value { font-size: 1.15rem; font-weight: 700; color: var(--primary); letter-spacing: 0.04em; }
.info-card .ic-value.dark { color: var(--text-dark); font-size: 1rem; }
.info-card .ic-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }

.important-box {
  background: var(--bg-info); border: 1px solid #bfdbfe;
  border-radius: var(--radius); padding: 1rem 1.25rem;
  font-size: 0.8rem; color: var(--text-base); text-align: left;
  line-height: 1.55; margin: 1.5rem 0;
}
.important-box strong { font-weight: 600; }

.legal-box {
  background: var(--bg-input); border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  text-align: left; margin: 1rem 0;
}
.legal-box p { font-size: 0.7rem; color: var(--text-muted); line-height: 1.55; margin-bottom: 0.5rem; }
.legal-box p:last-child { margin-bottom: 0; }

.ty-buttons { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1.5rem; }

/* ===== RECAPTCHA ===== */
.recaptcha-notice {
  font-size: 0.72rem; color: var(--text-light);
  text-align: center; line-height: 1.5;
  margin-top: 0.75rem;
}
.recaptcha-notice a {
  color: var(--text-muted);
  text-decoration: underline;
}
.recaptcha-notice a:hover { color: var(--primary); }

/* Ocultar badge flotante de reCAPTCHA (requerido mostrar aviso inline) */
.grecaptcha-badge { visibility: hidden !important; }

/* ===== FOOTER ===== */
.site-footer {
  text-align: center; margin-top: 2rem;
  font-size: 0.78rem; color: var(--text-light); line-height: 1.7;
}

/* ===== TOAST ===== */
.toast {
  position: fixed; top: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(-120%);
  background: #fef2f2; color: #991b1b; border: 1px solid #fecaca;
  padding: 0.75rem 1.5rem; border-radius: var(--radius);
  font-size: 0.85rem; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  z-index: 1000;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.35s ease, visibility 0.35s ease;
  max-width: 90vw; text-align: center;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/* ===== UTILS ===== */
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}