/**
 * Telas de autenticação (resources/views/login_old).
 * CSS autossuficiente: essa tela NÃO carrega o Mazer (app.css/style.css),
 * por isso utilitários usados pelo login.js (.d-none, .is-invalid,
 * .invalid-feedback, .loading-page, .loader) são redefinidos aqui.
 */

:root {
    --brand-950: #07182b;
    --brand-900: #0b2440;
    --brand-700: #134e7e;
    --brand-500: #1b77c4;
    --cyan-400: #29b8d8;
    --cyan-300: #6fd8ea;

    --ink-900: #101828;
    --ink-500: #475467;
    --ink-300: #98a2b3;

    --surface: #ffffff;
    --surface-alt: #f7fafc;
    --line: #e4e9f0;

    --danger: #d92d20;
    --danger-bg: #fef3f2;
    --success: #067647;
    --success-bg: #ecfdf3;
    --warning: #b54708;
    --warning-bg: #fffaeb;
    --info: #175cd3;
    --info-bg: #eff8ff;

    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--surface-alt);
    color: var(--ink-900);
    -webkit-font-smoothing: antialiased;
}

/* ============ ESTRUTURA ============ */
.auth-screen {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.auth-form-side {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--surface);
    overflow: hidden;
}

/* Marca d'água discreta só quando o painel da direita some (ver media query) */
.auth-form-side::before {
    content: "";
    position: absolute;
    top: -12%;
    right: -18%;
    width: 78%;
    aspect-ratio: 883 / 871;
    background: url(../../images/lion-mark.png) center / contain no-repeat;
    opacity: 0;
    pointer-events: none;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    min-width: 0;
    max-width: 400px;
}

/* ============ PAINEL DA MARCA ============ */
.auth-brand-side {
    position: relative;
    overflow: hidden;
    padding: 56px 60px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    background: radial-gradient(120% 140% at 85% 10%, var(--brand-700) 0%, var(--brand-900) 55%, var(--brand-950) 100%);
}

.auth-brand-side::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
    background-size: 36px 36px;
    -webkit-mask-image: radial-gradient(circle at 70% 30%, #000, transparent 72%);
    mask-image: radial-gradient(circle at 70% 30%, #000, transparent 72%);
    pointer-events: none;
}

.auth-brand-side>* {
    position: relative;
    z-index: 2;
}

.brand-eyebrow {
    font-size: 12px;
    letter-spacing: .16em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--cyan-300);
    margin-bottom: 18px;
}

.brand-headline {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 600;
    font-size: 38px;
    line-height: 1.18;
    letter-spacing: -.01em;
    margin: 0 0 18px;
}

.brand-headline em {
    font-style: normal;
    color: var(--cyan-300);
}

.brand-subtext {
    font-size: 15px;
    line-height: 1.6;
    color: rgba(255, 255, 255, .62);
    max-width: 400px;
    margin: 0;
}

/* Marca d'água: leão low-poly sangrando na borda direita do painel */
.auth-brand-side::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -4%;
    width: 64%;
    max-width: 600px;
    aspect-ratio: 883 / 871;
    transform: translateY(-50%);
    background: url(../../images/lion-mark.png) center / contain no-repeat;
    opacity: .2;
    filter: brightness(1.45) saturate(1.1);
    /* some ao se aproximar do texto, à esquerda */
    -webkit-mask-image: linear-gradient(105deg, transparent 8%, rgba(0, 0, 0, .45) 34%, #000 62%);
    mask-image: linear-gradient(105deg, transparent 8%, rgba(0, 0, 0, .45) 34%, #000 62%);
    animation: mark-float 14s ease-in-out infinite;
    pointer-events: none;
}

@keyframes mark-float {

    0%,
    100% {
        transform: translateY(-50%);
    }

    50% {
        transform: translateY(calc(-50% - 14px));
    }
}

.module-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    margin: 34px 0 0;
    padding: 0;
    list-style: none;
}

.module-tags li {
    font-size: 11px;
    letter-spacing: .05em;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .16);
    color: rgba(255, 255, 255, .78);
}

.brand-bottom {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, .42);
    margin-top: 28px;
}

/* ============ FORMULÁRIO ============ */
.auth-logo {
    margin-bottom: 38px;
}

.auth-logo img {
    height: 52px;
    width: auto;
}

.form-eyebrow {
    font-size: 12px;
    letter-spacing: .14em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--ink-300);
    margin: 0 0 8px;
}

.form-title {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--ink-900);
}

.form-subtitle {
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink-500);
    margin: 0 0 28px;
}

.field {
    margin-bottom: 18px;
}

.field>label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-900);
    margin-bottom: 7px;
}

.input-wrap {
    position: relative;
}

/* Ícone e botão são ancorados ao topo (altura fixa do input) para não
   desalinharem quando o login.js injeta .invalid-feedback dentro do wrap. */
.input-wrap .input-icon {
    position: absolute;
    top: 14px;
    /* (46 - 18) / 2 */
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--ink-300);
    pointer-events: none;
}

