#login-modal .auth-dialog {
  max-height: min(90vh, 820px);
  overflow-y: auto;
}

#login-modal .auth-step {
  display: none;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 8px 8px 16px;
}

#login-modal .auth-step.is-active {
  display: block;
}

#login-modal .auth-nav {
  position: relative;
  min-height: 28px;
  margin-bottom: 8px;
}

#login-modal .auth-back {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #171719;
}

#login-modal .auth-title {
  margin: 8px 0 6px;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  color: #171719;
  line-height: 1.3;
}

#login-modal .auth-subtitle {
  margin: 0 0 20px;
  text-align: center;
  font-size: 0.9rem;
  color: #2f2e33;
}

#login-modal .auth-subtitle a,
#login-modal .auth-link {
  color: #185d48;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

#login-modal .auth-link.underline {
  text-decoration: underline;
  color: #171719;
  font-weight: 500;
}

#login-modal .auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

#login-modal .auth-field label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #171719;
}

#login-modal .auth-input,
#login-modal .auth-phone-input input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #cfcfd4;
  border-radius: 8px;
  font-size: 0.95rem;
  color: #171719;
  background: #fff;
  outline: none;
  box-sizing: border-box;
}

#login-modal .auth-input:focus,
#login-modal .auth-phone-input input:focus {
  border-color: #185d48;
}

#login-modal .auth-input-wrap {
  position: relative;
}

#login-modal .auth-input-wrap .auth-input {
  padding-right: 44px;
}

#login-modal .auth-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #5c5b63;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#login-modal .auth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

#login-modal .auth-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 14px;
  font-size: 0.9rem;
  color: #171719;
}

#login-modal .auth-phone-input {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 10px;
  border: 1px solid #cfcfd4;
  border-radius: 8px;
}

#login-modal .auth-phone-input .auth-ddi {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 0.9rem;
  color: #171719;
}

#login-modal .auth-phone-input img {
  width: 18px;
  height: 18px;
  object-fit: cover;
  border-radius: 2px;
}

#login-modal .auth-phone-input input {
  border: 0;
  height: 100%;
  padding: 0;
  flex: 1;
  min-width: 0;
}

#login-modal .auth-captcha {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 16px;
  padding: 10px 12px;
  border: 1px solid #d3d3d3;
  border-radius: 4px;
  background: #f9f9f9;
  max-width: 304px;
}

#login-modal .auth-captcha label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: #171719;
  cursor: pointer;
}

#login-modal .auth-captcha-badge {
  font-size: 0.65rem;
  color: #555;
  text-align: right;
  line-height: 1.2;
}

#login-modal .auth-submit {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 10px;
  background: #185d48;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

#login-modal .auth-submit:hover {
  background: #134937;
}

#login-modal .auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#login-modal .auth-footer-links {
  margin-top: 16px;
  text-align: center;
}

#login-modal .auth-legal {
  display: block;
  margin-top: 14px;
  text-align: center;
  font-size: 0.72rem;
  color: #5c5b63;
  line-height: 1.4;
}

#login-modal .auth-legal a {
  color: inherit;
  text-decoration: underline;
}

#login-modal .auth-error {
  display: none;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fdecee;
  color: #9b1c1c;
  font-size: 0.85rem;
}

#login-modal .auth-error.is-visible {
  display: block;
}

#login-modal .auth-success {
  display: none;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #e8f6ef;
  color: #134937;
  font-size: 0.85rem;
}

#login-modal .auth-success.is-visible {
  display: block;
}

@media (max-width: 640px) {
  #login-modal .auth-row {
    grid-template-columns: 1fr;
  }
}

/* Mobile layout fixes */
@media (max-width: 1023px) {
  #ticket-selection {
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
    top: auto !important;
  }

  aside.flex.flex-1.relative.h-fit {
    width: 100%;
    max-width: 100%;
  }

  #login-modal .auth-dialog {
    width: calc(100vw - 24px) !important;
    max-width: 420px;
    max-height: min(92vh, 820px);
    padding: 12px !important;
  }

  #login-modal .auth-step {
    max-width: 100%;
    padding: 4px 2px 12px;
  }

  #login-modal .auth-title {
    font-size: 1.15rem;
    padding: 0 28px;
  }
}

@media (max-width: 640px) {
  header nav img[alt="Virtual Ticket"] {
    margin-left: 0 !important;
    max-height: 28px !important;
  }

  #login-modal .auth-phone-input {
    flex-wrap: nowrap;
  }
}

/* Loading popup after login/register */
#auth-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(60, 60, 65, 0.72);
  padding: 20px;
}

#auth-loading-overlay.is-visible {
  display: flex;
}

#auth-loading-card {
  width: min(340px, calc(100vw - 48px));
  min-height: 280px;
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 48px 28px 36px;
  text-align: center;
}

#auth-loading-spinner {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  box-shadow: none;
  animation: none;
}

#auth-loading-spinner .auth-spinner-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid #e6e8ee;
  border-top-color: #26ad85;
  border-right-color: #26ad85;
  animation: auth-spin 0.85s linear infinite;
}

#auth-loading-card p {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  color: #2f2e33;
}

#auth-loading-card span {
  display: inline-block;
}

.auth-loading-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 12px;
}

