
/* =========================================================
   CONFIGURAÇÃO GERAL
   ========================================================= */

body.auth-page {
    margin: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #c7e7ff;
    font-family: "Inter", sans-serif;
    color: #23262b;
    overflow-x: hidden;
}

.auth-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px;
    width: 100%;
    box-sizing: border-box;
}

/* =========================================================
   CARTÃO PRINCIPAL
   ========================================================= */

.auth-card {
    --a-primary: #2585f8;
    --a-primary-dark: #1666d1;
    --a-cyan: #00bcdc;
    --a-muted: #9aa2b1;
    --a-input: #f1f3f7;
    --a-w: 900px;
    --a-h: 640px;

    position: relative;
    overflow: hidden;
    width: var(--a-w);
    height: var(--a-h);
    border-radius: 32px;
    background: #fff;
    box-shadow: 0 20px 80px rgba(22, 102, 209, 0.18);
    box-sizing: border-box;
}

.auth-card *,
.auth-card *::before,
.auth-card *::after {
    box-sizing: border-box;
}

.auth-toggle {
    display: none;
}

/* =========================================================
   FUNDO AZUL DIAGONAL
   ========================================================= */

.auth-bg {
    position: absolute;
    z-index: 2;
    top: 0;
    bottom: 0;
    left: 0;
    width: calc(var(--a-w) * 1.3);
    height: var(--a-h);
    rotate: -45deg;
    transform-origin: 0% 100%;
    background: linear-gradient(
        135deg,
        var(--a-primary-dark),
        var(--a-primary) 55%,
        var(--a-cyan)
    );
}

.auth-bg-2 {
    rotate: 0deg;
    opacity: 0;
    right: 0;
    left: auto;
    transform-origin: 100% 100%;
}

/* Animações do fundo */

.auth-toggle:not(:checked) ~ .auth-bg-1 {
    animation: auth-bg-register 1.2s both;
}

.auth-toggle:checked ~ .auth-bg-1 {
    animation: auth-bg-login 1.2s both;
}

.auth-toggle:not(:checked) ~ .auth-bg-2 {
    animation: auth-bg2-register 1.2s both;
}

.auth-toggle:checked ~ .auth-bg-2 {
    animation: auth-bg2-login 1.2s both;
}

/* =========================================================
   BOTÕES DE TROCA ENTRE LOGIN E CADASTRO
   ========================================================= */

.auth-switch {
    position: absolute;
    z-index: 4;
    inset: 0 auto 0 0;
    width: 50%;
    display: grid;
    align-content: start;
    justify-items: center;
    padding-top: 64px;
    pointer-events: none;
}

.auth-switch-login {
    translate: 100% 0;
}

.auth-switch label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: 32px;
    border: 1px solid rgb(255 255 255 / 55%);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    opacity: 0;
    transition:
        opacity .3s,
        translate .3s,
        background .25s,
        color .25s;
}

.auth-switch-register label {
    translate: -100% 0;
}

.auth-switch-login label {
    translate: 100% 0;
}

.auth-toggle:not(:checked) ~ .auth-switch-login label,
.auth-toggle:checked ~ .auth-switch-register label {
    opacity: 1;
    translate: 0;
    pointer-events: auto;
    transition:
        opacity .3s .85s,
        translate .3s .85s,
        background .25s,
        color .25s;
}

.auth-switch label:hover {
    background: #fff;
    color: var(--a-primary);
}

.auth-switch .material-symbols-outlined {
    font-size: 18px;
    transition: translate .3s;
}

.auth-switch label:hover .material-symbols-outlined {
    translate: 4px 0;
}

/* =========================================================
   FORMULÁRIOS
   ========================================================= */

.auth-form {
    position: absolute;
    z-index: 3;
    inset: 0 auto 0 0;
    width: 50%;
    display: grid;
    place-items: center;
}

.auth-form form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 340px;
    opacity: 0;
    transition: .3s;
}

.auth-form-register {
    translate: 100% 0;
}

.auth-form-register form {
    translate: 380px 0;
}

.auth-form-login form {
    translate: -380px 0;
}

.auth-toggle:not(:checked) ~ .auth-form-login form,
.auth-toggle:checked ~ .auth-form-register form {
    opacity: 1;
    translate: 0;
    transition: .4s .8s;
}

/* Logo e títulos */

.auth-logo {
    height: 38px;
    width: auto;
    object-fit: contain;
    margin: 0 auto 4px;
}

.auth-form h2 {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px;
}

