:root {
    --primary-blue: #004787;
    --light-blue: #248aff;
    --recover-blue: #004787;
    --dark-blue: #002547;
    --bg-blue: #01529a;
    --gray-border: #707070;
    --label-gray: #faf9f5;
    --placeholder-gray: #b2b1af;
    --icon-gray: #666564;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Open Sans", sans-serif;
    background: linear-gradient(135deg, var(--bg-blue) 0%, var(--dark-blue) 100%);
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
}

/* Background Layers */
.bg-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("../bg_pattern_new.png");
    background-repeat: repeat;
    background-size: 1920px auto;
    background-position: center top;
    mix-blend-mode: multiply;
    z-index: -1;
}

.bg-group {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
}

.login-header {
    margin-top: 60px;
    margin-bottom: 20px;
    z-index: 10;
    display: flex;
    justify-content: center;
    width: 100%;
}

.login-header img {
    width: 94px;
    height: 64px;
    object-fit: contain;
}

/* Indicador visual de desenvolvimento */
[data-env="desenvolvimento"] .login-header img,
[data-env="homologacao"] .login-header img,
[data-env="localhost"] .login-header img,
[data-env="local"] .login-header img {
    filter: brightness(0) saturate(100%) invert(30%) sepia(93%) saturate(1043%) hue-rotate(53deg) brightness(94%)
        contrast(103%);
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 1920px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 5;
}

.title {
    margin-top: 10px;
    font-family: "Fira Sans Extra Condensed", sans-serif;
    font-size: 48px;
    font-weight: 600;
    color: white;
    text-align: center;
}

/* Form Area */
/* Form Area Fluidity */
.form-area {
    /* Removed absolute positioning */
    margin-top: 30px;
    width: 90%;
    max-width: 612px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    align-items: center;
}

.input-group-stretch {
    width: 100%;
}

/* ... existing input styles ... */
/* We keep .input-group, .input-label etc unchanged if they don't have absolute positioning */

.input-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.input-label {
    color: var(--label-gray);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.07px;
    margin-bottom: 4px;
    line-height: 24px;
}

.input-container {
    width: 100%;
    height: 50px;
    background: white;
    border-radius: 5px;
    border: 1px solid var(--gray-border);
    display: flex;
    align-items: center;
    padding: 0 15px;
    position: relative;
}

.input-field {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    color: #333;
    font-style: italic;
    font-family: "Open Sans", sans-serif;
}

.input-field::placeholder {
    color: var(--placeholder-gray);
    letter-spacing: 0.8px;
}

/* Desativa botão nativo de "olho" e "limpar" em navegadores como Edge/IE e Chrome no Windows */
.input-field::-ms-reveal,
.input-field::-ms-clear {
    display: none;
}

/* Anel de foco por TECLADO. O login não carrega o common.css (que tem o
   :focus-visible global), então os campos (outline:none) e botões ficariam sem
   indicação de foco — barreira pra quem navega por teclado. :focus-visible não
   dispara no clique de mouse, então não muda o visual de quem usa mouse. */
a:focus-visible,
button:focus-visible {
    outline: 2px solid #004787;
    outline-offset: 2px;
    border-radius: 4px;
}

.toggle-password-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--icon-gray);
    font-size: 20px;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.toggle-password-btn:hover {
    color: var(--primary-blue);
}

