/* RESET GLOBAL */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

table {
    width: 100%;
    display: block;
    overflow-x: auto;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-image: url('img/fundo.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-color: #1a3a5f;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    z-index: 1;
}

body.is-login-loading {
    overflow: hidden;
}

.login-loading-overlay[hidden] {
    display: none !important;
}

.login-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
    color: #ffffff;
    background:
        linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(26, 58, 95, 0.96));
    background-size: 54px 54px, 54px 54px, auto;
}

.login-loading-shell {
    width: min(100%, 460px);
    display: grid;
    justify-items: center;
    gap: 14px;
    text-align: center;
}

.login-loading-mark {
    width: 88px;
    height: 88px;
    display: grid;
    place-items: center;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 28px 70px -36px rgba(0, 0, 0, 0.72);
    font-size: 2rem;
}

.login-loading-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.login-loading-shell span {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 13px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.login-loading-shell h2 {
    color: #ffffff;
    font-size: clamp(2rem, 8vw, 3.6rem);
    line-height: 1.02;
    font-weight: 900;
    letter-spacing: 0;
}

.login-loading-shell p {
    max-width: 420px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 1rem;
    line-height: 1.6;
}

.login-loading-status {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.11);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 900;
}

.login-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: clamp(24px, 4vw, 32px);
    border-radius: 22px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: min(420px, 100%);
    text-align: center;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.login-card h1 {
    margin-bottom: 8px;
    font-size: 0;
}

.login-card h1 img {
    display: block;
    max-width: 160px;
    width: 100%;
    height: auto;
    margin: 0 auto;
}

.login-card p {
    color: #1e3a5f;
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.input-group {
    text-align: left;
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 0.8rem;
    color: #1a3a5f;
    margin-bottom: 4px;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    display: block;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.9);
}

.password-field {
    position: relative;
    display: grid;
    isolation: isolate;
    width: 100%;
}

.password-field input {
    grid-area: 1 / 1;
    width: 100%;
    margin: 0;
    padding-right: 48px;
}

.password-toggle {
    grid-area: 1 / 1;
    place-self: center end;
    margin: 0 10px 0 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    box-sizing: border-box;
    flex-shrink: 0;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    position: relative;
    z-index: 2;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.password-toggle:hover {
    background: rgba(148, 163, 184, 0.22);
    color: #0f172a;
}

.password-toggle:focus-visible {
    outline: none;
    color: #1d4ed8;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.password-toggle.is-visible {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

.password-toggle-icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
}

.password-toggle-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.password-toggle-icon-visible {
    display: none;
}

.password-toggle-icon-hidden {
    display: inline-flex;
}

.password-toggle.is-visible .password-toggle-icon-visible {
    display: inline-flex;
}

.password-toggle.is-visible .password-toggle-icon-hidden {
    display: none;
}

.input-group input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background-color: #1a3a5f;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-login:hover {
    background-color: #254d7d;
}

.forgot-password {
    display: inline-block;
    margin-top: 16px;
    color: #1e3a5f;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
    padding: 6px 0;
    font-weight: 500;
}

.forgot-password:hover {
    color: #0f2b4f;
    text-decoration: underline;
}

@media (max-width: 768px) {
    body {
        padding: 18px 14px;
        background-attachment: scroll;
    }

    .login-card {
        max-width: 440px;
    }
}

/* Ajustes específicos para telas pequenas */
@media (max-width: 480px) {
    body {
        align-items: flex-start;
        padding: 24px 12px;
    }

    .login-card {
        padding: 24px 16px;
        max-width: none;
    }

    .login-card h1 img {
        max-width: 140px;
    }

    .login-card p {
        font-size: 0.85rem;
        margin-bottom: 20px;
    }

    .input-group {
        margin-bottom: 14px;
    }

    .input-group label {
        font-size: 0.75rem;
    }

    .input-group input {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .btn-login {
        padding: 12px;
        font-size: 0.95rem;
    }

    .forgot-password {
        margin-top: 14px;
        font-size: 0.8rem;
    }
}

@media (max-width: 360px) {
    .login-card {
        padding: 20px 12px;
        max-width: none;
    }

    .login-card h1 img {
        max-width: 120px;
    }

    .login-card p {
        font-size: 0.8rem;
        margin-bottom: 16px;
    }

    .input-group input {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    .btn-login {
        padding: 10px;
        font-size: 0.9rem;
    }
}

/* Entrada mais viva sem pesar no login */
@keyframes loginSoftReveal {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-card,
.btn-login,
.forgot-password {
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn-login:focus-visible,
.forgot-password:focus-visible,
.input-group input:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.28);
    outline-offset: 3px;
}

@media (hover: hover) {
    .login-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 18px 44px rgba(0, 0, 0, 0.16);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .login-card {
        animation: loginSoftReveal 0.42s ease both;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