.auth-form h3 {
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    margin: 0 0 8px;
    color: var(--a-muted);
}

/* =========================================================
   CAMPOS DE ENTRADA
   ========================================================= */

.auth-field {
    position: relative;
    display: block;
    width: 100%;
    margin: 0;
}

.auth-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    translate: 0 -50%;
    font-size: 19px !important;
    color: var(--a-muted);
    pointer-events: none;
    transition: color .2s;
}

.auth-field:focus-within .auth-icon {
    color: var(--a-primary);
}

.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"] {
    display: block;
    width: 100%;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: var(--a-input);
    padding: 0 14px 0 42px;
    font: inherit;
    font-size: 14px;
    color: inherit;
    outline: none;
    transition: box-shadow .15s;
}

.auth-card input::placeholder {
    color: var(--a-muted);
}

.auth-card input:focus {
    box-shadow: 0 0 0 3px rgba(37, 133, 248, .2);
}

/* Senha e confirmação */

.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

/* Esqueci minha senha */

.auth-forgot {
    align-self: flex-end;
    font-size: 12.5px;
    color: var(--a-primary);
    text-decoration: none;
}

.auth-forgot:hover {
    text-decoration: underline;
}

/* =========================================================
   BOTÃO PRINCIPAL
   ========================================================= */

.auth-submit {
    width: 100%;
    height: 46px;
    border: 0;
    border-radius: 12px;
    margin-top: 6px;
    background: linear-gradient(
        90deg,
        var(--a-primary-dark),
        var(--a-primary)
    );
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 20px -6px rgba(37, 133, 248, .55);
    transition: transform .1s, opacity .15s;
}

.auth-submit:hover {
    opacity: .92;
}

.auth-submit:active {
    transform: translateY(1px);
}

/* =========================================================
   TIPO DE CONTA
   ========================================================= */

.auth-label {
    font-size: 13px;
    font-weight: 600;
    margin-top: 2px;
}

