/* ============================================================
   MIRA HOME — Auth Modal Styles
   ============================================================ */

/* ------------------------------------------------------------
   1. BACKDROP
   ------------------------------------------------------------ */
.auth-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(44, 36, 24, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.auth-backdrop.active {
  opacity: 1;
  pointer-events: all;
}


/* ------------------------------------------------------------
   2. MODAL CONTAINER
   ------------------------------------------------------------ */
.auth-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%) scale(0.97);
  z-index: 1110;
  width: min(860px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  display: grid;
  grid-template-columns: 220px 1fr;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(44, 36, 24, 0.22);
  opacity: 0;
  pointer-events: none;
  margin: 0 auto;
  transition:
    opacity 0.3s ease,
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-modal.active {
  opacity: 1;
  pointer-events: all;
  /* FIX (mobile UI bug report: guest-block sign-in modal "not centered" /
     "different from the sign in button") — this used to be `transform:
     scale(1)`, which fully replaces (not merges with) the base rule's
     `translate(-50%, -48%) scale(0.97)`. Since `transform` isn't additive
     across rules, that dropped the centering translate the instant the
     modal opened, shoving it into the bottom-right quadrant on desktop
     (confirmed via screenshot: overflowing off both the right and bottom
     edges). Must keep re-asserting translate(-50%, -50%) here too. */
  transform: translate(-50%, -50%) scale(1);
}

/* Close button */
.auth-modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background-color: rgba(44, 36, 24, 0.08);
  border: 1px solid rgba(44, 36, 24, 0.12);
  color: var(--color-brown-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  z-index: 10;
  transition: all var(--transition-fast);
}

.auth-modal-close:hover {
  background-color: rgba(44, 36, 24, 0.18);
  color: var(--color-charcoal);
  transform: rotate(90deg);
}

/* ------------------------------------------------------------
   3. LEFT DECORATIVE PANEL
   ------------------------------------------------------------ */
.auth-modal-deco {
  background-color: var(--bg-dark);
  background-image:
    radial-gradient(ellipse 120% 60% at 50% 100%, rgba(200,168,130,0.18) 0%, transparent 70%),
    radial-gradient(ellipse 80% 40% at 10% 10%,   rgba(200,168,130,0.10) 0%, transparent 60%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-6);
  position: relative;
  overflow: hidden;
}

/* Subtle rattan pattern overlay */
.auth-modal-deco::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    45deg,
    rgba(200,168,130,0.04) 0px,
    rgba(200,168,130,0.04) 1px,
    transparent 1px,
    transparent 12px
  );
  pointer-events: none;
}

.auth-deco-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.auth-deco-brand {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.auth-deco-mira {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--color-cream);
  letter-spacing: 0.06em;
  line-height: 1;
}

.auth-deco-dash {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 300;
  color: var(--color-primary);
  margin: 0 2px;
  line-height: 1;
}

.auth-deco-e {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--color-primary);
  letter-spacing: 0.06em;
  line-height: 1;
}

.auth-deco-tagline {
  font-size: var(--fs-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-brown-light);
  margin: 0;
}

.auth-deco-quote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--color-stone);
  line-height: 1.6;
  text-align: center;
  margin: var(--space-4) 0 0;
  border-left: 2px solid var(--color-primary);
  padding-left: var(--space-4);
  text-align: left;
}

.auth-deco-dots {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.auth-deco-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--color-primary);
  opacity: 0.5;
}
.auth-deco-dots span:nth-child(2) { opacity: 0.8; }
.auth-deco-dots span:nth-child(3) { opacity: 0.3; }


/* ------------------------------------------------------------
   4. RIGHT FORM PANEL
   ------------------------------------------------------------ */
.auth-modal-form-panel {
  background-color: var(--bg-card);
  padding: var(--space-8) var(--space-8);
  overflow-y: auto;
  max-height: calc(100dvh - 2rem);
  display: flex;
  flex-direction: column;
  gap: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--color-stone) transparent;
}


/* ------------------------------------------------------------
   5. TAB SWITCHER
   ------------------------------------------------------------ */
.auth-tabs {
  display: flex;
  position: relative;
  background-color: var(--bg-section-alt);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: var(--space-6);
  gap: 0;
}

.auth-tab {
  flex: 1;
  padding: 0.55rem 1rem;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--color-brown-light);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-md) - 2px);
  cursor: pointer;
  transition: color var(--transition-base);
  position: relative;
  z-index: 1;
  letter-spacing: 0.02em;
}

.auth-tab.active {
  color: var(--color-charcoal);
  font-weight: var(--fw-semibold);
}

/* Sliding indicator */
.auth-tab-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  height: calc(100% - 8px);
  width: calc(50% - 4px);
  background-color: var(--bg-card);
  border-radius: calc(var(--radius-md) - 3px);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base);
  z-index: 0;
}

