/* ══════════════════════════════════
   FIELD VALIDATION STATES
   Append to css/auth-modal.css (or your own stylesheet
   loaded after it). Applied by Auth-modal.js via
   setFieldState() as the user types, and by the server
   redirect on login/register failure.
══════════════════════════════════ */

.form-input.field-invalid {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
}
.form-input.field-valid {
  border-color: #16a34a !important;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12) !important;
}

/* ══════════════════════════════════
   TOAST NOTIFICATIONS (top-right pop-up)
   Created dynamically by showToast() in Auth-modal.js
══════════════════════════════════ */
#toastContainer {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.16),
    0 0 0 1px rgba(0, 0, 0, 0.04);
  font-family: var(--font-body, sans-serif);
  font-size: 13.5px;
  line-height: 1.5;
  opacity: 0;
  transform: translateX(24px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}
.toast.show {
  opacity: 1;
  transform: translateX(0);
}
.toast.hide {
  opacity: 0;
  transform: translateX(24px);
}

.toast-error {
  border-left: 4px solid #ef4444;
}
.toast-success {
  border-left: 4px solid #16a34a;
}

.toast-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  margin-top: 1px;
}
.toast-error .toast-icon {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}
.toast-success .toast-icon {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

.toast-msg {
  flex: 1;
  color: #1e293b;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 11px;
  padding: 2px;
  line-height: 1;
}
.toast-close:hover {
  color: #475569;
}

@media (max-width: 480px) {
  #toastContainer {
    top: 12px;
    right: 12px;
    left: 12px;
    max-width: none;
  }
}

/* ══════════════════════════════════
   INLINE FIELD ERROR MESSAGES
   Sits directly under the input it belongs to.
   Shown/hidden and filled in by Auth-modal.js.
══════════════════════════════════ */
.field-error-msg {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  padding: 2px 2px 0;
  font-size: 12px;
  line-height: 1.4;
  min-height: 16px; /* reserves the row even when there's no error */
  color: #b91c1c;
  visibility: hidden; /* was display:none — this keeps the space, just hides content */
  opacity: 0;
}
.field-error-msg.show {
  visibility: visible;
  opacity: 1;
}
.field-error-msg::before {
  content: "⚠";
  font-size: 11px;
  flex-shrink: 0;
}

/* ══════════════════════════════════
   OTP VERIFICATION VIEW
══════════════════════════════════ */
.otp-inputs {
  display: flex;
  gap: clamp(5px, 1.8vw, 10px);
  justify-content: center;
  margin: 6px 0 4px;
  max-width: 100%;
}
/* Fluid boxes: six of them must fit a 320px-wide phone inside the modal. */
.otp-box {
  flex: 1 1 0;
  min-width: 0;
  max-width: 44px;
  width: 44px;
  height: 54px;
  padding: 0;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-head);
}
#authViewOtp .field-error-msg {
  justify-content: center;
  margin-bottom: 6px;
}
#resendOtpLink {
  transition: opacity 0.2s;
}
#resendOtpLink.disabled {
  pointer-events: none;
  opacity: 0.5;
  text-decoration: none;
  cursor: default;
}
#resendCountdown {
  color: var(--text3, #94a3b8);
}
