/**
 * Trava scroll/movimentação lateral em telas de auth (login, cadastro, etc.).
 */
html.auth-screen {
    height: 100%;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    overflow-x: hidden;
    overscroll-behavior: none;
}

/* Variáveis de layout herdadas de app-shell.css quando carregado */
html.auth-screen {
    --auth-spacing: var(--app-spacing, 16px);
    --auth-radius: var(--app-radius, 16px);
    --auth-edge-inset-x: clamp(10px, 2.5vw, 40px);
}

html.auth-screen body {
    height: 100%;
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
    width: 100%;
    max-width: 100vw;
    margin: 0;
    position: fixed;
    inset: 0;
    overflow: hidden;
    overflow-x: hidden;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
}

.auth-viewport {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100dvh;
    min-height: 100dvh;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    overflow-x: hidden;
    overscroll-behavior: none;
    touch-action: pan-y;
    z-index: 1;
    box-sizing: border-box;
}

/* Telas auth full-screen: viewport rola (mais confiável no iOS WebKit) */
.auth-viewport.auth-viewport--fill {
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    overscroll-behavior-x: none;
    touch-action: pan-y;
}

.auth-viewport.auth-viewport--fill .card {
    position: relative;
    inset: auto;
    width: 100%;
    min-height: 100%;
    min-height: calc(100dvh + 1px);
    height: auto;
    max-width: 100%;
    max-height: none;
    flex: none;
    margin: 0;
    border-radius: 0;
    display: block;
    overflow: visible;
    overflow-y: visible;
    touch-action: pan-y;
    box-sizing: border-box;
}

.auth-app-shell .auth-viewport--fill .card.main-content {
    flex: none;
    min-height: calc(100dvh + 1px);
    height: auto;
    max-height: none;
    overflow: visible;
    overflow-y: visible;
}

html.ios .auth-viewport.auth-viewport--fill,
html.capacitor-native .auth-viewport.auth-viewport--fill {
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
}

html.auth-screen.capacitor-native .auth-viewport {
    touch-action: none;
}

html.auth-screen.capacitor-native .auth-viewport--fill {
    touch-action: pan-y;
}

html.auth-screen.capacitor-native .auth-viewport--fill .card {
    touch-action: manipulation;
}

html.auth-screen.capacitor-native .auth-viewport input,
html.auth-screen.capacitor-native .auth-viewport select,
html.auth-screen.capacitor-native .auth-viewport button,
html.auth-screen.capacitor-native .auth-viewport a {
    touch-action: manipulation;
}

.auth-viewport .card {
    width: 100%;
    max-width: min(420px, calc(100vw - var(--app-edge-inset-x) * 2 - var(--app-safe-left) - var(--app-safe-right)));
    max-height: calc(100dvh - var(--app-edge-inset) * 2 - var(--app-safe-top) - var(--app-safe-bottom));
    overflow: hidden;
    flex-shrink: 0;
    margin: 0 auto;
    left: 0;
    right: 0;
    touch-action: manipulation;
}

.auth-viewport--scroll {
    align-items: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

.auth-viewport--scroll .card,
.auth-viewport--scroll .container {
    max-height: none;
    overflow: visible;
}

.remember-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 16px;
    font-size: 14px;
    color: rgba(226, 232, 240, 0.88);
    cursor: pointer;
    user-select: none;
}

.remember-row input {
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
    cursor: pointer;
}

.session-check-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    background: rgba(7, 11, 20, 0.92);
    color: #e2e8f0;
    backdrop-filter: blur(8px);
    padding: var(--app-safe-top) var(--app-safe-right) var(--app-safe-bottom) var(--app-safe-left);
    box-sizing: border-box;
}

.session-check-overlay.is-visible {
    display: flex;
}

.session-check-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #60a5fa;
    border-radius: 50%;
    animation: authSpin 0.8s linear infinite;
}

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