/* Вход: overlay поверх текущей страницы — desktop modal, mobile bottom sheet */

.auth-sheet {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: block;
  pointer-events: none;
  /* Delay hide so close transform/opacity can finish */
  visibility: hidden;
  transition: visibility 0s linear 0.34s;
}

.auth-sheet.is-open {
  /* Above mini-cart so login stays on top when both exist */
  z-index: 1130;
  pointer-events: auto;
  visibility: visible;
  transition-delay: 0s;
}

/* Visible but still closed — one paint frame so open transition has a from-state */
.auth-sheet.is-ready:not(.is-open) {
  visibility: visible;
  transition-delay: 0s;
  pointer-events: none;
}

.auth-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.auth-sheet.is-open .auth-sheet-backdrop {
  opacity: 1;
}

.auth-sheet-panel {
  position: fixed;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  outline: none;
}

#authSheetMount {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.auth-sheet-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 1.25rem 1.25rem;
}

.auth-sheet-title {
  font-size: 1.35rem;
  font-weight: 600;
  text-align: center;
  margin: 0 0 0.5rem;
  color: #111;
}

.auth-sheet-subtitle {
  text-align: center;
  margin-bottom: 1.25rem;
}

.auth-sheet-close {
  position: absolute;
  top: 0.35rem;
  right: 0.65rem;
  z-index: 2;
  border: 0;
  background: transparent;
  font-size: 1.75rem;
  line-height: 1;
  color: #333;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}

.auth-sheet-close:hover {
  color: #000;
}

.auth-sheet-handle {
  flex-shrink: 0;
  padding-top: 0.65rem;
  padding-bottom: 0.15rem;
  touch-action: none;
  cursor: grab;
}

.auth-sheet-handle:active {
  cursor: grabbing;
}

.auth-sheet-handle .menu-drag-bar {
  width: 42px;
  height: 5px;
  background: #bbb;
  border-radius: 99px;
  opacity: 0.85;
}

.auth-notice {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-radius: 0.5rem;
  border: 1px solid #ececec;
  background: #fafafa;
  color: #444;
  font-size: 0.92rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.auth-notice-error {
  background: #fff5f5;
  border-color: #f1caca;
  color: #842029;
}

.auth-profile-hint {
  margin: 0;
  color: #666;
  font-size: 0.92rem;
  line-height: 1.45;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.auth-profile-hint-phone {
  color: #111;
  font-weight: 600;
  white-space: nowrap;
}

.auth-actions-footer {
  padding-top: 0.25rem;
}

.auth-consent .form-check-label {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.auth-sheet-scroll .alert {
  margin-bottom: 1rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.auth-sheet-scroll .auth-notice {
  margin-bottom: 0;
}

body.auth-sheet-open {
  overflow: hidden;
}

/* Политика ПД поверх формы входа (auth-sheet z-index: 1080) */
body.auth-sheet-open .modal {
  z-index: 1200;
}

body.auth-sheet-open .modal-backdrop {
  z-index: 1190;
}

body.auth-page .site-scroll-top {
  display: none !important;
}

.auth-page-shell {
  width: 100%;
  max-width: 480px;
}

.auth-page-card {
  padding: 1.35rem 1.25rem 1.5rem;
}

.auth-page-card .auth-sheet-title {
  margin-bottom: 0.75rem;
}

@media (min-width: 576px) {
  .auth-page-card {
    padding: 1.75rem 1.75rem 1.85rem;
  }
}

/* Desktop — модалка по центру */
@media (min-width: 992px) {
  .auth-sheet-panel {
    left: 50%;
    top: 50%;
    width: min(480px, calc(100vw - 2rem));
    max-height: min(90vh, 760px);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transform: translate(-50%, calc(-50% + 14px));
    transition: opacity 0.24s ease, transform 0.24s ease;
  }

  .auth-sheet.is-open .auth-sheet-panel {
    opacity: 1;
    transform: translate(-50%, -50%);
  }

  .auth-sheet-scroll {
    padding: 1.5rem 1.75rem 1.75rem;
  }

  .auth-sheet-handle {
    display: none !important;
  }

  .auth-sheet-close {
    top: 0.5rem;
    right: 0.75rem;
  }
}

/* Mobile — bottom sheet */
@media (max-width: 991.98px) {
  .auth-sheet-panel {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-height: min(92dvh, 760px);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .auth-sheet.is-open .auth-sheet-panel {
    transform: translateY(0);
  }

  .auth-sheet-scroll {
    padding-top: 0.25rem;
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  }

  .auth-sheet-title {
    padding-right: 2rem;
  }

  .auth-profile-hint-phone {
    white-space: normal;
  }
}