.auth-tab-indicator.on-signup {
  transform: translateX(100%);
}


/* ------------------------------------------------------------
   6. AUTH PANELS
   ------------------------------------------------------------ */
.auth-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  animation: panelFadeIn 0.25s ease forwards;
}

.auth-panel.active {
  display: flex;
}

@keyframes panelFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-panel-header {
  margin-bottom: var(--space-5);
}

.auth-panel-title {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--color-charcoal);
  margin: 0 0 var(--space-1);
  line-height: 1.2;
}

.auth-panel-sub {
  font-size: var(--fs-sm);
  color: var(--color-brown-light);
  margin: 0;
}

.auth-back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--color-brown-mid);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color var(--transition-base);
}

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


/* ------------------------------------------------------------
   7. GOOGLE AND FACEBOOK BUTTONS
   ------------------------------------------------------------ */
.btn-google,
.btn-facebook {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: 0.7rem 1.5rem;
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--color-charcoal);
  cursor: pointer;
  transition: all var(--transition-base);
  letter-spacing: 0.02em;
}

.btn-google:hover,
.btn-facebook:hover,
.btn-facebook:focus-visible {
  border-color: var(--color-primary);
  background-color: var(--color-primary-xlight);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.google-icon,
.facebook-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Session 10: Facebook under Google in one stack and the SAME button as .btn-google (white, outlined, charcoal text, same hover);
   only its logo carries Facebook's blue, like the coloured G. min-height keeps both buttons 44px+ to tap, also on a phone. */
.auth-social-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.auth-social-stack .btn-google,
.auth-social-stack .btn-facebook {
  min-height: 44px;
}

/* "By continuing you agree to ..." under the social buttons (a social sign-up never sees the form's Terms checkbox). */
.auth-social-consent {
  margin: var(--space-3) 0 0;
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--color-brown-light);
  text-align: center;
}

.auth-social-consent a {
  color: var(--color-primary-dark);
  font-weight: var(--fw-medium);
  text-decoration: underline;
}


/* ------------------------------------------------------------
   8. DIVIDER
   ------------------------------------------------------------ */
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--border-light);
}

.auth-divider span {
  font-size: var(--fs-xs);
  color: var(--color-brown-light);
  white-space: nowrap;
  letter-spacing: 0.04em;
}


/* ------------------------------------------------------------
   9. FORM FIELDS
   ------------------------------------------------------------ */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.auth-field-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.auth-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-brown-dark);
}

.auth-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-forgot-link {
  font-size: var(--fs-xs);
  color: var(--color-primary-dark);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-body);
  font-weight: var(--fw-medium);
  transition: color var(--transition-base);
  letter-spacing: 0.02em;
}

.auth-forgot-link:hover {
  color: var(--color-charcoal);
  text-decoration: underline;
}

/* Input wrapper */
.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 14px;
  color: var(--color-brown-light);
  font-size: 0.9rem;
  pointer-events: none;
  transition: color var(--transition-base);
  z-index: 1;
}

.auth-input {
  width: 100%;
  padding: 0.65rem 2.8rem 0.65rem 2.6rem;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  color: var(--color-charcoal);
  background-color: var(--bg-page);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  outline: none;
}

.auth-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(200, 168, 130, 0.18);
  background-color: var(--bg-card);
}

.auth-input:focus + .auth-input-icon,
.auth-input-wrap:focus-within .auth-input-icon {
  color: var(--color-primary-dark);
}

/* Input error state */
.auth-input.is-error {
  border-color: var(--color-danger);
}
.auth-input.is-error:focus {
  box-shadow: 0 0 0 3px rgba(184, 92, 74, 0.15);
}

/* Input success state */
.auth-input.is-valid {
  border-color: var(--color-success);
}

/* Password toggle */
.auth-password-toggle {
  position: absolute;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--color-brown-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: color var(--transition-fast);
  z-index: 2;
}

.auth-password-toggle:hover {
  color: var(--color-charcoal);
}

/* Error message */
.auth-error {
  font-size: var(--fs-xs);
  color: var(--color-danger);
  font-weight: var(--fw-medium);
  min-height: 16px;
  display: block;
  padding-left: 2px;
}


/* ------------------------------------------------------------
   10. PASSWORD STRENGTH BAR
   ------------------------------------------------------------ */
.auth-password-strength {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-1);
}

.strength-track {
  flex: 1;
  height: 3px;
  background-color: var(--border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.strength-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-full);
  transition: width 0.4s ease, background-color 0.4s ease;
}

.strength-fill.weak   { width: 25%; background-color: var(--color-danger); }
.strength-fill.fair   { width: 50%; background-color: var(--color-warning); }
.strength-fill.good   { width: 75%; background-color: var(--color-primary-dark); }
.strength-fill.strong { width: 100%; background-color: var(--color-success); }

