/**
 * Password Visibility Toggle Styles
 * Styling for the Show/Hide Password feature
 * - Professional appearance
 * - Responsive design
 * - Accessibility compliant
 * - Touch-friendly on mobile
 */

/* Password field wrapper */
.password-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

/* Ensure input takes up space while leaving room for toggle button */
.password-field input[type="password"],
.password-field input[type="text"] {
  flex: 1;
  padding-right: 44px;
}

/* Password toggle button */
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  color: #666;
  transition: color 0.2s ease, transform 0.1s ease;
  border-radius: 4px;
  z-index: 10;
}

.password-toggle:hover {
  color: #333;
  transform: translateY(-50%) scale(1.1);
}

.password-toggle:active {
  transform: translateY(-50%) scale(0.95);
}

.password-toggle:focus {
  outline: 2px solid #5e2fde;
  outline-offset: 2px;
  background: rgba(94, 47, 222, 0.1);
}

/* Icon styling */
.password-toggle-icon {
  display: inline-block;
  font-size: 18px;
  line-height: 1;
  font-style: normal;
  font-weight: normal;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .password-toggle {
    padding: 8px;
    font-size: 16px;
    right: 10px;
  }

  .password-field input[type="password"],
  .password-field input[type="text"] {
    padding-right: 42px;
  }
}

@media (max-width: 480px) {
  .password-toggle {
    padding: 6px;
    font-size: 16px;
    right: 8px;
  }

  .password-field input[type="password"],
  .password-field input[type="text"] {
    padding-right: 40px;
  }
}

/* Accessibility: ensure button is visible in high contrast mode */
@media (prefers-contrast: more) {
  .password-toggle {
    border: 2px solid transparent;
  }

  .password-toggle:focus {
    border: 2px solid currentColor;
    outline: none;
  }
}

/* Dark mode support (if theme uses it) */
@media (prefers-color-scheme: dark) {
  .password-toggle {
    color: #aaa;
  }

  .password-toggle:hover {
    color: #fff;
  }

  .password-toggle:focus {
    background: rgba(94, 47, 222, 0.2);
  }
}

/* Ensure toggle doesn't interfere with browser password managers */
.password-field input[type="password"]:autofill,
.password-field input[type="text"]:autofill {
  -webkit-autofill: none;
}

/* Mobile touch target minimum size (WCAG 2.1 Level AAA) */
@media (pointer: coarse) {
  .password-toggle {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
