/* ═══════════════════════════════════════════════════════════════════════════
   FORMULARIO PROFESIONAL · Inteligencia Artificial 360
   Diseño: glassmorphism + gradientes animados + micro-interacciones
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ─── Paleta principal ──────────────────────────────────────────────── */
  --primary-50:  #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;

  --violet-500: #8b5cf6;
  --violet-600: #7c3aed;
  --violet-700: #6d28d9;

  --fuchsia-500: #d946ef;
  --fuchsia-600: #c026d3;

  --cyan-400: #22d3ee;
  --cyan-500: #06b6d4;

  /* ─── Neutrales (slate) ─────────────────────────────────────────────── */
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* ─── Semánticos ────────────────────────────────────────────────────── */
  --green-50:  #ecfdf5;
  --green-100: #d1fae5;
  --green-500: #10b981;
  --green-600: #059669;
  --green-700: #047857;

  --red-50:  #fef2f2;
  --red-100: #fee2e2;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;

  --amber-50:  #fffbeb;
  --amber-100: #fef3c7;
  --amber-500: #f59e0b;
  --amber-700: #b45309;

  /* ─── Gradientes ────────────────────────────────────────────────────── */
  --gradient-primary:       linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #c026d3 100%);
  --gradient-primary-hover: linear-gradient(135deg, #4338ca 0%, #6d28d9 50%, #a21caf 100%);
  --gradient-bg:            linear-gradient(180deg, #f8fafc 0%, #eef2ff 50%, #f5f3ff 100%);
  --gradient-text:          linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #c026d3 100%);

  /* ─── Sombras ───────────────────────────────────────────────────────── */
  --shadow-sm:  0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md:  0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg:  0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
  --shadow-xl:  0 25px 50px -12px rgba(15, 23, 42, 0.15);
  --shadow-2xl: 0 32px 64px -12px rgba(15, 23, 42, 0.2);
  --shadow-glow: 0 0 60px -10px rgba(79, 70, 229, 0.25);

  /* ─── Otros ─────────────────────────────────────────────────────────── */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition:      250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--slate-900);
  background: var(--gradient-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
  position: relative;
  overflow-x: hidden;
}

/* ─── Background decoration ─────────────────────────────────────────────── */
.bg-decoration {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  will-change: transform;
}
.bg-blob-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--primary-500) 0%, transparent 70%);
  top: -200px;
  right: -100px;
  animation: float1 25s ease-in-out infinite;
}
.bg-blob-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--fuchsia-500) 0%, transparent 70%);
  bottom: -300px;
  left: -200px;
  animation: float2 30s ease-in-out infinite;
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(99, 102, 241, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
}

@keyframes float1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(40px, -60px) scale(1.1); }
  66%      { transform: translate(-30px, 30px) scale(0.9); }
}
@keyframes float2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(-40px, 40px) scale(1.15); }
  66%      { transform: translate(30px, -30px) scale(0.85); }
}

/* ─── Container ─────────────────────────────────────────────────────────── */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 64px 24px 48px;
  position: relative;
}

/* ─── Hero ──────────────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  margin-bottom: 48px;
  animation: fadeInUp 0.7s ease-out;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(79, 70, 229, 0.08);
  color: var(--primary-700);
  border: 1px solid rgba(79, 70, 229, 0.15);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 24px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.hero-badge-dot {
  width: 8px;
  height: 8px;
  background: var(--green-500);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.7; transform: scale(1.3); }
}

.hero-title {
  font-size: clamp(1.875rem, 5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  color: var(--slate-900);
}

.hero-title-gradient {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.hero-subtitle {
  font-size: 1.0625rem;
  color: var(--slate-600);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ─── Card ──────────────────────────────────────────────────────────────── */
.card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-2xl), var(--shadow-glow);
  position: relative;
  animation: fadeInUp 0.7s ease-out 0.1s backwards;
}

/* ─── Form sections ─────────────────────────────────────────────────────── */
.form-section { margin-bottom: 32px; }
.form-section:last-of-type { margin-bottom: 0; }

.form-section-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.form-section-desc {
  font-size: 0.9rem;
  color: var(--slate-500);
  margin-bottom: 20px;
}

/* ─── Fields ────────────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

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

label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
}

.optional {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--slate-400);
  margin-left: 6px;
}

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

.input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--slate-400);
  pointer-events: none;
  transition: color var(--transition);
  z-index: 1;
}

.input-icon-textarea { top: 14px; left: 14px; }
.input-wrapper-textarea { align-items: flex-start; }

input, textarea, select {
  width: 100%;
  padding: 13px 14px 13px 44px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--slate-900);
  background: var(--slate-50);
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius);
  transition: var(--transition);
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
}

select {
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

textarea {
  padding-left: 44px;
  resize: vertical;
  min-height: 130px;
  line-height: 1.6;
}

input::placeholder, textarea::placeholder { color: var(--slate-400); }

input:hover, textarea:hover, select:hover { border-color: var(--slate-300); }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary-500);
  background: white;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.input-wrapper:focus-within .input-icon { color: var(--primary-600); }

/* ─── Char counter ──────────────────────────────────────────────────────── */
.char-counter {
  font-size: 0.75rem;
  color: var(--slate-400);
  text-align: right;
  margin-top: 6px;
  transition: color var(--transition);
}
.char-counter.near-limit { color: var(--amber-500); }
.char-counter.at-limit   { color: var(--red-600); font-weight: 600; }