.auth-type {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.auth-type-card {
    position: relative;
    cursor: pointer;
    margin: 0;
}

.auth-type-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.auth-type-body {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
    transition:
        border-color .15s,
        background .15s,
        box-shadow .15s;
}

.auth-type-body .material-symbols-outlined {
    color: var(--a-primary);
    font-size: 24px;
}

.auth-type-body strong {
    display: block;
    font-size: 13px;
}

.auth-type-body small {
    display: block;
    font-size: 11.5px;
    color: #6b7280;
}

.auth-type-card:hover .auth-type-body {
    border-color: #93c5fd;
}

.auth-type-card input:checked + .auth-type-body {
    border-color: var(--a-primary);
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(37, 133, 248, .15);
}

/* =========================================================
   ANIMAÇÕES DO FUNDO
   ========================================================= */

@keyframes auth-bg-register {
    0% {
        rotate: -45deg;
    }

    50% {
        opacity: 1;
    }

    50%, 100% {
        rotate: 0deg;
    }

    50.01%, 100% {
        opacity: 0;
    }
}

@keyframes auth-bg-login {
    0% {
        opacity: 0;
        rotate: 0deg;
    }

    50% {
        rotate: 0deg;
        opacity: 0;
    }

    50.01% {
        opacity: 1;
    }

    100% {
        opacity: 1;
        rotate: -45deg;
    }
}

@keyframes auth-bg2-register {
    0%, 50% {
        rotate: 0;
        opacity: 0;
    }

    50.01% {
        opacity: 1;
        rotate: 0deg;
    }

    100% {
        opacity: 1;
        rotate: 45deg;
    }
}

@keyframes auth-bg2-login {
    0% {
        rotate: 45deg;
        opacity: 1;
    }

    50% {
        rotate: 0deg;
        opacity: 1;
    }

    50.01%, 100% {
        opacity: 0;
    }
}

/* =========================================================
   RESPONSIVIDADE - TABLETS E CELULARES
   ========================================================= */

@media (max-width: 940px) {

    body.auth-page {
        min-height: 100vh;
        padding: 20px 0;
    }

    .auth-wrap {
        padding: 12px;
    }

    .auth-card {
        --a-w: 94vw;
        width: var(--a-w);
        height: auto;
        min-height: 640px;
        border-radius: 24px;
    }

    .auth-bg {
        display: none;
    }

    .auth-form,
    .auth-switch {
        width: 100%;
        translate: 0 !important;
    }

    .auth-form form {
        width: min(340px, 86vw);
        translate: 0 !important;
    }

    .auth-toggle:not(:checked) ~ .auth-form-login,
    .auth-toggle:checked ~ .auth-form-register {
        display: none;
    }

    .auth-form {
        position: relative;
        padding: 40px 0 90px;
    }

    .auth-switch {
        align-content: end;
        padding: 0 0 28px;
    }

    .auth-switch label {
        color: var(--a-primary);
        border-color: #bcdaff;
    }

    .auth-switch label:hover {
        background: #eff6ff;
        color: var(--a-primary-dark);
    }
}

/* =========================================================
   CELULARES PEQUENOS
   ========================================================= */

@media (max-width: 380px) {

    .auth-card {
        min-height: 620px;
        border-radius: 20px;
    }

    .auth-form {
        padding-top: 30px;
    }

    .auth-form form {
        width: 88vw;
    }

    .auth-form h2 {
        font-size: 20px;
    }

    .auth-row {
        grid-template-columns: 1fr;
    }

    .auth-type {
        gap: 6px;
    }

    .auth-type-body {
        gap: 6px;
        padding: 8px;
    }

    .auth-type-body strong {
        font-size: 12px;
    }

    .auth-type-body small {
        font-size: 10px;
    }
}

/* =========================================================
   MENSAGENS DO SISTEMA
   ========================================================= */

.auth-wrap .flash-list {
    width: min(900px, 94vw);
    margin: 0;
}

.auth-wrap .flash {
    text-align: center;
}

.flash-danger {
    background: #fce8ea;
    color: #971b2a;
}

.flash-warning {
    background: #fbead0;
    color: #92400e;
}

.flash-info {
    background: #e0f2fe;
    color: #0369a1;
}


/* =========================================================
   AJUSTES MOBILE - LOGIN E CADASTRO
   Corrige a exibição do formulário ativo e evita cortes
   em telas pequenas, sem alterar o layout desktop.
   ========================================================= */

@media (max-width: 640px) {
    body.auth-page {
        display: block;
        min-height: 100vh;
        padding: 16px 0;
        overflow-x: hidden;
    }

    .auth-wrap {
        width: 100%;
        min-height: 100vh;
        justify-content: center;
        padding: 12px;
    }

    .auth-card {
        width: 100%;
        max-width: 440px;
        height: auto;
        min-height: 0;
        overflow: visible;
        border-radius: 22px;
    }

    .auth-bg {
        display: none;
    }

    /* No celular, somente o formulário correspondente ao modo
       selecionado fica visível. A regra anterior estava invertida. */
    /* Esconde somente o formulário inativo.
       O CSS antigo escondia também o formulário ativo. */
    .auth-toggle:not(:checked) ~ .auth-form-login {
        display: grid !important;
    }

    .auth-toggle:not(:checked) ~ .auth-form-register {
        display: none !important;
    }

    .auth-toggle:checked ~ .auth-form-login {
        display: none !important;
    }

    .auth-toggle:checked ~ .auth-form-register {
        display: grid !important;
    }

    .auth-form {
        position: relative;
        inset: auto;
        display: grid;
        width: 100%;
        min-height: 0;
        padding: 30px 18px 104px;
        translate: 0 !important;
    }

    .auth-form form {
        width: 100%;
        max-width: 360px;
        gap: 12px;
        margin: 0 auto;
        opacity: 1;
        translate: 0 !important;
        transition: none;
    }

    .auth-form h2 {
        font-size: 21px;
    }

    .auth-logo {
        max-width: 150px;
        height: 34px;
    }

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

    .auth-type {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .auth-type-body {
        min-height: 62px;
        gap: 7px;
        padding: 9px;
    }

    .auth-type-body strong {
        font-size: 12px;
    }

    .auth-type-body small {
        font-size: 10.5px;
    }

    .auth-switch {
        position: absolute;
        inset: auto 0 0;
        width: 100%;
        height: 82px;
        padding: 12px 10px 18px;
        align-content: center;
        justify-items: center;
        background: #fff;
        border-radius: 0 0 22px 22px;
    }

    .auth-switch label {
        max-width: 100%;
        padding: 10px 18px;
        font-size: 13px;
        color: var(--a-primary-dark);
        border-color: #bcdaff;
        background: #fff;
    }

    .auth-wrap .flash-list {
        width: 100%;
        max-width: 440px;
    }
}

@media (max-width: 360px) {
    .auth-form {
        padding-right: 14px;
        padding-left: 14px;
    }

    .auth-type {
        grid-template-columns: 1fr;
    }
}


/* Ajuste da navegação entre login e cadastro no celular */
@media (max-width: 640px) {
    .auth-switch {
        z-index: 10;
        position: absolute;
        inset: auto 0 0 0;
        width: 100%;
        height: 82px;
        display: grid;
        align-content: center;
        justify-items: center;
        padding: 10px 12px 16px;
        pointer-events: none;
        background: #fff;
        border-radius: 0 0 22px 22px;
    }

    .auth-switch label {
        display: inline-flex;
        opacity: 1;
        translate: 0 0 !important;
        pointer-events: auto;
        visibility: visible;
        color: var(--a-primary-dark);
        background: #fff;
        border: 1px solid #bcdaff;
    }

    .auth-toggle:not(:checked) ~ .auth-switch-register {
        display: none !important;
    }

    .auth-toggle:not(:checked) ~ .auth-switch-login {
        display: grid !important;
    }

    .auth-toggle:checked ~ .auth-switch-login {
        display: none !important;
    }

    .auth-toggle:checked ~ .auth-switch-register {
        display: grid !important;
    }

    .auth-toggle:checked ~ .auth-form-register {
        padding-bottom: 104px;
    }
}


/* =========================================================
   POP-UP DE AVISO - ANTECEDÊNCIA DO AGENDAMENTO
   ========================================================= */

.auth-notice {
    --a-primary: #2585f8;
    --a-primary-dark: #1666d1;
    font-family: "Inter", sans-serif;
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, .45);
    opacity: 0;
    transition: opacity .2s ease;
}

.auth-notice[hidden] { display: none; }
.auth-notice.is-open { opacity: 1; }

.auth-notice-box {
    position: relative;
    width: min(440px, 100%);
    padding: 30px 28px 26px;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(22, 102, 209, .28);
    text-align: center;
    transform: translateY(12px) scale(.98);
    transition: transform .2s ease;
    box-sizing: border-box;
}

.auth-notice.is-open .auth-notice-box { transform: none; }

.auth-notice-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #9aa2b1;
    cursor: pointer;
}

