/* Fix global padding for the login page */
body.login-page-body {
    padding: 0 !important;
    margin: 0 !important;
}

:root {
    --login-sidebar-width: 550px;
    --login-bg: #000000;
}


.login-page-wrapper {
    display: flex; /* Back to split layout */
    min-height: 100vh;
    width: 100%;
    background: #000;
    overflow: hidden;
}

/* Mobile: permitir scroll — o formulário multi-passos é mais alto que o ecrã */
@media (max-width: 1024px) {
    .login-page-wrapper {
        overflow: visible;
        min-height: 100dvh;
    }
    .login-sidebar {
        min-height: 100dvh;
    }
}


/* ── Sidebar (Left Solid Black) ── */
.login-sidebar {
    width: var(--login-sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 40px 60px 60px; /* Reduced top padding */
    background: #000; /* Solid black as requested */
    position: relative;
    z-index: 10;
}


.login-back-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 40px;
    transition: opacity 0.2s;
}


.login-back-link:hover {
    opacity: 0.7;
}

.login-form-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.login-header h1 {
    font-size: 2.2rem;
    font-weight: 900;
    margin-bottom: 8px;
    letter-spacing: -0.03em;
}

.login-header p {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* ── Form Inputs ── */
.login-input-group {
    margin-bottom: 16px;
    position: relative;
    isolation: isolate;
    transform: translateZ(0);
}

.login-input {
    width: 100% !important;
    height: 58px !important;
    background: #1a1a1c !important; /* Normal dark gray */
    border: none;
    border-radius: 8px;
    padding: 0 20px !important;
    box-sizing: border-box !important;
    color: #ffffff !important; /* Always white text */
    caret-color: #ffffff !important; /* Always white cursor */
    font-size: 1rem;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    outline: none;
    position: relative;
    z-index: 2;
    overflow: hidden;
    transition: background 0.2s ease;
}

/* ── Password visibility toggle (olho) ── */
.password-wrapper {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    isolation: isolate;
    transform: translateZ(0);
}
.password-wrapper .login-input {
    width: 100% !important;
    padding-right: 48px !important;
    box-sizing: border-box !important;
}
.toggle-password-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    outline: none;
    padding: 0;
    cursor: pointer;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    z-index: 2;
}
.toggle-password-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    display: block;
}
.toggle-password-btn:hover {
    color: #ffffff;
}
input::-ms-reveal,
input::-ms-clear {
    display: none;
}

/* 1. Força a cor do texto branco e fundo normal nos inputs comuns */
input[type="text"],
input[type="email"],
input[type="password"],
.login-input {
    color: #ffffff !important;
    background-color: #1a1a1c !important;
    -webkit-text-fill-color: #ffffff !important;
    caret-color: #ffffff !important;
    box-sizing: border-box !important;
    border: none !important;
}

@keyframes onAutofillStart {
    from { opacity: 1; }
    to { opacity: 1; }
}

/* 2. Fundo normal (#1A1A1C) e texto branco estrito quando preenchido por sugestões/autofill (WebKit) */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active,
.login-input:-webkit-autofill,
.login-input:-webkit-autofill:hover, 
.login-input:-webkit-autofill:focus,
.login-input:-webkit-autofill:active {
    -webkit-text-fill-color: #ffffff !important;
    color: #ffffff !important;
    -webkit-box-shadow: 0 0 0px 1000px #1A1A1C inset !important;
    background-color: #1A1A1C !important;
    caret-color: #ffffff !important;
    animation-name: onAutofillStart;
    animation-duration: 0.001s;
}

/* 3. Para navegadores modernos que usam o padrão CSS standard em autofill */
input:autofill,
.login-input:autofill {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    background-color: #1A1A1C !important;
    caret-color: #ffffff !important;
}

/* 4. Estado de erro - fundo avermelhado suave, sem bordas vermelhas, texto branco estrito */
.login-error {
    border: none !important;
    outline: none !important;
    -webkit-box-shadow: 0 0 0px 1000px #3d1a1f inset !important;
    background-color: #3d1a1f !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    caret-color: #ffffff !important;
}

/* Remove ou neutraliza :invalid nativo que coloca bordas vermelhas */
input:invalid,
.login-input:invalid {
    border: none !important;
    box-shadow: none !important;
}

.login-input::placeholder {
    color: #888888;
    opacity: 1; /* Ensures visibility in Firefox */
}


.login-input:focus {
    background: #222224; /* Subtle change but no line/outline */
    border: none;
    box-shadow: none;
    outline: none;
}

.login-forgot-pass {
    display: block;
    text-align: right;
    font-size: 0.85rem;
    color: #888; /* Lightened for better visibility on black */
    text-decoration: none;
    margin-top: 15px;
    margin-bottom: 40px;
}

.login-forgot-pass:hover {
    color: #fff; /* White on hover for clear interaction */
}

