/* ============================================================
   Reveal Password — Column Sweep Animation
   Adds a toggle eye button to password inputs. Clicking reveals
   the password with a left-to-right sweeping transition.

   Auto-applies to all input[type="password"] elements.
   For dynamically created inputs, call: initRevealPassword(input)
   ============================================================ */

/* ── Wrapper (replaces input's own border) ── */
.pw-field {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 8px;
  background: var(--bg, #fafafa);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pw-field:focus-within {
  border-color: var(--primary, #354996);
  box-shadow: 0 0 0 3px rgba(53, 73, 150, 0.15);
  background: #fff;
}

/* ── Input inside wrapper (border/bg removed) ── */
.pw-field > input {
  border: none !important;
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
  flex: 1;
  min-width: 0;
  padding-right: 44px !important;
}

/* ── Toggle eye button ── */
.pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #aaa;
  transition: color 0.2s ease;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  line-height: 1;
}

.pw-toggle:hover {
  color: var(--primary, #354996);
}

.pw-toggle:focus-visible {
  outline: 2px solid var(--primary, #354996);
  outline-offset: 2px;
}

/* Eye icon toggle */
.pw-toggle .pw-eye-show { display: block; }
.pw-toggle .pw-eye-hide { display: none; }
.pw-field.pw-revealed .pw-toggle .pw-eye-show { display: none; }
.pw-field.pw-revealed .pw-toggle .pw-eye-hide { display: block; }

/* ── Column sweep animation ── */
@keyframes pw-column-sweep {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0% 0 0);
  }
}

.pw-sweeping {
  animation: pw-column-sweep 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ── Accessibility: reduce motion ── */
@media (prefers-reduced-motion: reduce) {
  .pw-sweeping {
    animation: none;
  }
}
