/**
 * auth-shared.css — shared chrome for the standalone auth pages
 * (login / signup / forgot-password / reset-password / invite / verify-email).
 *
 * These pages do not load dashboard-unified.css, so the toast + password-toggle
 * + offline-banner styles are duplicated here. Class names and markup match
 * DashCommon.showToast() so the two look identical.
 *
 * Every custom property has a literal fallback: the auth pages declare their own
 * token set (--text-primary/--text-muted/...), but this file must also work if
 * dropped onto a page that declares none.
 */

/* ===== BASE ===== */
/* The auth pages do not load index.css, so the iOS landscape text-inflation
   guard has to be repeated here. Without it, rotating the phone resizes body
   copy and reflows the form. No effect on desktop. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ===== TOASTS ===== */
#toastContainer,
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  border-left: 4px solid #0984e3;
  animation: authToastIn 0.3s ease-out;
  pointer-events: auto;
  min-width: 300px;
}

.toast.toast-success { border-left-color: #00b894; }
.toast.toast-error   { border-left-color: #e74c3c; }
.toast.toast-warning { border-left-color: #f39c12; }
.toast.toast-info    { border-left-color: #0984e3; }

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
}

.toast-success .toast-icon { background: rgba(0, 184, 148, 0.15); color: #00b894; }
.toast-error .toast-icon   { background: rgba(231, 76, 60, 0.15);  color: #e74c3c; }
.toast-warning .toast-icon { background: rgba(243, 156, 18, 0.15); color: #f39c12; }
.toast-info .toast-icon    { background: rgba(9, 132, 227, 0.15);  color: #0984e3; }

.toast-content { flex: 1; min-width: 0; }

.toast-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #1a1a1a);
  margin-bottom: 4px;
}

.toast-message {
  font-size: 13px;
  color: var(--text-secondary, #555555);
  line-height: 1.4;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted, #888888);
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  opacity: 0.6;
  transition: opacity 0.2s;
  line-height: 1;
}
.toast-close:hover { opacity: 1; }

.toast.toast-hiding { animation: authToastOut 0.3s ease-in forwards; }

@keyframes authToastIn {
  from { opacity: 0; transform: translateX(100px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes authToastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100px); }
}

@media (prefers-reduced-motion: reduce) {
  .toast, .toast.toast-hiding { animation: none; }
}

@media (max-width: 480px) {
  #toastContainer,
  .toast-container { top: 12px; right: 12px; left: 12px; max-width: none; }
  .toast { min-width: 0; }
}

/* ===== PASSWORD VISIBILITY TOGGLE ===== */
/* Injected by AuthUI.attachPasswordToggles() / DashCommon.attachPasswordToggles().
   The wrapper is only added when the input is not already inside a positioned
   container, so existing markup that already positions the field is untouched. */
.pw-field-wrap {
  position: relative;
  display: block;
  width: 100%;
}

/* Reserve room for the button so long values never slide under it. */
.pw-field-wrap > input[type="password"],
.pw-field-wrap > input[type="text"] {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted, #888888);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
  z-index: 2;
}
.password-toggle:hover  { color: var(--text-primary, #1a1a1a); }
.password-toggle:focus-visible {
  outline: 2px solid var(--input-focus-border, #131061);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ===== READ-ONLY FIELD ===== */
/* Used for the invite email, which is fixed by the invite itself. `readonly`
   (not `disabled`) so the value is still submitted and still selectable. */
.locked-field {
  background-color: #f4f4f5 !important;
  color: var(--text-secondary, #555555) !important;
  cursor: not-allowed;
}

/* ===== OFFLINE BANNER ===== */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
  background: #b3261e;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.offline-banner i { font-size: 14px; }