/* ── Primary Action (Static Blue Button) ── */
.btn-login-submit {
    width: 100%;
    background: var(--accent-solid, #0069DB);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 18px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: none; /* No transition/movement as requested */
    margin-bottom: 30px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-login-submit:hover {
    /* No movement or color change as requested */
    background: var(--accent-solid, #0069DB);
    transform: none;
}


.btn-login-submit:active {
    transform: translateY(0);
}

.btn-login-submit:disabled {
    opacity: 0.75;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-login-submit .btn-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btnSpin 0.6s linear infinite;
    flex-shrink: 0;
}

.btn-login-submit.is-loading .btn-spinner {
    display: inline-block;
}

.btn-login-submit.is-loading .btn-label {
    display: none;
}

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

.login-signup-prompt {
    text-align: center;
    font-size: 0.95rem;
    color: #888; /* Lightened */
}

.login-signup-prompt a {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    margin-left: 4px;
}

.login-sidebar-footer {
    color: #888; /* Even lighter for maximum legibility */
    font-size: 0.8rem;
    margin-top: auto;
    text-align: center; /* Centered as requested */
    width: 100%;
}



/* ── Visual Hero (Right Side Image) ── */
.login-visual-hero {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    background: #000;
    margin-top: 0 !important; /* Force reset from style.css 'main' rule if tag was main */
    padding: 0 !important;
}


/* Single Banner Image */
.login-banner-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0.7;
}

.login-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Dark gradient from bottom up to give contrast to the white hero text */
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0.45) 40%,
        rgba(0, 0, 0, 0.15) 70%,
        rgba(0, 0, 0, 0) 100%
    );
    z-index: 5;
}





.login-hero-text {
    position: absolute;
    bottom: 80px;
    right: 80px; /* Moved to right since sidebar is left */
    z-index: 10;
    max-width: 500px;
}

.login-hero-text h2 {
    font-size: 3.5rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 20px;
    line-height: 1;
    letter-spacing: -0.04em;
    text-align: right;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.login-hero-text p {
    font-size: 1.15rem;
    line-height: 1.6;
    color: #ccc;
    font-weight: 500;
    text-align: right;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}


/* ── Responsive ── */
@media (max-width: 1024px) {
    .login-visual-hero {
        display: none;
    }
    
    .login-sidebar {
        width: 100%;
        padding: 40px 24px;
        align-items: center;
    }


    
    .login-form-container {
        width: 100%;
        max-width: 400px;
    }
    
    .login-back-link {
        margin-bottom: 60px;
        align-self: flex-start;
    }
}

/* Correção completa e definitiva para o Autocomplete / Autofill */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
.login-input:-webkit-autofill,
.login-input:-webkit-autofill:hover,
.login-input:-webkit-autofill:focus,
.login-input:-webkit-autofill:active {
    -webkit-text-fill-color: #ffffff !important;
    -webkit-box-shadow: 0 0 0 1000px #1a1a1c inset !important;
    background-color: #1a1a1c !important;
    color: #ffffff !important;
    caret-color: #ffffff !important;
    transition: background-color 9999s ease-in-out 0s;
}

input:autofill,
.login-input:autofill {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    background-color: #1a1a1c !important;
    caret-color: #ffffff !important;
    transition: background-color 9999s ease-in-out 0s;
}

.login-error,
input.login-error,
input:-webkit-autofill.login-error,
input:-webkit-autofill:hover.login-error,
input:-webkit-autofill:focus.login-error,
input:-webkit-autofill:active.login-error,
.login-input.login-error,
.login-input.login-error:-webkit-autofill {
    border: none !important;
    outline: none !important;
    -webkit-box-shadow: 0 0 0px 1000px #3d1a1f inset !important;
    background-color: #3d1a1f !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    caret-color: #ffffff !important;
    transition: background-color 9999s ease-in-out 0s;
}

/* ── Toast Notifications ── */
.login-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    width: calc(100% - 32px);
    max-width: 400px;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    text-align: center;
    box-sizing: border-box;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.login-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.login-toast.success {
    background: #00c853;
}

.login-toast.error {
    background: #ef4444;
}

.login-toast.warning {
    background: #ffc107;
    color: #000;
}

@media (max-width: 480px) {
    .login-toast {
        font-size: 0.78rem;
        padding: 10px 16px;
    }
}

/* Fix Top Gap (Google Translate suppression) & Lang Selector Styles */
html, body {
    top: 0 !important;
    position: relative !important;
    padding-top: 0 !important;
    margin-top: 0 !important;
    height: auto !important;
    min-height: 100% !important;
}

.login-page-wrapper {
    position: relative;
}

.login-lang-wrapper {
    position: absolute;
    top: 43px;
    right: 60px;
    z-index: 1001;
}

.login-lang-wrapper .lang-btn {
    color: #ffffff !important;
    opacity: 1 !important;
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    gap: 8px !important;
    padding: 0 !important;
}

.login-lang-wrapper .lang-selector-group {
    display: flex !important;
}

.login-lang-wrapper .lang-dropdown {
    margin-top: 10px;
}

@media (max-width: 1024px) {
    .login-lang-wrapper {
        top: 40px;
        right: 24px;
    }
}

@media (max-width: 600px) {
    .login-header h1 {
        font-size: 1.55rem;
    }
}

/* ── Reenvio de autorização parental ── */
.consent-resend-box {
    display: none;
    margin-top: 16px;
    padding: 14px 16px;
    background: rgba(0, 123, 255, 0.08);
    border: 1px solid rgba(0, 123, 255, 0.25);
    border-radius: 10px;
    text-align: center;
}

.consent-resend-box.visible {
    display: block;
}

.consent-resend-box p {
    margin: 0 0 10px;
    font-size: 0.85rem;
    color: #9a9ba3;
    line-height: 1.5;
}

.consent-resend-btn {
    width: 100%;
    background: transparent;
    border: 1.5px solid #007BFF;
    color: #007BFF;
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
}

.consent-resend-btn:hover {
    background: rgba(0, 123, 255, 0.1);
}

.consent-resend-btn:disabled {
    opacity: 0.6;
    cursor: default;
}
