/* ==========================================================================
   auth-mobile.css — Conexão RH 2.0
   Visual de aplicativo para as telas públicas (login, cadastro, recuperação
   de senha) em celulares. Carregar DEPOIS do CSS específico da página.
   ========================================================================== */

:root { --auth-safe-bottom: env(safe-area-inset-bottom, 0px); }

html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; }

/* Microinterações disponíveis em qualquer tamanho */
.submit-btn, .navigation-buttons button, .auth-card button[type="submit"] {
    transition: transform .15s ease, background-color .2s ease, box-shadow .2s ease;
}
.submit-btn:active, .navigation-buttons button:active, .auth-card button[type="submit"]:active { transform: scale(.97); }

@keyframes authRise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

@media (max-width: 768px) {

    /* ---------- Login + recuperação: card vira bottom sheet ---------- */
    body:has(.login-card),
    body:has(.auth-card) {
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        align-items: stretch;
        min-height: 100vh;
        min-height: 100dvh;
        padding: 0;
        position: relative;
        overflow-x: hidden;
        background: linear-gradient(160deg, #00a6ed 0%, #0b6aa5 45%, #022b44 100%);
    }

    /* Brilhos decorativos no topo */
    body:has(.login-card)::before,
    body:has(.auth-card)::before {
        content: "";
        position: absolute;
        top: -90px; right: -70px;
        width: 260px; height: 260px;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(255, 255, 255, .28), transparent 70%);
        pointer-events: none;
    }
    body:has(.login-card)::after,
    body:has(.auth-card)::after {
        content: "";
        position: absolute;
        top: 70px; left: -90px;
        width: 220px; height: 220px;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(255, 165, 0, .30), transparent 70%);
        pointer-events: none;
    }

    .login-container { display: flex; flex-direction: column; justify-content: flex-end; flex: 1; min-height: 100vh; min-height: 100dvh; position: relative; z-index: 1; }

    .login-card,
    .auth-card {
        position: relative;
        z-index: 1;
        width: 100%;
        max-width: none;
        margin: auto 0 0;
        min-height: 72vh;
        min-height: 72dvh;
        padding: 30px 22px calc(28px + var(--auth-safe-bottom));
        border: 0;
        border-radius: 30px 30px 0 0;
        background: #fff;
        box-shadow: 0 -14px 40px rgba(2, 20, 33, .28);
        backdrop-filter: none;
        animation: authRise .5s cubic-bezier(.22, .8, .3, 1) both;
    }
    .login-container .login-card { margin-top: auto; }

    .login-card::before,
    .auth-card::before {
        content: "";
        display: block;
        width: 42px; height: 5px;
        margin: -14px auto 20px;
        border-radius: 3px;
        background: #d9e1e8;
    }

    .logo-container { margin-bottom: 22px; }
    .logo-container img { width: 76px; height: 76px; margin-bottom: 10px; }
    .logo-container h1 { font-size: 1.55rem; letter-spacing: -.01em; }
    .logo-container p { font-size: .95rem; }

    .input-group input,
    .auth-card input:not([type="checkbox"]):not([type="radio"]) {
        height: 54px;
        font-size: 16px; /* evita zoom automático no iOS */
        border-radius: 14px;
        background: #f6f9fb;
    }
    .input-group input:focus { background: #fff; }

    .toggle-password { width: 44px; height: 44px; right: 6px; display: grid; place-items: center; }

    .submit-btn,
    .auth-card button[type="submit"] {
        min-height: 54px;
        border-radius: 14px;
        font-size: 1.05rem;
        box-shadow: 0 10px 22px rgba(255, 165, 0, .35);
    }

    .cadastro-link, .home-link, .forgot-password-link { font-size: .95rem; }
    .cadastro-link a, .home-link a, .forgot-password-link a { display: inline-block; padding: 8px 4px; }

    /* ---------- Cadastro ---------- */
    .main-container { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; background: #022b44; }

    .info-column {
        min-height: 0;
        padding: calc(36px + env(safe-area-inset-top, 0px)) 24px 64px;
        text-align: left;
        align-items: flex-start;
    }
    .info-column h1 { font-size: 1.6rem; line-height: 1.2; margin-bottom: 8px; }
    .info-column p { font-size: .98rem; }

    .form-column { flex: 1; padding: 0; align-items: stretch; justify-content: stretch; }

    #regForm {
        max-width: none;
        margin: -34px 0 0;
        padding: 26px 20px calc(28px + var(--auth-safe-bottom));
        border-radius: 30px 30px 0 0;
        box-shadow: 0 -14px 40px rgba(2, 20, 33, .25);
        flex: 1;
        animation: authRise .5s cubic-bezier(.22, .8, .3, 1) both;
    }

    .progress-indicator { margin-bottom: 28px; }
    .step-label { font-size: .72rem; }

    #regForm .input-group input,
    #regForm .input-group select {
        min-height: 52px;
        font-size: 16px;
        border-radius: 14px;
    }

    .navigation-buttons {
        position: sticky;
        bottom: 0;
        display: flex;
        gap: 10px;
        padding: 12px 0 4px;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 28%);
    }
    .navigation-buttons button { flex: 1; min-height: 52px; border-radius: 14px; font-size: 1rem; }
}

@media (max-height: 640px) and (max-width: 768px) {
    .logo-container img { width: 56px; height: 56px; }
    .login-card, .auth-card { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .login-card, .auth-card, #regForm { animation: none; }
}
