/* Small layer on top of Tailwind: motion, focus, and iOS input behavior. */

:root {
  --brand-700: #1a458d;
  --brand-500: #2f6fd0;
}

/* iOS zooms any input whose font-size is under 16px on focus. */
input, select, textarea, button {
  font-size: 16px;
}

body {
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

/* Screen transitions ------------------------------------------------------ */
.screen-enter {
  animation: screen-in 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.screen-enter-back {
  animation: screen-in-back 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes screen-in {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes screen-in-back {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}

.pop-in { animation: pop-in 420ms cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes pop-in {
  0%   { opacity: 0; transform: scale(0.94); }
  60%  { transform: scale(1.02); }
  100% { opacity: 1; transform: scale(1); }
}

.shake { animation: shake 320ms ease-in-out; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@media (prefers-reduced-motion: reduce) {
  .screen-enter, .screen-enter-back, .pop-in, .shake { animation: none !important; }
  * { transition-duration: 1ms !important; }
}

/* Controls ---------------------------------------------------------------- */
.field {
  width: 100%;
  min-height: 52px;
  border-radius: 0.75rem;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  padding: 0.75rem 0.9rem;
  color: #0f172a;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.field::placeholder { color: #94a3b8; }
.field:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(47, 111, 208, 0.15);
}
.field.is-invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
}
textarea.field { min-height: 128px; resize: vertical; line-height: 1.55; }

/* Radio and tile options -------------------------------------------------- */
.option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 56px;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  text-align: left;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}
.option:active { transform: scale(0.995); }
.option[aria-checked="true"] {
  border-color: var(--brand-500);
  background: #eef4fd;
  box-shadow: 0 0 0 3px rgba(47, 111, 208, 0.12);
}
.option .dot {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 999px;
  border: 2px solid #94a3b8;
  display: grid; place-items: center;
  transition: border-color 140ms ease;
}
.option[aria-checked="true"] .dot { border-color: var(--brand-700); }
.option[aria-checked="true"] .dot::after {
  content: "";
  width: 11px; height: 11px;
  border-radius: 999px;
  background: var(--brand-700);
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 92px;
  padding: 0.75rem 0.5rem;
  border-radius: 0.9rem;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease, transform 100ms ease;
}
.tile:active { transform: scale(0.97); }
.tile[aria-checked="true"] {
  border-color: var(--brand-500);
  background: #eef4fd;
  box-shadow: 0 0 0 3px rgba(47, 111, 208, 0.12);
}
.tile svg { width: 26px; height: 26px; color: #475569; }
.tile[aria-checked="true"] svg { color: var(--brand-700); }
.tile span { font-size: 14px; font-weight: 600; line-height: 1.2; text-align: center; }

/* Buttons ----------------------------------------------------------------- */
.btn-primary {
  width: 100%;
  min-height: 52px;
  border-radius: 0.75rem;
  background: var(--brand-700);
  color: #fff;
  font-weight: 600;
  transition: background-color 140ms ease, transform 100ms ease;
}
.btn-primary:hover { background: #12305c; }
.btn-primary:active { transform: scale(0.99); }
.btn-primary:disabled { opacity: 0.55; }

.btn-secondary {
  min-height: 52px;
  border-radius: 0.75rem;
  background: #fff;
  border: 1.5px solid #cbd5e1;
  color: #334155;
  font-weight: 600;
  padding: 0 1.25rem;
  transition: background-color 140ms ease;
}
.btn-secondary:hover { background: #f8fafc; }

/* Cards ------------------------------------------------------------------- */
.card {
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px -12px rgba(15, 23, 42, 0.18);
  padding: 1.5rem 1.25rem;
}

.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 999px;
  animation: spin 700ms linear infinite;
}
.spinner-dark { border-color: rgba(15,23,42,0.2); border-top-color: #1a458d; }
@keyframes spin { to { transform: rotate(360deg); } }