.auth-notice-close:hover { background: #f1f3f7; color: #23262b; }

.auth-notice-badge {
    display: inline-grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: linear-gradient(135deg, #1666d1, #2585f8 55%, #00bcdc);
    color: #fff;
    box-shadow: 0 10px 22px -8px rgba(37, 133, 248, .6);
}

.auth-notice-box h2 {
    margin: 14px 0 4px;
    font-size: 21px;
    font-weight: 700;
    color: #23262b;
}

.auth-notice-sub {
    margin: 0 0 18px;
    font-size: 13.5px;
    color: #6b7280;
}

.auth-notice-rule {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding: 12px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    background: #f9fafb;
    text-align: left;
}

.auth-notice-ico { display: block; width: 100%; height: 100%; }
.auth-notice-rule > .auth-notice-ico {
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    color: #2585f8;
}
.auth-notice-close .auth-notice-ico { width: 20px; height: 20px; }
.auth-notice-badge .auth-notice-ico { width: 30px; height: 30px; }

.auth-notice-rule div { flex: 1 1 auto; min-width: 0; }
.auth-notice-rule strong { display: block; font-size: 14px; color: #23262b; }
.auth-notice-rule small { display: block; font-size: 12.5px; line-height: 1.4; color: #6b7280; }
.auth-notice-rule b { color: #1666d1; }

.auth-notice-hours {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 10px;
    background: #eff6ff;
    color: #1666d1;
    font-size: 15px;
    font-weight: 800;
}

.auth-notice-box .auth-submit {
    display: block;
    width: 100%;
    margin-top: 10px;
    border: 0;
    color: #fff;
    background: linear-gradient(90deg, #1666d1, #2585f8);
}

@media (max-width: 380px) {
    .auth-notice-box { padding: 26px 18px 20px; }
    .auth-notice-hours { display: none; }
}
.auth-notice-box:focus { outline: none; }
.auth-notice-box .auth-submit:focus-visible { outline: 3px solid rgba(37, 133, 248, .35); outline-offset: 2px; }

/* Destaque "Necessário ir com Chapa" (fornecedor) */
.auth-notice-rule-supplier { border-color: #fcd34d; background: #fffbeb; }
.auth-notice-chapa {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 11px;
    border-radius: 9px;
    background: #f59e0b;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .01em;
    text-transform: uppercase;
    box-shadow: 0 6px 14px -6px rgba(245, 158, 11, .7);
}
.auth-notice-chapa svg { width: 16px; height: 16px; flex: 0 0 16px; }
