:root {
  --accent: #1013b9; /* emerald-500 */
  --accent-600: #051396;
  --muted: #6b7280;
  --danger: #dc2626;
  --bg-card: #fff;
  --glass: rgba(255, 255, 255, 0.6);
}

/* Base adjustments */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Form field container selector: targets the grid children inside #sorteoForm */
#sorteoForm .grid > div {
  position: relative;
  padding-top: 0.25rem;
}

/* Label styling: will animate when parent has .field-active */
#sorteoForm .grid > div > label {
  display: block;
  font-weight: 600;
  color: var(--muted);
  transform-origin: left top;
  transition: transform 180ms cubic-bezier(0.2, 0.9, 0.2, 1), color 180ms;
  margin-bottom: 0.375rem;
}

/* When field is active (focused or has value) make label smaller and move up slightly */
#sorteoForm .grid > div.field-active > label {
  transform: translateY(-6px) scale(0.94);
  color: var(--accent-600);
}

/* Inputs - smooth focus ring, subtle shadow */
#sorteoForm input[type="text"],
#sorteoForm input[type="email"],
#sorteoForm input[type="tel"],
#sorteoForm select {
  transition: box-shadow 180ms, border-color 180ms, transform 120ms;
  will-change: box-shadow, border-color, transform;
  border-width: 1px;
  border-style: solid;
  border-color: #e6e6e6;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.8),
    rgba(250, 250, 250, 0.98)
  );
}

/* Focus state */
#sorteoForm .grid > div.field-active input,
#sorteoForm .grid > div.field-active select {
  border-color: rgba(9, 61, 206, 0.9);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.06);
  transform: translateY(-2px);
}

/* Error state */
.error-field input,
.error-field select {
  border-color: rgba(220, 38, 38, 0.9) !important;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.06);
}
#error-nombre,
#error-apellido,
#error-operadora,
#error-telefono,
#error-email,
#error-como {
  transition: opacity 160ms;
}

/* Small helper for the token display in modal */
#modalToken {
  letter-spacing: 0.06em;
}

/* Button base micro-interactions */
button {
  transition: transform 140ms cubic-bezier(0.2, 0.9, 0.2, 1), box-shadow 140ms;
  will-change: transform;
}
button:active {
  transform: translateY(1px) scale(0.995);
}

/* Primary button (submit) enhancements */
#submitBtn {
  position: relative;
  overflow: hidden; /* for ripple */
}

/* Ripple element inserted dynamically */
.btn-ripple {
  position: absolute;
  border-radius: 9999px;
  transform: translate(-50%, -50%) scale(0.1);
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
  opacity: 0;
}

/* Spinner for loading state on buttons (shows when .loading class applied) */
#submitBtn.loading::after {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-top-color: rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  margin-left: 8px;
  vertical-align: middle;
  animation: spin 0.9s linear infinite;
}

/* Copy button micro-feedback (already text changes via JS) */
#copyTokenBtn {
  transition: background 140ms, transform 120ms;
}

/* Table winner highlight (listsorteo) */
.table-winner {
  background: linear-gradient(
    90deg,
    rgba(220, 252, 231, 0.18),
    rgba(236, 253, 245, 0.08)
  );
  border-left: 4px solid var(--accent);
  transition: transform 220ms, box-shadow 220ms;
}
.table-winner:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.06);
}

/* Field hover subtle elevation */
#sorteoForm .grid > div:hover {
  transform: translateY(-2px);
  transition: transform 160ms;
}

/* Small shake animation for invalid submit */
@keyframes shake {
  10%,
  90% {
    transform: translateX(-1px);
  }
  20%,
  80% {
    transform: translateX(2px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-4px);
  }
  40%,
  60% {
    transform: translateX(4px);
  }
}

/* Spinner keyframes */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive tweaks remain handled by Tailwind; keep minimal CSS here */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
