/* Container */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;               /* toggled by .is-open */
  align-items: center;
  justify-content: center;
}

.auth-modal.is-open {
  display: flex;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}

.auth-content {
  position: relative;
  background: var(--modal-bg, #ffffff);
  color: var(--modal-fg, #111);
  padding: 1.5rem;
  border-radius: 14px;
  width: 92%;
  max-width: 420px;
  box-shadow: 0 6px 30px rgba(0,0,0,.2);
  z-index: 2;
}

/* Close button */
.auth-close-btn {
  position: absolute;
  top: .5rem;
  right: .5rem;
}

/* Tabs */
.auth-tabs {
  display: flex;
  gap: .5rem;
  margin: 1rem 0;
}

.auth-tab {
  flex: 1;
  padding: .65rem 0;
  border-radius: 8px;
  background: var(--chip-bg, #f3f4f6);
  border: 1px solid var(--chip-border, #ccc);
}

.auth-tab.is-active {
  background: var(--accent-bg, #e6f2ff);
  border-color: var(--accent-border, #aac3ff);
}

/* Register-only fields hidden in login mode */
.auth-register-only.hidden {
  display: none;
}

/* Error banner */
.auth-error {
  background: #fee2e2;
  color: #b91c1c;
  padding: .5rem .75rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.auth-error.hidden {
  display: none;
}

/* Submit */
.auth-submit {
  margin-top: 1rem;
  width: 100%;
}

.auth-page {
  font-family: var(--font-body, sans-serif);
  background: var(--surface-1, #f8f9fa);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 16px 32px;
  color: #245b74;
}

.auth-page .auth-card {
  width: min(92vw, 460px);
  background: radial-gradient(
    circle farthest-corner at 50% 180%,
    #fff9de 0%,
    #fff9de 20%,
    #ffffff 100%
  );
  padding: 2rem;
  border-radius: 16px;
  border: 1px solid rgba(15,23,42,.06);
  box-shadow: 0 6px 16px rgba(0,0,0,.06);
}

.auth-page .auth-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  margin-bottom: 0.25rem;
  position: relative;
}

.auth-page .auth-logo img {
  height: 40px;
  width: auto;
  display: block;
}

.auth-page .auth-logo::after {
  content: "";
  display: block;
  width: 100%;
  height: 1.85px;
  margin: 10px auto 12px;
  background: linear-gradient(90deg,
    rgba(252, 224, 163, 0) 0%,
    rgba(253, 195, 71, 0.22) 10%,
    rgba(255, 165, 30, 0.45) 50%,
    rgba(253, 195, 71, 0.22) 90%,
    rgba(252, 224, 163, 0) 100%);
  border-radius: 1px;
}

.auth-page .auth-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  text-align: center;
  color: #245b74;
}

.auth-copy {
  max-width: 360px;
  margin: 0 auto 1.25rem;
  color: #245b74;
  line-height: 1.4;
  text-align: center;
}

.auth-page .auth-field {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-page .auth-field label {
  font-weight: 600;
  display: block;
  margin-bottom: .25rem;
  width: 100%;
  max-width: 360px;
  text-align: left;
}

.auth-page .auth-field input {
  width: 100%;
  max-width: 360px;
  padding: .7rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  display: block;
}

.auth-page .auth-submit,
.auth-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: .8rem 1rem;
  background: #e5c36a;
  color: #0b0b0b;
  border: 1px solid rgba(11, 26, 42, .52);
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.auth-button-secondary {
  background: #ffffff;
  color: #245b74;
  border: 1px solid #4b5563;
}

.auth-page .auth-submit:hover,
.auth-button:not(.auth-button-secondary):hover {
  background: #dcb862;
}

.auth-button-secondary:hover {
  background: #f3f4f6;
}

.auth-button:disabled,
.auth-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.62;
}

.auth-hidden {
  display: none !important;
}

.auth-page .auth-submit {
  display: flex;
  width: 100%;
  max-width: 360px;
  margin: 0.5rem auto 0;
}

.auth-page .auth-error,
.auth-message {
  width: 100%;
  max-width: 360px;
  padding: .75rem;
  border-radius: 8px;
  margin: 0 auto 1rem;
  display: none;
}

.auth-page .auth-error {
  background: #fee2e2;
  color: #b91c1c;
}

.auth-message {
  background: #ecfdf5;
  color: #166534;
}

.auth-alt {
  margin-top: 1rem;
  text-align: center;
}

.auth-alt a {
  color: #245b74;
  text-decoration: none;
  font-weight: 600;
}

.auth-legal {
  width: 100%;
  max-width: 360px;
  margin: 1.25rem auto 0;
  color: #245b74;
  font-size: 0.86rem;
  line-height: 1.3;
}

.auth-legal::before {
  content: "";
  display: block;
  width: 100%;
  height: 1.85px;
  margin: 0 auto 0.75rem;
  background: linear-gradient(90deg,
    rgba(252, 224, 163, 0) 0%,
    rgba(253, 195, 71, 0.22) 10%,
    rgba(255, 165, 30, 0.45) 50%,
    rgba(253, 195, 71, 0.22) 90%,
    rgba(252, 224, 163, 0) 100%);
  border-radius: 1px;
}

.auth-legal-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.18rem 0.38rem;
  flex-wrap: wrap;
  text-align: center;
}

.auth-legal-links span {
  color: #245b74;
}

.auth-actions {
  width: 100%;
  max-width: 360px;
  margin: 1rem auto 0;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.auth-dev-link {
  display: none;
  max-width: 360px;
  margin: 1rem auto 0;
  padding: .75rem;
  border-radius: 8px;
  background: #eff6ff;
  color: #245b74;
  overflow-wrap: anywhere;
}
