/* ==========================================================================
   BioMedDNA — telas de autenticação (login, cadastro, recuperação de senha)
   Usado por Views/kit/templates/auth_template.php.
   Layout split: painel de marca à esquerda, formulário à direita.
   ========================================================================== */

/* Tokens de cor/forma/tipografia: assets/css/tokens.css (carregado antes). */

* { box-sizing: border-box; }

body.auth-body {
    margin: 0;
    font-family: var(--bio-font);
    color: var(--bio-ink);
    background: var(--bio-surface);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   Estrutura
   -------------------------------------------------------------------------- */

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
}

/* --------------------------------------------------------------------------
   Painel de marca (esquerda)
   -------------------------------------------------------------------------- */

.auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    padding: clamp(40px, 5vw, 64px);
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(120% 90% at 12% 8%, rgba(255, 255, 255, .20) 0%, rgba(255, 255, 255, 0) 55%),
        radial-gradient(90% 70% at 92% 96%, rgba(11, 63, 102, .40) 0%, rgba(11, 63, 102, 0) 60%),
        linear-gradient(150deg, var(--bio-teal) 0%, #2a9bc4 48%, var(--bio-blue) 100%);
}

/* Hélice de DNA decorativa, bem discreta, ancorada à direita do painel. */
.auth-brand__helix {
    position: absolute;
    top: 50%;
    right: -104px;
    width: 340px;
    height: 720px;
    transform: translateY(-50%);
    opacity: .12;
    pointer-events: none;
}

/* Empilha o conteúdo acima da hélice — sem tocar nela, que é absoluta.
   (`.auth-brand > *` sozinho tem a mesma especificidade e sobrescreveria o
   position:absolute do SVG, jogando-o para dentro do fluxo.) */
.auth-brand > *:not(.auth-brand__helix) { position: relative; z-index: 1; }

.auth-brand__logo {
    display: inline-flex;
    align-self: flex-start;
    padding: 14px 22px;
    background: #fff;
    border-radius: var(--bio-radius);
    box-shadow: 0 10px 30px -14px rgba(6, 40, 66, .55);
}

.auth-brand__logo img {
    display: block;
    width: 190px;
    height: auto;
}

.auth-brand__pitch {
    max-width: 27ch;
    margin: 0;
    font-size: clamp(1.6rem, 2.4vw, 2.15rem);
    font-weight: 700;
    line-height: 1.24;
    letter-spacing: -.015em;
}

.auth-brand__sub {
    max-width: 42ch;
    margin: 14px 0 0;
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, .84);
}

/* Lista de sinais de confiança */
.auth-trust {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 32px 0 0;
    padding: 0;
    list-style: none;
}

.auth-trust li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    font-size: .945rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, .93);
}

.auth-trust__icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-top: -2px;
    font-size: .85rem;
    color: #fff;
    background: rgba(255, 255, 255, .17);
    border: 1px solid rgba(255, 255, 255, .26);
    border-radius: 10px;
}

.auth-trust strong {
    display: block;
    font-weight: 600;
}

.auth-trust span {
    color: rgba(255, 255, 255, .72);
    font-size: .875rem;
}

/* Selo de acreditação */
.auth-seal {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, .96);
    border-radius: var(--bio-radius);
    box-shadow: 0 10px 30px -18px rgba(6, 40, 66, .6);
}

.auth-seal img {
    flex: 0 0 auto;
    width: 104px;
    height: auto;
}

.auth-seal__text {
    font-size: .8rem;
    line-height: 1.45;
    color: var(--bio-muted);
}

.auth-seal__text strong {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: var(--bio-navy);
}

/* --------------------------------------------------------------------------
   Painel do formulário (direita)
   -------------------------------------------------------------------------- */

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(32px, 4vw, 56px) clamp(20px, 4vw, 48px);
    background: var(--bio-surface);
}

.auth-form {
    width: 100%;
    max-width: 424px;
}