.btn-entrar {
    width: 270px;
    height: 48px;
    background: var(--light-blue);
    color: white;
    border-radius: 5px;
    border: 1px solid white;
    font-family: "Fira Sans Condensed", sans-serif;
    font-size: 20px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-entrar:hover {
    filter: brightness(1.1);
}

.btn-microsoft {
    width: 270px;
    height: 48px;
    background: #ffffff;
    color: #1f2a44;
    border-radius: 5px;
    border: 1px solid #d0d7e2;
    font-family: "Fira Sans Condensed", sans-serif;
    font-size: 19px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-microsoft:hover {
    filter: brightness(0.97);
}

.btn-recovery {
    height: 48px;
    padding: 0 40px;
    background: var(--recover-blue);
    color: white;
    border-radius: 5px;
    border: 1px solid white;
    font-family: "Fira Sans Condensed", sans-serif;
    font-size: 20px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-recovery:hover {
    filter: brightness(1.1);
}

.social-area i {
    color: white;
    font-size: 20px;
    cursor: pointer;
}

.recovery-area {
    margin-top: 60px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    z-index: 10;
    width: 90%;
    max-width: 1000px;
}

.social-area {
    margin-top: 50px;
    margin-bottom: 25px;
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Footer Tab */
.footer-tab {
    margin-top: auto;
    width: 330px;
    background: white;
    border-radius: 10px 10px 0 0;
    padding: 24px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    text-align: center;
    z-index: 15;
}

.footer-title {
    color: var(--primary-blue);
    font-family: "Roboto", sans-serif;
}

.footer-title .service {
    font-size: 16px;
    font-weight: 600;
    display: block;
}

.footer-title .phone {
    font-size: 20px;
    font-weight: 700;
    display: block;
}

.footer-text {
    color: #4b4b4b;
    font-family: "Roboto", sans-serif;
    font-size: 16px;
    font-weight: 400;
}

.footer-text a {
    color: #4b4b4b;
    text-decoration: none;
}

/* ============================================================
   Recovery Views (Esqueci senha / Esqueci código)
   ============================================================ */
.recovery-view {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: recoveryFadeIn 160ms ease-out;
}

.recovery-view[hidden] {
    display: none;
}

.recovery-step {
    animation: recoveryFadeIn 160ms ease-out;
}

@keyframes recoveryFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .recovery-view,
    .recovery-step {
        animation: none;
    }
}

.recovery-step-indicator {
    color: var(--light-blue);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin-top: 10px;
}

.forgot-inline-link {
    background: none;
    border: none;
    color: #cbd5e1;
    font-family: "Open Sans", sans-serif;
    font-size: 13px;
    cursor: pointer;
    padding: 6px 0;
    margin-top: 6px;
    text-decoration: underline;
    text-underline-offset: 3px;
    align-self: flex-end;
    transition: color 0.15s;
}

.forgot-inline-link:hover:not(:disabled) {
    color: white;
}

.forgot-inline-link:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    text-decoration: none;
}

.recovery-success .forgot-inline-link {
    align-self: center;
    margin-top: 14px;
}

.recovery-view[data-view="forgot-password"],
.recovery-view[data-view="forgot-code"] {
    max-width: 640px;
    padding: 0 20px;
    position: relative;
}

.recovery-back {
    align-self: flex-start;
    background: transparent;
    border: none;
    color: var(--label-gray);
    font-family: "Open Sans", sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 12px;
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 5px;
    transition: background 0.2s;
}

.recovery-back:hover {
    background: rgba(255, 255, 255, 0.08);
}

.recovery-step {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
}

.recovery-step[hidden] {
    display: none;
}

.recovery-title {
    color: white;
    font-family: "Fira Sans Extra Condensed", sans-serif;
    font-size: 32px;
    font-weight: 600;
    text-align: center;
    margin-top: 20px;
}

.recovery-subtitle {
    color: #cbd5e1;
    font-size: 15px;
    text-align: center;
    max-width: 480px;
    margin-top: 10px;
    line-height: 1.5;
}

.recovery-subtitle-small {
    font-size: 13px;
    color: #a4b4c8;
    margin-top: 14px;
}

.recovery-hint {
    color: #cbd5e1;
    font-size: 13px;
    text-align: left;
    width: 100%;
    max-width: 612px;
    margin-top: 4px;
    font-style: italic;
}

.required-mark {
    color: #ffb300;
    margin-left: 2px;
}

.recovery-alert {
    width: 100%;
    max-width: 612px;
    margin-top: 18px;
    padding: 12px 16px;
    background: rgba(220, 53, 69, 0.12);
    border: 1px solid rgba(220, 53, 69, 0.35);
    color: #ffb3bc;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
}

.input-row {
    display: flex;
    gap: 16px;
    width: 100%;
}

.input-row .input-group {
    flex: 1;
    min-width: 0;
}

.recovery-options {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.recovery-option {
    width: 100%;
    min-height: 64px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: grid;
    grid-template-columns: 28px 1fr;
    grid-template-rows: auto auto;
    gap: 2px 14px;
    align-items: center;
    text-align: left;
    font-family: "Open Sans", sans-serif;
    transition:
        background 0.15s,
        border-color 0.15s,
        transform 0.1s;
}

.recovery-option:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.35);
}

.recovery-option:active {
    transform: scale(0.99);
}

.recovery-option:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.recovery-option.is-loading {
    position: relative;
}

.recovery-option.is-loading::after {
    content: "";
    position: absolute;
    right: 18px;
    top: 50%;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: recoverySpin 0.8s linear infinite;
}

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

.recovery-option i {
    grid-row: 1 / 3;
    grid-column: 1;
    font-size: 20px;
    color: var(--light-blue);
    align-self: center;
}

.recovery-option-main {
    grid-row: 1;
    grid-column: 2;
    font-size: 16px;
    font-weight: 600;
}

.recovery-option-sub {
    grid-row: 2;
    grid-column: 2;
    font-size: 13px;
    color: #a4b4c8;
}

.recovery-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 30px;
}

