/* =============================================================
   ACCOUNT UI STYLES
   -------------------------------------------------------------
   Styles for everything auth-ui.js renders: the signup/login/
   reset forms (used in both the modal and the /account/ page),
   the popup modal shell, and the "save your results" card that
   appears on results pages. All colors/spacing come from the
   design-system variables in global.css.
   ============================================================= */


/* -------------------------------------------------------------
   FORMS
   ------------------------------------------------------------- */

.auth-form {
  display:        flex;
  flex-direction: column;
  gap:            var(--space-sm);
}

.auth-form__label {
  display:        flex;
  flex-direction: column;
  gap:            var(--space-xs);
  font-size:      var(--text-small);
  font-weight:    var(--font-weight-medium);
  color:          var(--color-text);
}

.auth-form__input {
  font-family:   var(--font-family);
  font-size:     var(--text-body);
  font-weight:   var(--font-weight-light);
  color:         var(--color-text);
  padding:       12px var(--space-sm);
  border:        1px solid var(--color-border);
  border-radius: var(--radius-md);
  background:    var(--color-background);
  transition:    border-color var(--transition);
}

.auth-form__input:focus {
  outline:      none;
  border-color: var(--color-steel-blue);
}

.auth-form__hint {
  font-size: var(--text-small);
  color:     var(--color-text-muted);
  margin:    0;
}

/* Inline validation / server error message. Hidden by default via
   the [hidden] attribute; auth-ui.js unhides it with a message. */
.auth-form__error {
  font-size:     var(--text-small);
  color:         #B3261E;                    /* Accessible red on white */
  background:    #FCEEED;
  border-radius: var(--radius-sm);
  padding:       var(--space-xs) var(--space-sm);
  margin:        0;
}

.auth-form__submit {
  align-self: flex-start;
}

.auth-form__submit:disabled {
  opacity: 0.6;
  cursor:  wait;
}

/* Secondary links under a form ("Forgot your password?" etc.) */
.auth-form__alt {
  font-size: var(--text-small);
  margin:    0;
}


/* -------------------------------------------------------------
   TABS (Create account | Log in)
   ------------------------------------------------------------- */

.auth-tabs {
  display:       flex;
  gap:           0;
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.auth-tabs__tab {
  font-family:   var(--font-family);
  font-size:     var(--text-body);
  font-weight:   var(--font-weight-medium);
  color:         var(--color-text-muted);
  background:    transparent;
  border:        none;
  border-bottom: 3px solid transparent;   /* Reserve space so switching tabs doesn't shift layout */
  padding:       var(--space-xs) var(--space-sm) 10px;
  cursor:        pointer;
  transition:    color var(--transition), border-color var(--transition);
}

.auth-tabs__tab:hover {
  color: var(--color-text);
}

.auth-tabs__tab.is-active {
  color:               var(--color-text);
  border-bottom-color: var(--color-coral);
}


/* -------------------------------------------------------------
   PANEL TEXT (headings/notices shared by modal + account page)
   ------------------------------------------------------------- */

.auth-panel__heading {
  font-size: var(--text-h3);
  margin:    0 0 var(--space-sm);
}

.auth-panel__text {
  font-size: var(--text-body);
  color:     var(--color-text-muted);
  margin:    0 0 var(--space-md);
}

.auth-panel__notice {
  padding: var(--space-sm) 0;
}


/* -------------------------------------------------------------
   MODAL
   Fixed overlay covering the viewport; dialog centered within.
   Hidden until auth-ui.js adds .is-open.
   ------------------------------------------------------------- */

.auth-modal {
  position: fixed;
  inset:    0;                 /* top/right/bottom/left: 0 */
  z-index:  1000;              /* Above the sticky nav (z-index 100) */
  display:  none;
}

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

/* Stop the page behind the modal from scrolling while it's open. */
body.auth-modal-open {
  overflow: hidden;
}

.auth-modal__backdrop {
  position:   absolute;
  inset:      0;
  background: rgba(26, 26, 26, 0.55);   /* --color-text at 55% */
}

.auth-modal__dialog {
  position:      relative;
  max-width:     440px;
  margin:        10vh auto 0;
  background:    var(--color-background);
  border-radius: var(--radius-lg);
  padding:       var(--space-lg) var(--space-lg) var(--space-lg);
  box-shadow:    0 12px 40px rgba(0, 0, 0, 0.25);
}

@media (max-width: 520px) {
  .auth-modal__dialog {
    margin:  0;
    /* Full-width sheet pinned to the bottom on small phones */
    position:      absolute;
    bottom:        0;
    left:          0;
    right:         0;
    max-width:     none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding:       var(--space-md);
  }
}

.auth-modal__close {
  position:    absolute;
  top:         var(--space-sm);
  right:       var(--space-sm);
  width:       40px;
  height:      40px;
  font-size:   26px;
  line-height: 1;
  color:       var(--color-text-muted);
  background:  transparent;
  border:      none;
  border-radius: var(--radius-md);
  cursor:      pointer;
  transition:  background-color var(--transition), color var(--transition);
}

.auth-modal__close:hover {
  background: var(--color-surface);
  color:      var(--color-text);
}


/* -------------------------------------------------------------
   "SAVE YOUR RESULTS" CARD (results pages)
   ------------------------------------------------------------- */

.auth-card {
  background:    var(--color-surface);
  border:        1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding:       var(--space-md);
  margin:        var(--space-lg) 0;
  text-align:    center;
}

.auth-card__heading {
  font-size: var(--text-h4);
  margin:    0 0 var(--space-xs);
}

.auth-card__text {
  font-size: var(--text-small);
  color:     var(--color-text-muted);
  max-width: 560px;
  margin:    0 auto var(--space-sm);
}

.auth-card__actions {
  display:         flex;
  align-items:     center;
  justify-content: center;
  gap:             var(--space-md);
  flex-wrap:       wrap;
}

/* Quiet text-style button next to the primary CTA */
.auth-card__login-link {
  font-family:     var(--font-family);
  font-size:       var(--text-small);
  font-weight:     var(--font-weight-medium);
  color:           var(--color-steel-blue);
  background:      transparent;
  border:          none;
  cursor:          pointer;
  text-decoration: underline;
}

/* Confirmed state after login + sync — calmer, tinted, compact. */
.auth-card--saved {
  background:   #EAF6EC;                       /* Soft success green */
  border-color: var(--color-shame-deep);        /* The site's green accent */
  padding:      var(--space-sm) var(--space-md);
}

.auth-card--saved .auth-card__text {
  color:  var(--color-text);
  margin: 0 auto;
}