/* Cabeçalho compacto — só aparece quando o painel de marca colapsa (mobile). */
.auth-form__brand {
    display: none;
    margin-bottom: 28px;
}

.auth-form__brand img {
    width: 168px;
    height: auto;
}

.auth-form__heading {
    margin: 0;
    font-size: clamp(1.45rem, 3vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -.015em;
    color: var(--bio-ink);
}

.auth-form__desc {
    margin: 10px 0 30px;
    font-size: .95rem;
    line-height: 1.6;
    color: var(--bio-muted);
}

/* --------------------------------------------------------------------------
   Campos
   -------------------------------------------------------------------------- */

.auth-form .form-floating { margin-bottom: 16px; }

.auth-form .form-floating > .form-control {
    height: 62px;
    padding: 1.65rem .95rem .5rem;
    font-size: 1rem;
    color: var(--bio-ink);
    background-color: #fbfdfe;
    border: 1.5px solid var(--bio-line);
    border-radius: var(--bio-radius-sm);
    box-shadow: none;
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.auth-form .form-floating > .form-control:hover {
    border-color: var(--bio-line-strong);
}

.auth-form .form-floating > .form-control:focus {
    background-color: #fff;
    border-color: var(--bio-teal);
    box-shadow: 0 0 0 4px rgba(72, 194, 200, .18);
}

.auth-form .form-floating > label {
    padding: 1.05rem .95rem;
    font-size: .95rem;
    color: var(--bio-muted);
    border: 0;
    transition: opacity .18s ease, transform .18s ease, color .18s ease;
}

.auth-form .form-floating > .form-control:focus ~ label,
.auth-form .form-floating > .form-control:not(:placeholder-shown) ~ label {
    transform: scale(.82) translateY(-.62rem) translateX(.1rem);
    opacity: 1;
    color: var(--bio-muted);
}

.auth-form .form-floating > .form-control:focus ~ label {
    color: var(--bio-teal-dark);
}

/* Autofill do Chrome não pode voltar ao azul padrão do navegador. */
.auth-form .form-control:-webkit-autofill,
.auth-form .form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--bio-ink);
    -webkit-box-shadow: 0 0 0 60px #fbfdfe inset;
}

/* Botão de revelar senha */
.auth-form .form-floating .btn-link {
    z-index: 3;
    padding: 0 1rem;
    color: var(--bio-muted);
    text-decoration: none;
    transition: color .18s ease;
}

.auth-form .form-floating .btn-link:hover,
.auth-form .form-floating .btn-link:focus-visible {
    color: var(--bio-teal-dark);
}

.auth-form .form-text {
    margin-top: -6px;
    margin-bottom: 18px;
    font-size: .82rem;
    line-height: 1.55;
    color: var(--bio-muted);
}

/* --------------------------------------------------------------------------
   Ações
   -------------------------------------------------------------------------- */

.auth-form__aux {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 22px;
}

.auth-link {
    font-size: .9rem;
    font-weight: 500;
    color: var(--bio-blue);
    text-decoration: none;
    border-radius: 4px;
    transition: color .18s ease;
}

.auth-link:hover { color: var(--bio-blue-dark); text-decoration: underline; }

.auth-form .btn-primary {
    width: 100%;
    height: 54px;
    margin: 0;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: #fff;
    background: linear-gradient(135deg, var(--bio-teal) 0%, var(--bio-blue) 100%);
    border: 0;
    border-radius: var(--bio-radius-sm);
    box-shadow: 0 12px 26px -14px rgba(14, 118, 188, .75);
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.auth-form .btn-primary:hover {
    filter: saturate(1.08);
    transform: translateY(-1px);
    box-shadow: 0 16px 30px -14px rgba(14, 118, 188, .8);
}

.auth-form .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 8px 18px -12px rgba(14, 118, 188, .8);
}

.auth-form .btn-primary:focus-visible {
    outline: 3px solid rgba(72, 194, 200, .5);
    outline-offset: 2px;
}