.strength-label {
  font-size: 0.65rem;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  min-width: 44px;
  color: var(--color-brown-light);
}

.pw-hints {
  list-style: none;
  margin: var(--space-2) 0 0;
  padding: 0;
  font-size: 0.76rem;
  line-height: 1.75;
  color: var(--color-brown-light);
}

.pw-hints li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.pw-hints li i {
  font-size: 0.8rem;
}

.pw-hints li.met {
  color: var(--color-success);
}


/* ------------------------------------------------------------
   11. PRIVACY CONSENT
   ------------------------------------------------------------ */
.auth-consent-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.auth-consent-label {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
}

.auth-consent-check {
  display: none;
}

.auth-consent-box {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  margin-top: 1px;
  background-color: var(--bg-page);
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.auth-consent-box::after {
  content: '';
  width: 5px;
  height: 9px;
  border: 2px solid transparent;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) scale(0);
  transition: transform var(--transition-base);
  position: absolute;
  top: 1px;
}

.auth-consent-check:checked + .auth-consent-box {
  background-color: var(--color-charcoal);
  border-color: var(--color-charcoal);
}

.auth-consent-check:checked + .auth-consent-box::after {
  border-color: var(--color-cream);
  transform: rotate(45deg) scale(1);
}

.auth-consent-text {
  font-size: var(--fs-xs);
  color: var(--color-brown-mid);
  line-height: 1.5;
}

.auth-consent-link {
  color: var(--color-primary-dark);
  text-decoration: none;
  font-weight: var(--fw-medium);
}
.auth-consent-link:hover {
  text-decoration: underline;
}
/* "(optional — you can unsubscribe at any time)" after the offer-emails box label (Session 08B) */
.auth-consent-optional {
  color: var(--color-brown-light);
}


/* ------------------------------------------------------------
   12. ALERT MESSAGES
   ------------------------------------------------------------ */
.auth-alert {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
}

.auth-alert--error {
  background-color: rgba(184, 92, 74, 0.08);
  border: 1px solid rgba(184, 92, 74, 0.20);
  color: var(--color-danger);
}

.auth-alert--success {
  background-color: rgba(107, 143, 94, 0.08);
  border: 1px solid rgba(107, 143, 94, 0.20);
  color: var(--color-success);
}

.auth-alert i {
  font-size: 1rem;
  flex-shrink: 0;
}


/* ------------------------------------------------------------
   13. SUBMIT BUTTON
   ------------------------------------------------------------ */
.btn-auth-submit {
  width: 100%;
  padding: 0.78rem 1.5rem;
  background-color: var(--color-charcoal);
  color: var(--color-cream);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.05em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: all var(--transition-base);
  margin-top: var(--space-2);
  position: relative;
}

.btn-auth-submit:hover {
  background-color: var(--color-brown-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

/* Loading spinner */
.auth-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--color-cream);
  border-radius: 50%;
  animation: authSpin 0.7s linear infinite;
}

@keyframes authSpin {
  to { transform: rotate(360deg); }
}


/* ------------------------------------------------------------
   14. SWITCH TEXT
   ------------------------------------------------------------ */
.auth-switch-text {
  font-size: var(--fs-xs);
  color: var(--color-brown-light);
  text-align: center;
  margin-top: var(--space-4);
  margin-bottom: 0;
}

.auth-switch-link {
  background: none;
  border: none;
  color: var(--color-primary-dark);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  font-family: var(--font-body);
  padding: 0;
  transition: color var(--transition-base);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-switch-link:hover {
  color: var(--color-charcoal);
}


/* ------------------------------------------------------------
   15. RESPONSIVE — Mobile
   ------------------------------------------------------------ */
@media (max-width: 640px) {
  /* FIX (mobile UI bug report: guest-block sign-in modal "not centered" /
     "different from the sign in button") — this used to pin the modal to
     `bottom: 0` as a bottom sheet with only its top corners rounded, which
     is a different (and, combined with the transform bug fixed above,
     visibly off-center) look from both the desktop modal and the
     dedicated /login page's centered card. Now it stays centered like
     the base rule (just narrower, single-column, deco panel hidden), so
     mobile and desktop share the same look. */
  .auth-modal {
    grid-template-columns: 1fr;
    width: calc(100vw - 1.5rem);
    max-height: calc(100dvh - 2rem);
  }

  .auth-modal-deco {
    display: none;
  }

  .auth-modal-form-panel {
    padding: var(--space-6) var(--space-5);
    max-height: calc(100dvh - 2rem);
  }

}

@media (max-width: 480px) {
  .auth-modal-form-panel {
    padding: var(--space-5) var(--space-4);
  }
}