/**
 * Componentes de formulario Aurora (viveph).
 * Extraídos de la piel de /reportar/ (PR #373) para reutilizar en portal y landings.
 * Depende de /css/tokens.css
 */

/* —— Panel tipo tarjeta —— */
.aurora-form-panel {
  padding: clamp(1rem, 3.2cqw, 1.35rem);
  background: linear-gradient(155deg, rgba(22, 27, 38, 0.96), rgba(12, 14, 20, 0.92));
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.22);
}

.encuestas-tema-claro .aurora-form-panel {
  background: linear-gradient(155deg, #ffffff, #faf8fd);
  border-color: #e1d8ec;
  box-shadow: 0 12px 30px rgba(49, 28, 82, 0.07);
}

/* —— Etiquetas de sección (mono + mark-dot) —— */
.section__label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 var(--space-xs);
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-green);
}

.encuestas-tema-claro .section__label {
  color: #1b6c4e;
}

.mark-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-purple);
  box-shadow: 0 0 10px var(--brand-purple-glow);
  flex-shrink: 0;
}

.mark-dot--green {
  background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green-glow);
}

/* —— Campo (label + control) —— */
.aurora-form .field {
  margin: 0;
  min-inline-size: 0;
}

.aurora-form .field__label,
.aurora-form.aurora-form-panel > label,
.aurora-form > label,
.aurora-form fieldset.aurora-campos > label,
.aurora-form fieldset.aurora-campos legend,
.aurora-form .aurora-grid > label {
  display: block;
  margin: 0 0 0.35rem;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.aurora-form fieldset.aurora-campos legend {
  padding-inline: 0.35rem;
  font-size: clamp(0.72rem, 2vw, 0.78rem);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-green);
  margin-bottom: 0.65rem;
}

.encuestas-tema-claro .aurora-form fieldset.aurora-campos legend {
  color: #5424a9;
}

.aurora-form .field__optional,
.aurora-form .privacidad.aurora-ayuda {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.aurora-form .field__input,
.aurora-form :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 46px;
  margin-top: 0.32rem;
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: max(16px, 0.9375rem);
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-sm);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast);
}

.encuestas-tema-claro .aurora-form :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  background: #faf8fd;
  border-color: #8d809e;
}

.aurora-form textarea {
  min-height: 5.5rem;
  resize: vertical;
  line-height: 1.45;
}

.aurora-form select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.25rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239d6bff' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
}

.encuestas-tema-claro .aurora-form select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235424a9' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
}

.aurora-form :is(input, select, textarea):focus {
  outline: none;
  border-color: var(--line-purple);
  box-shadow: 0 0 0 3px rgba(124, 59, 255, 0.18);
}

.aurora-form :is(input, select, textarea):focus-visible {
  outline: 2px solid var(--brand-purple-soft);
  outline-offset: 2px;
}

.aurora-form :is(input, select, textarea):disabled,
.aurora-form :is(input, select, textarea)[readonly] {
  opacity: 0.72;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.04);
}

.encuestas-tema-claro .aurora-form :is(input, select, textarea):disabled,
.encuestas-tema-claro .aurora-form :is(input, select, textarea)[readonly] {
  background: #f5effc;
}

.aurora-form :is(input, select, textarea):user-invalid:not(:focus) {
  border-color: rgba(255, 120, 120, 0.55);
  box-shadow: 0 0 0 2px rgba(255, 120, 120, 0.12);
}

/* —— Botones Aurora —— */
.aurora-form .btn,
.encuesta-catalogo-card__acciones .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 48px;
  padding: 0.75rem 1.35rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast), border-color var(--dur-fast);
}

.aurora-form .btn--primary {
  background: var(--cta);
  color: var(--cta-text);
  box-shadow: 0 8px 28px var(--brand-purple-glow);
}

.aurora-form .btn--primary:hover:not(:disabled) {
  background: var(--cta-hover);
  transform: translateY(-1px);
}

.aurora-form .btn--ghost,
.encuesta-catalogo-card__acciones .btn--ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--line-subtle);
}

.encuestas-tema-claro .aurora-form .btn--ghost,
.encuestas-tema-claro .encuesta-catalogo-card__acciones .btn--ghost {
  border-color: #e1d8ec;
}

.aurora-form .btn--ghost:hover:not(:disabled),
.encuesta-catalogo-card__acciones .btn--ghost:hover:not(:disabled) {
  border-color: var(--line-purple);
  background: rgba(124, 59, 255, 0.06);
}

.aurora-form .btn:not(.btn--primary):not(.btn--ghost) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1.35rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-subtle);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
}

.aurora-form .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.aurora-form .btn[aria-busy="true"]::after {
  content: "";
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: aurora-form-spin 0.75s linear infinite;
}

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

/* —— Avisos —— */
.aurora-form .alert {
  margin: 0 0 var(--space-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.875rem;
  color: #ffb4b4;
  background: rgba(255, 120, 120, 0.1);
  border: 1px solid rgba(255, 120, 120, 0.35);
  border-radius: var(--radius-sm);
}

.aurora-form .aurora-aviso:not(:empty),
.aurora-form .proveedores-estado:not(:empty) {
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.aurora-form .proveedores-estado[data-tipo="error"],
.aurora-form .aurora-aviso[data-tipo="error"] {
  color: #ffb4b4;
  background: rgba(255, 120, 120, 0.1);
  border: 1px solid rgba(255, 120, 120, 0.35);
}

.aurora-form .proveedores-estado[data-tipo="ok"] {
  color: var(--accent-green);
  background: rgba(61, 255, 154, 0.08);
  border: 1px solid rgba(61, 255, 154, 0.28);
}

.encuestas-tema-claro .aurora-form .proveedores-estado[data-tipo="ok"] {
  color: #176742;
  background: rgba(39, 160, 99, 0.1);
}

@media (prefers-reduced-motion: reduce) {
  .aurora-form .btn--primary:hover:not(:disabled) {
    transform: none;
  }

  .aurora-form .btn[aria-busy="true"]::after {
    animation: none;
    border-top-color: currentColor;
  }
}
