/* ===================================================================
   CODE SLOTS COMPONENT STYLES (React Bits Inspiration)
   Animated, physics-based One-Time-Code / Activation Slot Inputs
   =================================================================== */

.codeslots-wrapper {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin: 16px auto 20px;
  user-select: none;
}

.codeslots-container {
  display: flex;
  align-items: center;
  gap: var(--cs-gap, 8px);
  position: relative;
}

/* Hidden overlay input that handles all focus, typing, pasting and IME */
.codeslots-hidden-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
  font-size: 1px;
  border: none;
  background: transparent;
  outline: none;
  caret-color: transparent;
  color: transparent;
}

/* Individual Slot Box */
.codeslots-slot {
  width: var(--cs-size, 44px);
  height: calc(var(--cs-size, 44px) * 1.15);
  border-radius: var(--cs-radius, 12px);
  background: var(--cs-slot, #141416);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: border-color var(--cs-settle, 0.3s) cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow var(--cs-settle, 0.3s) ease,
              transform var(--cs-settle, 0.3s) cubic-bezier(0.34, 1.56, 0.64, 1);
}

.codeslots-slot.slot-group-end {
  margin-right: 14px;
}

.codeslots-slot.slot-group-end::before {
  content: '–';
  position: absolute;
  right: -11px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.4);
  font-weight: 800;
  font-size: 13px;
  pointer-events: none;
  z-index: 5;
}

/* Active Slot (Cursor) */
.codeslots-slot.is-active {
  border-color: var(--cs-accent, #ffffff);
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.35), 0 4px 12px rgba(0, 0, 0, 0.6);
}

.codeslots-slot.is-active::after {
  content: '';
  width: 2px;
  height: calc(var(--cs-size, 44px) * 0.45);
  background: var(--cs-accent, #ffffff);
  border-radius: 2px;
  animation: cs-caret-blink 1s ease-in-out infinite;
}

@keyframes cs-caret-blink {
  0%, 100% { opacity: 1; transform: scaleY(1); }
  50% { opacity: 0; transform: scaleY(0.7); }
}

/* Filled Slot */
.codeslots-slot.is-filled {
  border-color: rgba(255, 255, 255, 0.2);
}

.codeslots-slot.bounce-trigger {
  animation: cs-slot-bounce var(--cs-bounce, 0.2s) cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cs-slot-bounce {
  0% { transform: scale(1); }
  45% { transform: scale(1.08) translateY(-2px); border-color: var(--cs-accent, #f5f5f5); }
  100% { transform: scale(1) translateY(0); }
}

/* Character / Digit inside Slot */
.codeslots-digit {
  font-size: var(--cs-font, 22px);
  font-weight: 800;
  font-family: 'Outfit', monospace;
  color: var(--cs-ink, #f5f5f5);
  text-transform: uppercase;
  display: inline-block;
  line-height: 1;
}

.codeslots-digit.rise-in {
  animation: cs-digit-rise var(--cs-settle, 0.3s) cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cs-digit-rise {
  0% {
    opacity: 0;
    transform: translateY(var(--cs-rise, 8px)) scale(0.85);
  }
  60% {
    opacity: 1;
    transform: translateY(-2px) scale(1.08);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===================================================================
   STATUS: ERROR (SHAKE & CASCADE DRAIN)
   =================================================================== */
.codeslots-container.status-error {
  animation: cs-shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes cs-shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

.codeslots-container.status-error .codeslots-slot {
  border-color: var(--cs-danger, #ff3b30) !important;
  box-shadow: 0 0 16px rgba(255, 59, 48, 0.35) !important;
}

.codeslots-container.status-error .codeslots-digit {
  color: var(--cs-danger, #ff3b30);
  animation: cs-drain 0.4s ease-in forwards;
}

@keyframes cs-drain {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(var(--cs-rise, 8px));
    opacity: 0;
  }
}

/* ===================================================================
   STATUS: SUCCESS (ACCENT WASH & CELEBRATION GLOW)
   =================================================================== */
.codeslots-container.status-success .codeslots-slot {
  border-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.12) !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4) !important;
  animation: cs-success-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.codeslots-container.status-success .codeslots-digit {
  color: #10b981 !important;
}

@keyframes cs-success-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
