:root {
  --bg: #0f172a;
  --bg-gradient: radial-gradient(circle at top, #1e293b 0, #020617 55%);
  --card: rgba(15, 23, 42, 0.9);
  --stroke: rgba(148, 163, 184, 0.25);
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent1: #6366f1;
  --accent2: #22c55e;
  --accent3: #06b6d4;
  --danger: #ef4444;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.7);
  --radius: 18px;

  --fs-base: clamp(15px, 1.1vw, 16px);
  --fs-title: clamp(26px, 3vw, 32px);
  --fs-subtitle: clamp(14px, 1.1vw, 15px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--fs-base);
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
}

body {
  background-image: var(--bg-gradient);
}

/* Contenedor principal */
.contact-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

/* Tarjeta del formulario */
.contact-card {
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--stroke);
  padding: 24px clamp(24px, 4vw, 32px);
  position: relative;
  overflow: hidden;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    border-color 0.22s ease;
}

/* Efecto decorativo de bordes */
.contact-card::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: conic-gradient(
    from 180deg,
    transparent 0deg,
    rgba(99, 102, 241, 0.8) 80deg,
    rgba(56, 189, 248, 0.8) 180deg,
    rgba(34, 197, 94, 0.8) 260deg,
    transparent 360deg
  );
  opacity: 0;
  transition: opacity 0.6s ease;
  z-index: -1;
}

.contact-card:hover::before {
  opacity: 0.16;
}

/* Estados animados de la tarjeta */
.contact-card.is-sending {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 28px 80px rgba(59, 130, 246, 0.55);
  border-color: rgba(96, 165, 250, 0.7);
}

.contact-card.is-success {
  animation: cardPop 0.45s ease-out;
  box-shadow: 0 30px 85px rgba(34, 197, 94, 0.7);
  border-color: rgba(34, 197, 94, 0.9);
}

@keyframes cardPop {
  0% {
    transform: scale(0.98);
  }
  50% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
  }
}

/* Título / subtítulo */
.contact-title {
  margin: 0 0 4px;
  font-size: var(--fs-title);
  letter-spacing: 0.02em;
}

.contact-subtitle {
  margin: 0 0 22px;
  font-size: var(--fs-subtitle);
  color: var(--muted);
}

/* Grupo de formulario */
.form-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
}

/* Label */
.form-group label {
  font-weight: 500;
  margin-bottom: 6px;
  color: #cbd5f5;
}

/* Inputs / textarea */
.form-group input,
.form-group textarea {
  background: rgba(15, 23, 42, 0.85);
  border-radius: 10px;
  border: 1px solid var(--stroke);
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.97rem;
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    transform 0.08s ease;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: rgba(148, 163, 184, 0.7);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent1);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.5);
  background: rgba(15, 23, 42, 0.96);
  transform: translateY(-1px);
}

/* Mensajes de error */
.error-msg {
  font-size: 0.78rem;
  min-height: 14px;
  margin-top: 4px;
  color: var(--danger);
}

/* Botón de envío */
.btn-submit {
  margin-top: 6px;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: linear-gradient(120deg, var(--accent1), #3b82f6, var(--accent3));
  background-size: 220% 220%;
  color: white;
  font-weight: 600;
  font-size: 0.98rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.45);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    filter 0.12s ease,
    background-position 0.35s ease;
}

/* Brillo dinámico en el botón */
.btn-submit::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at 0% 0%, rgba(255, 255, 255, 0.25), transparent 55%);
  opacity: 0;
  transform: translateX(-60%);
  transition: opacity 0.3s ease;
}

/* Barrido de luz */
.btn-submit::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255, 255, 255, 0.28) 40%,
    rgba(255, 255, 255, 0.06) 60%,
    transparent 100%
  );
  opacity: 0;
  transform: translateX(-120%);
}

/* Hover normal */
.btn-submit:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: 0 18px 45px rgba(37, 99, 235, 0.65);
  background-position: 100% 0;
}

.btn-submit:hover::before {
  opacity: 0.5;
}

/* Elementos internos del botón */
.btn-text {
  position: relative;
  z-index: 2;
}

.btn-loader,
.btn-check {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  font-size: 1.2rem;
}

/* Loader circular */
.btn-loader::before {
  content: "";
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

/* Icono de check */
.btn-check {
  font-weight: 700;
  transform: scale(0.5);
  transition: transform 0.25s ease;
}

/* Estados del botón */
.btn-submit.is-loading .btn-text {
  opacity: 0;
}

.btn-submit.is-loading .btn-loader {
  opacity: 1;
}

/* Animación del barrido cuando está cargando */
.btn-submit.is-loading::after {
  opacity: 1;
  animation: buttonSweep 1.1s ease-in-out infinite;
}

/* Estado de éxito */
.btn-submit.is-success {
  background: linear-gradient(120deg, var(--accent2), #4ade80, #22c55e);
  box-shadow: 0 18px 38px rgba(34, 197, 94, 0.7);
}

.btn-submit.is-success .btn-text {
  opacity: 0;
}

.btn-submit.is-success .btn-check {
  opacity: 1;
  transform: scale(1);
}

.btn-submit:active {
  transform: translateY(0);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.6);
}

/* Animación de rotación del loader */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Barrido del brillo en el botón */
@keyframes buttonSweep {
  0% {
    transform: translateX(-120%);
  }
  50% {
    transform: translateX(10%);
  }
  100% {
    transform: translateX(120%);
  }
}

/* Mensaje de estado del formulario */
.form-status {
  margin-top: 14px;
  min-height: 22px;
  font-size: 0.86rem;
  color: var(--muted);
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  text-align: center;
}

.form-status.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.form-status.is-error {
  color: var(--danger);
}

.form-status.is-success {
  color: var(--accent2);
}

/* Responsivo */
@media (max-width: 480px) {
  .contact-card {
    padding: 20px 18px;
  }

  .contact-title {
    text-align: left;
  }

  .contact-subtitle {
    text-align: left;
  }
}

/* Centrar reCAPTCHA */
.recaptcha-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.recaptcha-container > .g-recaptcha {
  transform: scale(1);
  transform-origin: center center;
}