/* ─── Alerts ────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin: 16px 0;
  border: 1px solid;
}
.alert-error {
  background: var(--red-50);
  color: var(--red-700);
  border-color: var(--red-100);
}
.alert ul { margin: 0; padding-left: 20px; }
.alert ul li { margin: 2px 0; }
.alert code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ─── CAPTCHA ───────────────────────────────────────────────────────────── */
.captcha-wrapper {
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.h-captcha-placeholder { min-height: 78px; }

.captcha-note {
  font-size: 0.85rem;
  text-align: center;
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--amber-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--amber-100);
  color: var(--amber-700);
}

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 24px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: var(--gradient-primary);
  background-size: 200% 100%;
  background-position: 0% 0%;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 8px 24px -8px rgba(79, 70, 229, 0.4);
  position: relative;
  overflow: hidden;
  letter-spacing: -0.01em;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-primary-hover);
  opacity: 0;
  transition: opacity var(--transition);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px -8px rgba(79, 70, 229, 0.5);
  background-position: 100% 0%;
}
.btn-primary:hover:not(:disabled)::before { opacity: 1; }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { cursor: not-allowed; opacity: 0.85; }

.btn-primary > * { position: relative; z-index: 1; }

.btn-arrow {
  width: 18px;
  height: 18px;
  transition: transform var(--transition);
}
.btn-primary:hover:not(:disabled) .btn-arrow { transform: translateX(4px); }

.btn-spinner { display: inline-flex; align-items: center; }
.btn-spinner[hidden] { display: none; }
.btn-spinner svg {
  width: 20px;
  height: 20px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-footer-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--slate-400);
  margin-top: 16px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--slate-700);
  background: white;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  margin-top: 24px;
}
.btn-secondary:hover {
  background: var(--slate-50);
  border-color: var(--slate-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-secondary svg { width: 16px; height: 16px; }

/* ─── Success card ──────────────────────────────────────────────────────── */
.success-card {
  text-align: center;
  background: linear-gradient(180deg, var(--green-50) 0%, rgba(255, 255, 255, 0.95) 100%);
  border-color: var(--green-100);
  animation: fadeInUp 0.6s ease-out;
  overflow: hidden;
}

.success-icon-wrapper {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, var(--green-500) 0%, var(--green-600) 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 32px -8px rgba(16, 185, 129, 0.4);
  position: relative;
}

.success-icon-wrapper::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--green-500);
  opacity: 0.3;
  animation: ripple 1.5s ease-out infinite;
}

@keyframes ripple {
  0%   { transform: scale(1);   opacity: 0.3; }
  100% { transform: scale(1.4); opacity: 0;   }
}

.success-icon-wrapper svg {
  width: 40px;
  height: 40px;
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: drawCheck 0.6s ease-out 0.3s forwards;
  position: relative;
  z-index: 1;
}

@keyframes drawCheck { to { stroke-dashoffset: 0; } }

.success-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--green-700);
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.success-text {
  font-size: 1rem;
  color: var(--slate-600);
  max-width: 460px;
  margin: 0 auto;
  line-height: 1.6;
}
.success-text strong { color: var(--slate-900); font-weight: 600; }

.success-id {
  display: inline-block;
  margin-top: 16px;
  padding: 6px 14px;
  background: white;
  border: 1px solid var(--green-100);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--slate-600);
}
.success-id strong { color: var(--green-700); font-weight: 600; }

.confetti-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

/* ─── Trust bar ─────────────────────────────────────────────────────────── */
.trust-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px 32px;
  margin-top: 32px;
  padding: 20px;
  animation: fadeInUp 0.7s ease-out 0.3s backwards;
}

.trust-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--slate-600);
  font-weight: 500;
}
.trust-item svg {
  width: 18px;
  height: 18px;
  color: var(--primary-600);
}

/* ─── Footer ────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  margin-top: 48px;
  font-size: 0.85rem;
  color: var(--slate-400);
}

/* ─── Animations ────────────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .container { padding: 40px 16px 32px; }
  .card { padding: 28px 20px; border-radius: var(--radius-lg); }
  .hero-title { font-size: 1.75rem; }
  .hero-subtitle { font-size: 1rem; }
  .field-row { grid-template-columns: 1fr; }
  .field-row .field { margin-bottom: 16px; }
  .trust-bar { gap: 12px 20px; padding: 16px; }
  .success-title { font-size: 1.5rem; }
}

@media (max-width: 380px) {
  .container { padding: 32px 12px 24px; }
  .card { padding: 24px 16px; }
  .hero-title { font-size: 1.5rem; }
}

/* ─── Reduced motion ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .bg-blob { animation: none; }
  .hero-badge-dot { animation: none; }
  .success-icon-wrapper::before { animation: none; }
}