/* ===== Rika — premium auth modal ===== */

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
}

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

.auth-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 35, 62, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-modal.is-open .auth-modal__backdrop {
  opacity: 1;
}

.auth-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 30rem);
  max-height: min(92dvh, 40rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 2rem;
  opacity: 0;
  transform: scale(0.94) translateY(12px);
  filter: blur(6px);
  transition:
    opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-modal.is-open .auth-modal__dialog {
  opacity: 1;
  transform: scale(1) translateY(0);
  filter: blur(0);
}

.auth-modal__panel {
  position: relative;
  padding: clamp(1.75rem, 4vw, 2.25rem);
  background: var(--card-solid);
  border: 1px solid var(--border);
  border-radius: 2rem;
  box-shadow: var(--shadow-lg);
}

.auth-modal__atmosphere {
  display: none;
}

.auth-modal__atmosphere::before,
.auth-modal__atmosphere::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.45;
}

.auth-modal__atmosphere::before {
  width: 12rem;
  height: 12rem;
  top: -4rem;
  right: -2rem;
  background: rgba(231, 139, 123, 0.35);
}

.auth-modal__atmosphere::after {
  width: 10rem;
  height: 10rem;
  bottom: -3rem;
  left: -2rem;
  background: rgba(16, 35, 62, 0.12);
}

.auth-modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
  color: var(--navy);
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.auth-modal__close:hover {
  background: #fff;
  box-shadow: 0 4px 16px rgba(16, 35, 62, 0.1);
  transform: scale(1.05);
}

.auth-modal__close svg {
  width: 1.125rem;
  height: 1.125rem;
}

.auth-modal__inner {
  position: relative;
  z-index: 1;
}

.auth-modal__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.08s,
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.08s;
}

.auth-modal.is-open .auth-modal__brand {
  opacity: 1;
  transform: translateY(0);
}

.auth-modal__brand img {
  height: 2rem;
  width: auto;
}

.auth-modal__eyebrow {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: 0.35rem;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.45s ease 0.1s,
    transform 0.45s ease 0.1s;
}

.auth-modal.is-open .auth-modal__eyebrow {
  opacity: 1;
  transform: translateY(0);
}

.auth-modal__title {
  font-family: var(--font-heading);
  font-size: clamp(1.375rem, 3vw, 1.625rem);
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
  margin: 0 0 0.5rem;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.45s ease 0.14s,
    transform 0.45s ease 0.14s;
}

.auth-modal.is-open .auth-modal__title {
  opacity: 1;
  transform: translateY(0);
}

.auth-modal__subtitle {
  font-size: 0.9375rem;
  color: var(--muted-foreground);
  line-height: 1.55;
  margin: 0 0 1.5rem;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.45s ease 0.18s,
    transform 0.45s ease 0.18s;
}

.auth-modal.is-open .auth-modal__subtitle {
  opacity: 1;
  transform: translateY(0);
}

.auth-modal__form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.45s ease 0.22s,
    transform 0.45s ease 0.22s;
}

.auth-modal.is-open .auth-modal__form {
  opacity: 1;
  transform: translateY(0);
}

.auth-modal__field label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--navy);
}

.auth-modal__input-wrap {
  position: relative;
}

.auth-modal__input {
  width: 100%;
  min-height: 3.5rem;
  padding: 0 1.125rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--foreground);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(16, 35, 62, 0.1);
  border-radius: 1rem;
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    background 0.25s ease;
}

.auth-modal__input-wrap--password .auth-modal__input {
  padding-right: 3rem;
}

.auth-modal__input::placeholder {
  color: #94a3b8;
}

.auth-modal__input:focus {
  outline: none;
  border-color: rgba(231, 139, 123, 0.45);
  box-shadow: 0 0 0 4px var(--glow);
  background: #fff;
}