.input-wrap input {
    width: 100%;
    height: 46px;
    font-family: inherit;
    font-size: 14px;
    color: var(--ink-900);
    background: var(--surface);
    padding: 0 14px 0 42px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.input-wrap.has-toggle input {
    padding-right: 44px;
}

.input-wrap input::placeholder {
    color: var(--ink-300);
}

.input-wrap input:focus {
    border-color: var(--cyan-400);
    box-shadow: 0 0 0 4px rgba(41, 184, 216, .16);
}

.input-wrap input:focus~.input-icon {
    color: var(--brand-500);
}

.input-wrap input:-webkit-autofill,
.input-wrap input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ink-900);
    -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
    transition: background-color 9999s ease-in-out 0s;
}

.toggle-password {
    position: absolute;
    top: 7px;
    /* (46 - 32) / 2 */
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-300);
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease;
}

.toggle-password:hover {
    color: var(--brand-500);
    background: var(--surface-alt);
}

.toggle-password:focus-visible {
    outline: 2px solid var(--cyan-400);
    outline-offset: 1px;
}

.toggle-password svg {
    width: 18px;
    height: 18px;
}

/* ============ CONTROLES ============ */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 24px;
}

.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--brand-500);
    cursor: pointer;
}

.checkbox-row label {
    font-size: 13px;
    color: var(--ink-500);
    cursor: pointer;
}

.btn-auth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .01em;
    color: #fff;
    padding: 13px 18px;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    background: linear-gradient(90deg, var(--cyan-400), var(--brand-500));
    box-shadow: 0 8px 20px rgba(27, 119, 196, .25);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.btn-auth:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(27, 119, 196, .32);
    filter: brightness(1.03);
}

.btn-auth:active:not(:disabled) {
    transform: translateY(0);
}

.btn-auth:focus-visible {
    outline: 2px solid var(--brand-700);
    outline-offset: 2px;
}

.btn-auth:disabled {
    opacity: .65;
    cursor: not-allowed;
    box-shadow: none;
}

.auth-actions {
    margin-top: 22px;
    text-align: center;
}

.link-brand {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-500);
    text-decoration: none;
}

.link-brand:hover {
    color: var(--brand-700);
    text-decoration: underline;
}

.link-muted {
    font-size: 13px;
    color: var(--ink-500);
    text-decoration: none;
}

.link-muted:hover {
    color: var(--brand-500);
}

.auth-support {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 34px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--ink-300);
}

.auth-support a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--brand-500);
    font-weight: 600;
    text-decoration: none;
}

.auth-support a:hover {
    text-decoration: underline;
}

.auth-support svg {
    width: 14px;
    height: 14px;
}

/* ============ FEEDBACK ============ */
.alert {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    line-height: 1.45;
    padding: 12px 34px 12px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    margin-bottom: 18px;
}

.alert svg {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-top: 1px;
}

.alert p,
.alert ul {
    margin: 0;
}

.alert ul {
    padding-left: 18px;
}

.alert-danger {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: rgba(217, 45, 32, .22);
}

.alert-success {
    color: var(--success);
    background: var(--success-bg);
    border-color: rgba(6, 118, 71, .22);
}

.alert-warning {
    color: var(--warning);
    background: var(--warning-bg);
    border-color: rgba(181, 71, 8, .22);
}

.alert-info {
    color: var(--info);
    background: var(--info-bg);
    border-color: rgba(23, 92, 211, .22);
}

.btn-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    opacity: .6;
    cursor: pointer;
}

.btn-close::before,
.btn-close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 11px;
    height: 1.5px;
    background: currentColor;
}

.btn-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.btn-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.btn-close:hover {
    opacity: 1;
}

/* Classes injetadas pelo login.js na validação */
.input-wrap input.is-invalid {
    border-color: var(--danger);
}

.input-wrap input.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(217, 45, 32, .14);
}

.invalid-feedback {
    display: block;
    font-size: 12px;
    color: var(--danger);
    margin-top: 6px;
}

#error-msg {
    margin: 16px 0 0;
}

.field-hint {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--warning);
    margin-top: 6px;
}

.d-none {
    display: none !important;
}

/* ============ OVERLAY DE LOADING (login.js) ============ */
.loading-page {
    position: fixed;
    inset: 0;
    z-index: 1051;
    background: rgba(7, 24, 43, .72);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.loading-page .loading-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
}

.loading-page .text-light {
    font-size: 14px;
    color: rgba(255, 255, 255, .85);
}

.loader>div {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, .22);
    border-top-color: var(--cyan-300);
    border-radius: 50%;
    animation: auth-spin 1s linear infinite;
}

@keyframes auth-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============ RESPONSIVO ============ */
@media (max-width: 1200px) {
    .auth-brand-side {
        padding: 48px 40px;
    }

    .brand-headline {
        font-size: 32px;
    }
}

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

    .auth-brand-side {
        display: none;
    }

    .auth-form-side {
        min-height: 100vh;
        background: var(--surface);
    }

    .auth-form-side::before {
        opacity: .06;
    }
}

@media (max-width: 576px) {
    .auth-form-side {
        padding: 32px 24px;
        align-items: flex-start;
    }

    .auth-logo {
        margin-bottom: 28px;
    }

    .auth-logo img {
        height: 44px;
    }

    .form-title {
        font-size: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {

    .auth-brand-side::after,
    .loader>div {
        animation: none;
    }

    .btn-auth,
    .input-wrap input,
    .toggle-password {
        transition: none;
    }
}
