/* SpisaSmart — pagina Login / Registrazione */

.auth-page {
  overflow-x: clip;
}

/* Adatta tutta la pagina al viewport (niente scroll della pagina) */
.auth-page--fit {
  display: flex;
  min-height: 100dvh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.auth-page--fit .auth-page__right {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.75rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
}

.auth-page--fit .auth-mobile-header {
  flex-shrink: 0;
  margin-bottom: 0.25rem;
}

.auth-page--fit .auth-skip-link--desktop {
  display: none;
}

.auth-page--fit .auth-card {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 28rem;
  margin-top: 0;
  padding: 0.85rem 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.auth-page--fit .auth-tab-track {
  flex-shrink: 0;
  margin-bottom: 0.5rem;
}

.auth-page--fit .auth-alert {
  flex-shrink: 0;
  margin-bottom: 0.35rem !important;
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem;
}

.auth-page--fit .auth-forms-viewport {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.auth-page--fit .auth-page__form-shell {
  min-height: 0;
  height: 100%;
}

.auth-page--fit .auth-form-panel.is-active {
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

.auth-page--fit .auth-form-panel .auth-field {
  margin-bottom: 0;
}

.auth-page--fit #form-register.auth-form-panel.is-active {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.auth-page--fit #form-register .text-center.mb-6 {
  margin-bottom: 0.35rem !important;
}

.auth-page--fit #form-register h2 {
  font-size: 1.15rem;
  line-height: 1.25;
}

.auth-page--fit #form-register .text-sm {
  font-size: 0.72rem;
}

.auth-page--fit #form-register input {
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.auth-page--fit #form-register label {
  margin-bottom: 0.25rem;
  font-size: 0.78rem;
}

.auth-page--fit .auth-google-block {
  flex-shrink: 0;
}

.auth-page--register-active .auth-mobile-benefits,
.auth-page--register-active .auth-google-block {
  display: none !important;
}

.auth-page.auth-page--register-active .auth-card {
  padding-bottom: 0.5rem;
}

.auth-page--fit #form-login.auth-form-panel.is-active {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-page--fit #form-login .text-center.mb-6 {
  margin-bottom: 0.5rem !important;
}

.auth-page--fit #form-login h2 {
  font-size: 1.2rem;
}

@media (min-width: 1024px) {
  .auth-page--fit .auth-page__right {
    padding: 1rem 1.5rem;
    justify-content: center;
  }

  .auth-page--fit .auth-card {
    padding: 1.25rem 1.5rem;
    max-height: min(92dvh, 920px);
  }

  .auth-page--register-active .auth-google-block {
    display: block !important;
  }
}

.auth-page__left {
  background-color: #0b1120;
}

.auth-page__left-img {
  mix-blend-mode: overlay;
}

.auth-page__form-shell {
  position: relative;
  min-height: 22rem;
}

.auth-forms-viewport {
  position: relative;
  overflow: hidden;
}

.auth-form-panel {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateX(1.25rem) scale(0.985);
  pointer-events: none;
  transition:
    opacity 0.42s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.42s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.42s;
}

.auth-form-panel.is-active {
  position: relative;
  opacity: 1;
  visibility: visible;
  transform: translateX(0) scale(1);
  pointer-events: auto;
  overflow: visible;
}

.auth-form-panel.is-leaving {
  position: absolute;
  opacity: 0;
  transform: translateX(-1.25rem) scale(0.985);
}