.auth-modal__toggle-pw {
  position: absolute;
  top: 50%;
  right: 0.65rem;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.auth-modal__toggle-pw:hover {
  color: var(--navy);
  background: rgba(16, 35, 62, 0.05);
}

.auth-modal__toggle-pw svg {
  width: 1.125rem;
  height: 1.125rem;
}

.auth-modal__toggle-pw .icon-eye-off {
  display: none;
}

.auth-modal__toggle-pw.is-visible .icon-eye {
  display: none;
}

.auth-modal__toggle-pw.is-visible .icon-eye-off {
  display: block;
}

.auth-modal__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.auth-modal__remember {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  cursor: pointer;
  user-select: none;
}

.auth-modal__remember input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.auth-modal__link {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s ease;
}

.auth-modal__link:hover {
  color: var(--accent);
}

.auth-modal__views {
  position: relative;
  min-height: 18rem;
}

.auth-modal__view {
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.985);
  transition:
    opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.5s;
  pointer-events: none;
}

.auth-modal__view.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.auth-modal__view:not(.is-active) {
  position: absolute;
  inset: 0;
  width: 100%;
}

.auth-modal.is-switching .auth-modal__view.is-active {
  opacity: 0;
  transform: translateY(-6px) scale(0.99);
}

.auth-modal__back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1rem;
  padding: 0;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted-foreground);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.auth-modal__back:hover {
  color: var(--navy);
}

.auth-modal__back svg {
  width: 1rem;
  height: 1rem;
}

.auth-modal__subtitle--center {
  text-align: center;
  max-width: 20rem;
  margin-left: auto;
  margin-right: auto;
}

.auth-modal__success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(231, 139, 123, 0.22), rgba(255, 255, 255, 0.9));
  color: var(--accent);
  box-shadow: 0 8px 24px rgba(231, 139, 123, 0.2);
  transform: scale(0.85);
  opacity: 0;
  transition:
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.12s,
    opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.12s;
}

.auth-modal__view--success.is-active .auth-modal__success-icon {
  transform: scale(1);
  opacity: 1;
}

.auth-modal__success-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.auth-modal__success-email {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--navy);
  text-align: center;
  margin: -0.5rem 0 1.25rem;
}

.auth-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.auth-modal__submit--ghost {
  color: var(--navy);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(16, 35, 62, 0.1);
  box-shadow: none;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-modal__submit--ghost:hover {
  background: #fff;
  box-shadow: 0 4px 16px rgba(16, 35, 62, 0.08);
  transform: translateY(-1px);
}

.auth-modal__submit {
  width: 100%;
  min-height: 3.25rem;
  margin-top: 0.25rem;
  padding: 0 1.5rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  background: var(--navy);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(16, 35, 62, 0.22);
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    background 0.25s ease;
}

.auth-modal__submit:hover {
  transform: translateY(-1px);
  background: var(--navy-light);
  box-shadow:
    0 8px 28px rgba(16, 35, 62, 0.28),
    0 0 0 4px rgba(231, 139, 123, 0.12);
}

.auth-modal__submit:active {
  transform: translateY(0);
}

.auth-modal__error {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #c75a4a;
  text-align: center;
}

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

.auth-modal__footer {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(16, 35, 62, 0.06);
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  opacity: 0;
  transition: opacity 0.45s ease 0.36s;
}

.auth-modal.is-open .auth-modal__footer {
  opacity: 1;
}

.auth-modal__footer a {
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
  transition: color 0.2s ease;
}

.auth-modal__footer a:hover {
  color: var(--accent);
}

body.is-auth-open {
  overflow: hidden;
}

body.is-auth-open .mp-header.is-menu-open {
  position: static;
  inset: auto;
  overflow: visible;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.is-auth-open #mpMobileMenu {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .auth-modal__backdrop,
  .auth-modal__dialog,
  .auth-modal__brand,
  .auth-modal__eyebrow,
  .auth-modal__title,
  .auth-modal__subtitle,
  .auth-modal__form,
  .auth-modal__footer,
  .auth-modal__view,
  .auth-modal__success-icon {
    transition: none;
    opacity: 1;
    transform: none;
    filter: none;
  }

  .auth-modal__view:not(.is-active) {
    display: none;
  }
}

@media (max-width: 480px) {
  .auth-modal {
    align-items: flex-end;
    padding: 0;
  }

  .auth-modal__dialog {
    width: 100%;
    max-height: 94dvh;
    border-radius: 1.5rem 1.5rem 0 0;
  }

  .auth-modal__panel {
    border-radius: 1.5rem 1.5rem 0 0;
  }

}