.auth-loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #26ad85;
  opacity: 0.35;
  animation: auth-dot 1.2s ease-in-out infinite;
}

.auth-loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.auth-loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes auth-dot {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

@keyframes auth-pulse {
  0% {
    transform: scale(0.92);
    box-shadow: 0 0 0 0 rgba(38, 173, 133, 0.45);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 12px rgba(38, 173, 133, 0);
  }
  100% {
    transform: scale(0.92);
    box-shadow: 0 0 0 0 rgba(38, 173, 133, 0);
  }
}

@media (max-width: 640px) {
  #auth-loading-card {
    width: min(300px, calc(100vw - 40px));
    min-height: 250px;
    padding: 40px 22px 34px;
  }
}

/* Layout correto da sidebar:
   header fixo no card
   lista de setores com scroll
   cupom + total + botão sempre visíveis abaixo do scroll */
#ticket-selection {
  display: flex !important;
  flex-direction: column !important;
  max-height: min(700px, calc(100vh - 5.5rem)) !important;
  overflow: hidden !important;
}

#ticket-selection > .rounded-t-md {
  flex: 0 0 auto !important;
}

#ticket-selection > .flex-grow.overflow-y-auto,
#ticket-selection > #tickets-sectors-list {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

#ticket-selection > .flex-shrink-0.bg-white.rounded-b-md,
#ticket-selection > .vt-checkout-bar {
  position: relative !important;
  inset: auto !important;
  width: auto !important;
  flex: 0 0 auto !important;
  background: #fff !important;
  box-shadow: none !important;
  z-index: 2;
}

#ticket-selection > .flex-shrink-0.bg-white.rounded-b-md .p-4x {
  padding: 16px !important;
  padding-bottom: 18px !important;
}

#vt-checkout-bar-spacer,
#vt-mobile-tickets-header {
  display: none;
}

@media (max-width: 1023px) {
  /* esconde a sidebar no fluxo normal; ela vira sheet ao comprar */
  aside.flex.flex-1.relative.h-fit {
    display: none !important;
  }

  body.vt-mobile-tickets-open aside.flex.flex-1.relative.h-fit {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 70 !important;
    width: 100% !important;
    max-width: 100% !important;
    background: #fff;
    overflow: hidden;
  }

  body.vt-mobile-tickets-open #ticket-selection,
  #ticket-selection.vt-mobile-sheet {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    /* svh/dvh: altura real visível (100vh esconde o botão atrás do chrome) */
    max-height: 100vh !important;
    height: 100vh !important;
    max-height: 100dvh !important;
    height: 100dvh !important;
    max-height: 100svh !important;
    height: 100svh !important;
    border: 0 !important;
    border-radius: 0 !important;
    z-index: 71 !important;
    background: #fff !important;
  }

  body.vt-mobile-tickets-open #vt-mobile-tickets-header,
  #ticket-selection.vt-mobile-sheet #vt-mobile-tickets-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 0 0 auto;
    min-height: 56px;
    padding: 10px 14px;
    border-bottom: 1px solid #e6e8ee;
    background: #fff;
  }

  #vt-mobile-tickets-header strong {
    flex: 1;
    text-align: center;
    font-size: 0.92rem;
    line-height: 1.25;
    color: #171719;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #vt-mobile-tickets-back {
    border: 0;
    background: transparent;
    padding: 4px;
    cursor: pointer;
    color: #171719;
  }

  body.vt-mobile-tickets-open #ticket-selection > .rounded-t-md {
    display: none !important;
  }

  body.vt-mobile-tickets-open #ticket-selection > .flex-grow.overflow-y-auto,
  body.vt-mobile-tickets-open #ticket-selection > #tickets-sectors-list {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
  }

  body.vt-mobile-tickets-open #ticket-selection > .flex-shrink-0.bg-white.rounded-b-md,
  body.vt-mobile-tickets-open #ticket-selection > .vt-checkout-bar {
    flex: 0 0 auto !important;
    border-top: 1px solid #e6e8ee;
    position: relative !important;
    z-index: 5;
    /* safe-area + chrome dinâmico (--vt-browser-chrome via visualViewport) */
    padding-bottom: calc(
      12px + env(safe-area-inset-bottom, 0px) + var(--vt-browser-chrome, 56px)
    ) !important;
  }

  body.vt-mobile-tickets-open #ticket-selection > .flex-shrink-0.bg-white.rounded-b-md .p-4x,
  body.vt-mobile-tickets-open #ticket-selection > .vt-checkout-bar .p-4x {
    padding-bottom: 8px !important;
  }

  body.vt-mobile-tickets-open #tickets-go-to-payment-btn {
    position: relative;
    z-index: 6;
    min-height: 48px;
    pointer-events: auto !important;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  body.vt-mobile-tickets-open .fixed.left-0.bottom-0.lg\:hidden {
    display: none !important;
  }
}

/* Login acima do sheet mobile (z-index 71) */
#login-modal {
  position: relative;
  z-index: 120;
}

#login-modal #login-modal-overlay {
  z-index: 120 !important;
}

#login-modal .auth-dialog {
  z-index: 121 !important;
}

#auth-loading-overlay {
  z-index: 130 !important;
}

:root {
  --vt-browser-chrome: 56px;
}