/* Rodapé do formulário */
.auth-form__footer {
    margin-top: 26px;
    padding-top: 22px;
    font-size: .9rem;
    color: var(--bio-muted);
    text-align: center;
    border-top: 1px solid var(--bio-line);
}

.auth-form__footer .auth-link { margin-left: 6px; font-weight: 600; }

/* Faixa de confiança do rodapé (visível no mobile, onde o painel de marca some).
   `display:block` + texto centralizado para a quebra em duas linhas ficar natural. */
.auth-form__assurance {
    display: none;
    margin-top: 22px;
    font-size: .8rem;
    line-height: 1.5;
    color: var(--bio-muted);
    text-align: center;
}

.auth-form__assurance i { margin-right: 6px; }

/* Selo de acreditação compacto — o painel de marca não existe no mobile e este
   é o sinal de credibilidade mais forte que temos. */
.auth-form__seal {
    display: none;
    align-items: center;
    gap: 14px;
    margin-top: 18px;
    padding: 12px 14px;
    background: var(--bio-bg);
    border: 1px solid var(--bio-line);
    border-radius: var(--bio-radius-sm);
}

.auth-form__seal img {
    flex: 0 0 auto;
    width: 84px;
    height: auto;
}

.auth-form__seal span {
    font-size: .78rem;
    line-height: 1.45;
    color: var(--bio-muted);
}

/* --------------------------------------------------------------------------
   Alertas
   -------------------------------------------------------------------------- */

.auth-form .alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
    padding: 14px 16px;
    font-size: .89rem;
    line-height: 1.5;
    border: 0;
    border-left: 3px solid transparent;
    border-radius: var(--bio-radius-sm);
}

.auth-form .alert .btn-close {
    margin-left: auto;
    padding: .35rem;
    font-size: .6rem;
    opacity: .45;
}

.auth-form .alert-danger {
    color: var(--bio-danger);
    background: var(--bio-danger-bg);
    border-left-color: var(--bio-danger);
}

.auth-form .alert-success {
    color: var(--bio-success);
    background: var(--bio-success-bg);
    border-left-color: var(--bio-success);
}

/* --------------------------------------------------------------------------
   Responsivo
   -------------------------------------------------------------------------- */

@media (max-width: 991.98px) {
    .auth-shell { grid-template-columns: 1fr; }

    /* No mobile o painel de marca sai; o logo e a garantia vão para o formulário. */
    .auth-brand { display: none; }
    .auth-form__brand { display: block; }
    .auth-form__assurance { display: block; }
    .auth-form__seal { display: flex; }

    .auth-panel {
        align-items: flex-start;
        padding: clamp(28px, 7vw, 48px) 22px 40px;
        background:
            linear-gradient(180deg, rgba(72, 194, 200, .09) 0%, rgba(72, 194, 200, 0) 260px),
            var(--bio-surface);
    }
}

@media (max-width: 420px) {
    .auth-form .form-floating > .form-control { height: 58px; }
    .auth-form .btn-primary { height: 52px; }
}

/* Telas largas: o formulário não deve ficar perdido no meio do branco. */
@media (min-width: 1600px) {
    .auth-shell { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .auth-form { max-width: 448px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
    }
    .auth-form .btn-primary:hover { transform: none; }
}

/* --------------------------------------------------------------------------
   Aviso informativo (telas sem campos: e-mail enviado, senha alterada)
   -------------------------------------------------------------------------- */

.auth-notice {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    background: var(--bio-bg);
    border: 1px solid var(--bio-line);
    border-radius: var(--bio-radius-sm);
}

.auth-notice__icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    font-size: 1rem;
    color: #fff;
    background: linear-gradient(135deg, var(--bio-teal) 0%, var(--bio-blue) 100%);
    border-radius: 10px;
}

.auth-notice p {
    margin: 0;
    font-size: .88rem;
    line-height: 1.55;
    color: var(--bio-muted);
}
