/* ═══════════════════════════════════════
   AUTH DIALOG — Sign In / Sign Up tabs (authModal.js)
   Built on css/styles.css theme vars. All .auth-* rules below used to live
   in signIn.css / signUp.css, which went away with those pages.
═══════════════════════════════════════ */

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 1400; /* above .navbar (1100) and .editor-modal-overlay (1000) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-modal[hidden] { display: none; }

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 30, 0.7);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

html.auth-modal-open { overflow: hidden; }

/* ═══════ Card ═══════ */
.auth-card {
  width: 100%;
  max-width: 440px;
  background: rgba(20, 29, 66, 0.97);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top: 4px solid var(--coral);
  border-radius: 20px;
  padding: 46px 28px 32px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

.auth-modal-dialog {
  position: relative;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  outline: none;
}

.auth-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.auth-modal-close:hover,
.auth-modal-close:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
}

/* ═══════ Tabs ═══════ */
.auth-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 22px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.auth-tab {
  flex: 1;
  padding: 10px 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-family: 'Luckiest Guy', cursive;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.auth-tab:hover { color: var(--white); }

.auth-tab.is-active,
.auth-tab[aria-selected="true"] {
  background: var(--coral);
  color: var(--white);
}

.auth-tab:focus-visible,
.auth-field input:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

.auth-card-title {
  font-family: 'Luckiest Guy', cursive;
  font-size: 1.5rem;
  text-align: center;
  color: var(--white);
  -webkit-text-stroke: 1px rgba(0, 0, 0, 0.18);
  paint-order: stroke fill;
  text-shadow: 2px 3px 0 rgba(0, 0, 0, 0.25);
  letter-spacing: 0.03em;
}

.auth-card-sub {
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
}

/* ═══════ Form ═══════ */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 20px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-field label {
  font-family: 'Luckiest Guy', cursive;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.02em;
}

.auth-field input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  font-family: 'Fira Sans Condensed', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.auth-field input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.auth-field input:focus {
  border-color: var(--white);
  box-shadow: 0 0 0 3px rgba(235, 66, 41, 0.3);
}

.auth-field input:disabled {
  opacity: 0.6;
}

/* Autofill (Chrome) keeps our dark theme instead of flashing white */
.auth-field input:-webkit-autofill {
  -webkit-text-fill-color: var(--white);
  -webkit-box-shadow: 0 0 0px 1000px rgba(30, 40, 80, 0.9) inset;
  transition: background-color 9999s ease-in-out 0s;
}

/* ═══════ Links / secondary actions ═══════ */
.auth-links-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -4px;
}

.auth-link-btn {
  background: none;
  border: none;
  padding: 0;
  color: rgba(255, 255, 255, 0.75);
  font-family: 'Fira Sans Condensed', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.auth-link-btn:hover {
  color: var(--white);
}

.auth-resend-btn {
  align-self: center;
  margin-top: 2px;
}

.auth-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 14px;
  color: rgba(255, 255, 255, 0.75);
  font-family: 'Fira Sans Condensed', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-back-btn:hover {
  color: var(--white);
}

.auth-switch {
  margin-top: 20px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
}

.auth-switch a {
  color: var(--white);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ═══════ Submit button ═══════ */
.auth-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px;
  margin-top: 4px;
  background: var(--coral);
  color: var(--white);
  font-family: 'Luckiest Guy', cursive;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.auth-submit-btn:hover:not(:disabled) {
  background: var(--coral-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.auth-submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.auth-btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* ═══════ Status messages ═══════ */
.auth-message {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

.auth-message--error {
  background: rgba(235, 66, 41, 0.18);
  border: 1px solid rgba(235, 66, 41, 0.5);
  color: #ffd4cc;
}

.auth-message--success {
  background: rgba(46, 204, 113, 0.15);
  border: 1px solid rgba(46, 204, 113, 0.45);
  color: #bdf2d3;
}

/* ═══════ View switching ═══════ */
.is-hidden {
  display: none !important;
}

/* ═══════ Toast (mirrors level.html's #levelToast) ═══════ */
.auth-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 12px);
  background: rgba(20, 29, 66, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--white);
  font-family: 'Fira Sans Condensed', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 500;
  max-width: 90vw;
  text-align: center;
}

.auth-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Inline "way out" button inside an error message — e.g. email_taken pointing
   at the Sign In tab right where the error is. */
.auth-inline-link {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* ═══════ Responsive ═══════ */
@media (max-width: 520px) {
  .auth-card {
    padding: 20px 20px 26px;
    border-radius: 16px;
  }

  .auth-card-title {
    font-size: 1.3rem;
  }
}

/* Pages with their own generic `button` / `input` / `body.dark ...` styles
   (the feedback dashboards) must not restyle the dialog's controls — these
   repeat the key properties at higher specificity. */
.auth-modal .auth-submit-btn {
  height: auto;
  padding: 14px;
  border: none;
  border-radius: 30px;
  background: var(--coral);
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 400;
}
.auth-modal .auth-submit-btn:hover:not(:disabled) { background: var(--coral-dark); }

.auth-modal .auth-tab {
  height: auto;
  padding: 10px 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.95rem;
  font-weight: 400;
}
.auth-modal .auth-tab.is-active,
.auth-modal .auth-tab[aria-selected="true"] {
  background: var(--coral);
  color: var(--white);
}

.auth-modal .auth-modal-close {
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: 1.6rem;
}
.auth-modal .auth-modal-close:hover { background: rgba(255, 255, 255, 0.12); color: var(--white); }

.auth-modal .auth-link-btn,
.auth-modal .auth-back-btn,
.auth-modal .auth-inline-link {
  height: auto;
  padding: 0;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.75);
}

.auth-modal .auth-field input {
  height: auto;
  padding: 12px 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
}