.auth-form-panel.is-entering {
  animation: auth-form-enter 0.48s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes auth-form-enter {
  from {
    opacity: 0;
    transform: translateX(1.5rem) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.auth-form-panel.is-active .auth-field {
  animation: auth-field-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-form-panel.is-active .auth-field:nth-child(1) { animation-delay: 0.04s; }
.auth-form-panel.is-active .auth-field:nth-child(2) { animation-delay: 0.08s; }
.auth-form-panel.is-active .auth-field:nth-child(3) { animation-delay: 0.12s; }
.auth-form-panel.is-active .auth-field:nth-child(4) { animation-delay: 0.16s; }
.auth-form-panel.is-active .auth-field:nth-child(5) { animation-delay: 0.2s; }
.auth-form-panel.is-active .auth-field:nth-child(6) { animation-delay: 0.24s; }

@keyframes auth-field-rise {
  from {
    opacity: 0;
    transform: translateY(0.65rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-tab-track {
  position: relative;
}

.auth-tab-indicator {
  position: absolute;
  top: 0.25rem;
  bottom: 0.25rem;
  left: 0.25rem;
  width: calc(50% - 0.25rem);
  border-radius: 0.625rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
  transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  z-index: 0;
}

html.dark .auth-tab-indicator {
  background: #111827;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

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

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

.auth-submit-btn {
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}

.auth-submit-btn:not(:disabled):hover {
  transform: translateY(-2px);
}

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

.auth-alert {
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.4;
  animation: auth-alert-in 0.35s ease both;
}

.auth-alert--error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

html.light .auth-alert--error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.auth-alert--success {
  background: rgba(0, 210, 255, 0.12);
  border: 1px solid rgba(0, 210, 255, 0.35);
  color: #a5f3fc;
}

html.light .auth-alert--success {
  background: #ecfeff;
  border-color: #a5f3fc;
  color: #0e7490;
}

@keyframes auth-alert-in {
  from {
    opacity: 0;
    transform: translateY(-0.35rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Google Sign-In: iframe ufficiale sopra il design (cliccabile); cursore custom resta visibile sopra */
.auth-native-hint {
  display: none;
}

.auth-google-wrap {
  position: relative;
  width: 100%;
  min-height: 3.25rem;
}

.auth-google-btn {
  position: relative;
  z-index: 1;
  pointer-events: none;
  user-select: none;
  cursor: none !important;
}

.auth-google-mount {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 0.011;
  cursor: none !important;
}

.auth-google-mount iframe {
  margin: 0 auto !important;
  min-height: 44px !important;
}

.auth-page--register-active .auth-google-wrap {
  display: block;
}

.auth-google-btn:hover svg {
  transform: scale(1.08);
}

.auth-google-btn svg {
  transition: transform 0.2s ease;
}

.auth-benefit-icon {
  backdrop-filter: blur(4px);
}

.auth-card {
  animation: auth-card-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes auth-card-in {
  from {
    opacity: 0;
    transform: translateY(1rem) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-theme-btn {
  transition: transform 0.2s ease;
}

.auth-theme-btn:hover {
  transform: scale(1.08);
}

.auth-skip-link {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
  transition: color 0.2s ease;
}

html.dark .auth-skip-link {
  color: #94a3b8;
}

.auth-skip-link:hover {
  color: #00d2ff;
}

html.light .auth-skip-link:hover {
  color: #0284c7;
}

.auth-skip-link__arrow {
  margin-left: 0.15em;
}

/* Header mobile: logo sopra, link skip sotto allineato a destra */
.auth-mobile-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  padding-top: 0.25rem;
  /* Spazio per il pulsante tema fisso in alto a destra */
  padding-right: 3.25rem;
  margin-bottom: 0.25rem;
}

.auth-mobile-header__brand {
  max-width: 100%;
}

.auth-mobile-header__skip {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.15rem;
  max-width: 100%;
  font-size: 0.8125rem;
  line-height: 1.35;
  text-align: right;
  padding: 0.35rem 0;
}

@media (max-width: 380px) {
  .auth-mobile-header__skip {
    font-size: 0.75rem;
  }

  .auth-mobile-header__brand span {
    font-size: 1.125rem;
  }
}

@media (max-width: 1023px) {
  .auth-page__right {
    min-height: 100vh;
    min-height: 100dvh;
    justify-content: flex-start;
    padding-top: max(1.25rem, env(safe-area-inset-top, 0px));
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px));
  }

  .auth-mobile-benefits {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .auth-skip-link--desktop {
    position: absolute;
    top: 2rem;
    right: 1.5rem;
    z-index: 10;
    align-items: center;
    gap: 0.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-form-panel,
  .auth-tab-indicator,
  .auth-form-panel.is-active .auth-field,
  .auth-card,
  .auth-alert {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

/* Bottom nav: spazio dentro il layout fit, non scroll pagina */
@media (max-width: 1023px) {
  body.spisa-has-mobile-bottom-nav.auth-page--fit {
    padding-bottom: 0;
  }

  body.spisa-has-mobile-bottom-nav.auth-page--fit .auth-page__right {
    padding-bottom: calc(3.75rem + env(safe-area-inset-bottom, 0px));
  }
}

/* Mappa indirizzo registrazione */
.auth-home-address {
  position: relative;
  z-index: 2;
}

.auth-home-map {
  margin-top: 0.35rem;
  height: clamp(110px, 18dvh, 160px);
  min-height: 110px;
  width: 100%;
  position: relative;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #e2e8f0;
  z-index: 1;
}

.auth-home-map .leaflet-container,
.auth-home-map .leaflet-pane,
.auth-home-map .leaflet-map-pane {
  height: 100% !important;
  width: 100% !important;
}

html.dark .auth-home-map,
.auth-page:not(.light) .auth-home-map {
  background: #1e293b;
}

.auth-address-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 40;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  max-height: 12rem;
  overflow-y: auto;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}

html.dark .auth-address-suggestions,
.auth-page:not(.light) .auth-address-suggestions {
  background: #111827;
  border-color: rgba(255, 255, 255, 0.12);
}

.auth-address-suggestion {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.85rem;
  font-size: 0.8rem;
  line-height: 1.35;
  color: inherit;
  background: transparent;
  border: none;
  cursor: pointer;
}

.auth-address-suggestion:hover,
.auth-address-suggestion:focus-visible {
  background: rgba(0, 210, 255, 0.12);
}

.auth-address-suggestion--loading,
.auth-address-suggestion--empty {
  padding: 0.55rem 0.85rem;
  font-size: 0.8rem;
  color: #64748b;
  cursor: default;
}

.auth-home-address .leaflet-container {
  font-family: inherit;
}