.recovery-success-icon {
    font-size: 56px;
    color: #38d39f;
    margin-bottom: 10px;
}

.recovery-success .btn-entrar {
    margin-top: 24px;
}

.btn-entrar-secondary {
    background: transparent;
    border: 1px solid white;
    margin-top: 18px;
}

.btn-entrar[disabled] {
    cursor: not-allowed;
}

.btn-spinner {
    margin-left: 8px;
}

/* ============================================================
   Transição login → dashboard — "Acender o painel"
   Saída do formulário + cortina azul (a própria superfície do
   login) com clarão #248aff e anel de progresso. A revelação do
   dashboard acontece na chegada (ver dashboard.css .auth-boot).
   ============================================================ */
.auth-transition {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
}

.at-curtain {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--bg-blue) 0%, var(--dark-blue) 100%);
    opacity: 0;
    will-change: opacity;
}

.at-curtain::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 42%;
    width: 680px;
    height: 680px;
    max-width: 160vw;
    max-height: 160vw;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.2);
    background: radial-gradient(circle, rgba(36, 138, 255, 0.55), rgba(36, 138, 255, 0) 60%);
    opacity: 0;
}

.at-hero {
    position: absolute;
    left: 50%;
    top: 42%;
    width: 120px;
    height: 81px;
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
    will-change: transform, opacity;
}

.at-logo {
    width: 100%;
    height: 100%;
    display: block;
}

.at-ring {
    position: absolute;
    inset: -34px;
    border-radius: 50%;
    border: 2.5px solid rgba(36, 138, 255, 0.25);
    border-top-color: var(--light-blue);
    opacity: 0;
}

body.auth-launching {
    overflow: hidden;
}

body.auth-launching .auth-transition {
    opacity: 1;
    visibility: visible;
}

body.auth-launching .form-area {
    animation: authFormOut 0.42s cubic-bezier(0.16, 1, 0.3, 1) both;
}

body.auth-launching .title,
body.auth-launching .login-header,
body.auth-launching .recovery-area,
body.auth-launching .social-area,
body.auth-launching .footer-tab {
    animation: authFadeOut 0.35s ease both;
}

body.auth-launching .at-curtain {
    animation: authCurtainIn 0.32s ease both;
}

body.auth-launching .at-curtain::after {
    animation: authBloom 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both;
}

body.auth-launching .at-hero {
    animation: authHeroIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

body.auth-launching .at-ring {
    animation:
        authRingIn 0.6s ease 0.22s both,
        authSpin 1s linear 0.22s infinite;
}

@keyframes authFormOut {
    to {
        opacity: 0;
        transform: translateY(26px);
    }
}

@keyframes authFadeOut {
    to {
        opacity: 0;
    }
}

@keyframes authCurtainIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes authBloom {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.2);
    }
    40% {
        opacity: 1;
    }
    100% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(1.15);
    }
}

@keyframes authHeroIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.7);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

@keyframes authRingIn {
    to {
        opacity: 1;
    }
}

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

@media (prefers-reduced-motion: reduce) {
    body.auth-launching .auth-transition,
    body.auth-launching .form-area,
    body.auth-launching .title,
    body.auth-launching .login-header,
    body.auth-launching .recovery-area,
    body.auth-launching .social-area,
    body.auth-launching .footer-tab,
    body.auth-launching .at-curtain,
    body.auth-launching .at-curtain::after,
    body.auth-launching .at-hero,
    body.auth-launching .at-ring {
        animation: none !important;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        display: block;
    }

    .login-card {
        height: auto;
        min-height: 100vh;
        padding: 0 15px;
    }

    .login-header {
        margin-top: 40px;
    }

    .login-header img {
        width: 120px;
        height: auto;
    }

    .title {
        font-size: 40px;
        margin-top: 10px;
        margin-bottom: 20px;
    }

    .form-area {
        width: 100%;
        max-width: 345px;
        margin-top: 20px;
    }

    .btn-entrar {
        width: 100%;
        max-width: 270px;
        height: 56px;
        margin: 0 auto;
    }

    .recovery-area {
        flex-direction: column;
        gap: 15px;
        margin-top: 40px;
        width: 100%;
        align-items: center;
    }

    .btn-recovery {
        width: 100%;
        max-width: 300px;
        height: 48px;
        padding: 0 10px;
        font-size: 16px;
    }

    .social-area {
        margin-top: 40px;
        margin-bottom: 25px;
    }

    .footer-tab {
        width: 100%;
        max-width: 100%;
        height: auto;
        padding: 20px;
        margin-top: 20px;
        border-radius: 10px 10px 0 0;
    }

    .input-row {
        flex-direction: column;
        gap: 25px;
    }

    .recovery-title {
        font-size: 28px;
    }
}
