/* ==========================================================================
   Telas de autenticacao (login e recuperacao de senha).
   Layout em duas colunas: painel da marca a esquerda, formulario a direita.
   Depende de css/theme.css.
   ========================================================================== */

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

body {
    font-family: var(--font);
    background: var(--surface);
    color: var(--text);
}

.auth {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    min-height: 100vh;
}

/* --------------------------------------------------------------------------
   Painel da marca
   -------------------------------------------------------------------------- */

.auth__brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: var(--sp-6);
    padding: clamp(48px, 9vh, 100px) clamp(var(--sp-8), 6vw, 80px) var(--sp-10);
    background: linear-gradient(150deg, var(--slate-800) 0%, var(--slate-900) 55%, #0d1c23 100%);
    color: var(--text-on-dark);
    overflow: hidden;
}

/* Blocos isometricos discretos, ecoando a marca */
.auth__brand::before,
.auth__brand::after {
    content: '';
    position: absolute;
    border-radius: 4px;
    pointer-events: none;
}

/* Brilho vermelho que respira devagar */
.auth__brand::before {
    width: 460px;
    height: 460px;
    top: -170px;
    right: -150px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(225, 18, 28, 0.30) 0%, rgba(225, 18, 28, 0) 68%);
    animation: auth-glow 14s ease-in-out infinite;
}

/* Quadro girando muito lentamente no canto inferior */
.auth__brand::after {
    width: 260px;
    height: 260px;
    bottom: -90px;
    left: -70px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: auth-frame 48s linear infinite;
}

.auth__brand > * { position: relative; z-index: 1; }

@keyframes auth-glow {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.85; }
    50%      { transform: translate(-32px, 26px) scale(1.14); opacity: 1; }
}

@keyframes auth-frame {
    from { transform: rotate(24deg); }
    to   { transform: rotate(384deg); }
}

/* --------------------------------------------------------------------------
   Particulas: os quadradinhos do logotipo subindo devagar pelo painel
   -------------------------------------------------------------------------- */

.auth__particles {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.auth__particles span {
    position: absolute;
    bottom: -60px;
    display: block;
    border-radius: 3px;
    background: rgba(148, 167, 181, 0.16);
    animation: auth-float linear infinite;
}

/* Alguns quadrados sao vazados e outros recebem o vermelho da marca,
   como no mosaico do logotipo. */
.auth__particles span:nth-child(3n) {
    background: none;
    border: 1px solid rgba(148, 167, 181, 0.22);
}

.auth__particles span:nth-child(4n) {
    background: rgba(225, 18, 28, 0.30);
}

.auth__particles span:nth-child(1)  { left:  6%; width: 14px; height: 14px; animation-duration: 26s; animation-delay:  0s; }
.auth__particles span:nth-child(2)  { left: 17%; width: 26px; height: 26px; animation-duration: 34s; animation-delay: -6s; }
.auth__particles span:nth-child(3)  { left: 28%; width: 18px; height: 18px; animation-duration: 30s; animation-delay: -14s; }
.auth__particles span:nth-child(4)  { left: 39%; width: 10px; height: 10px; animation-duration: 22s; animation-delay: -3s; }
.auth__particles span:nth-child(5)  { left: 51%; width: 22px; height: 22px; animation-duration: 38s; animation-delay: -19s; }
.auth__particles span:nth-child(6)  { left: 63%; width: 12px; height: 12px; animation-duration: 28s; animation-delay: -9s; }
.auth__particles span:nth-child(7)  { left: 74%; width: 30px; height: 30px; animation-duration: 42s; animation-delay: -24s; }
.auth__particles span:nth-child(8)  { left: 84%; width: 16px; height: 16px; animation-duration: 32s; animation-delay: -12s; }
.auth__particles span:nth-child(9)  { left: 92%; width: 20px; height: 20px; animation-duration: 36s; animation-delay: -30s; }
.auth__particles span:nth-child(10) { left: 45%; width: 14px; height: 14px; animation-duration: 24s; animation-delay: -17s; }

@keyframes auth-float {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }
    12% { opacity: 1; }
    88% { opacity: 1; }
    100% {
        transform: translateY(-108vh) rotate(220deg);
        opacity: 0;
    }
}

/* Respeita quem prefere menos movimento */
@media (prefers-reduced-motion: reduce) {
    .auth__brand::before,
    .auth__brand::after,
    .auth__particles span {
        animation: none;
    }
    .auth__particles { display: none; }
}

/* Wordmark em texto: reproduz o logotipo com o "In" no vermelho da marca e o
   restante em branco. O PNG original tem o "Stock" em azul-ardosia escuro, que
   sumiria neste fundo — e um filtro CSS nao consegue recolorir so uma parte. */
.auth__logo {
    align-self: center;
    margin-bottom: clamp(64px, 17vh, 170px);
    text-align: center;
    line-height: 1;
    user-select: none;
}

.auth__logo-main {
    display: block;
    font-size: clamp(38px, 4.6vw, 58px);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
}

.auth__logo-main em {
    font-style: normal;
    color: var(--brand-red);
}

.auth__logo-sub {
    display: block;
    margin-top: 6px;
    font-size: clamp(11px, 1.15vw, 15px);
    font-weight: 500;
    letter-spacing: 0.3em;
    text-indent: 0.3em;
    text-transform: uppercase;
    color: var(--slate-300);
}

.auth__tagline {
    max-width: 26ch;
    /* Cor explicita: theme.css define uma cor escura para h1-h4 e a heranca
       do painel escuro nao venceria essa regra. */
    color: var(--text-on-dark);
    font-size: clamp(26px, 3vw, 36px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.auth__tagline em {
    font-style: normal;
    color: var(--brand-red);
}

.auth__brand p {
    max-width: 42ch;
    margin: 0;
    font-size: var(--fs-md);
    line-height: 1.6;
    color: rgba(238, 244, 247, 0.62);
}

.auth__meta {
    margin-top: auto;
    padding-top: var(--sp-8);
    font-size: var(--fs-xs);
    color: rgba(238, 244, 247, 0.38);
}

/* --------------------------------------------------------------------------
   Painel do formulario
   -------------------------------------------------------------------------- */

.auth__panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-10) var(--sp-6);
    background: var(--surface);
}

.auth__footer {
    position: absolute;
    bottom: var(--sp-6);
    left: var(--sp-6);
    right: var(--sp-6);
    text-align: center;
    font-size: var(--fs-xs);
    color: var(--text-faint);
}

.auth__footer a {
    color: var(--text-muted);
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition);
}

.auth__footer a:hover {
    color: var(--brand-red);
    text-decoration: underline;
}

.auth__form {
    width: 100%;
    max-width: 380px;
}

.auth__mobile-logo {
    display: none;
    width: 132px;
    margin: 0 auto var(--sp-6);
}

.auth__title {
    font-size: var(--fs-xl);
    margin-bottom: var(--sp-2);
    color: var(--brand-red);
}

.auth__subtitle {
    margin: 0 0 var(--sp-8);
    color: var(--text-muted);
    font-size: var(--fs-base);
}

.auth__field {
    margin-bottom: var(--sp-4);
}

.auth__field label {
    display: block;
    margin-bottom: 6px;
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text-muted);
}

.auth__input-wrap {
    position: relative;
}

.auth__input-wrap > i {
    position: absolute;
    top: 50%;
    left: 13px;
    transform: translateY(-50%);
    font-size: var(--fs-base);
    color: var(--text-faint);
    pointer-events: none;
    transition: color var(--transition);
}

.auth__form input[type="email"],
.auth__form input[type="password"],
.auth__form input[type="text"] {
    width: 100%;
    padding: 12px 14px 12px 40px;
    font-family: inherit;
    font-size: var(--fs-md);
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.auth__form input::placeholder { color: var(--text-faint); }

.auth__form input:focus {
    outline: none;
    border-color: var(--slate-500);
    box-shadow: 0 0 0 3px rgba(61, 113, 134, 0.15);
}

.auth__input-wrap:focus-within > i { color: var(--slate-500); }

.auth__form input.valid {
    border-color: var(--success);
}

/* Botao de revelar senha */
.auth__form input.auth__input--revealable { padding-right: 44px; }

.auth__reveal {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    font-size: var(--fs-base);
    color: var(--text-faint);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color var(--transition), background-color var(--transition);
}

.auth__reveal:hover {
    color: var(--slate-600);
    background: var(--slate-050);
}

.auth__reveal:focus-visible {
    outline: 2px solid var(--slate-500);
    outline-offset: 1px;
}

.auth__reveal[aria-pressed="true"] { color: var(--brand-red); }

.auth__submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: var(--sp-2);
    padding: 12px;
    font-family: inherit;
    font-size: var(--fs-md);
    font-weight: 500;
    color: #fff;
    background: var(--brand-red);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color var(--transition), box-shadow var(--transition);
}

.auth__submit:hover {
    background: var(--brand-red-dark);
    box-shadow: 0 4px 12px rgba(225, 18, 28, 0.25);
}

.auth__submit:focus-visible {
    outline: 2px solid var(--slate-500);
    outline-offset: 2px;
}

/* Estado de carregando, ativado no submit */
.auth__submit:disabled {
    cursor: progress;
    background: var(--brand-red-dark);
    box-shadow: none;
}

.auth__spinner {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin 700ms linear infinite;
}

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

.auth__link {
    display: inline-block;
    margin-top: var(--sp-5);
    font-size: var(--fs-sm);
    color: var(--slate-500);
    text-decoration: none;
    transition: color var(--transition);
}

.auth__link:hover {
    color: var(--brand-red);
    text-decoration: underline;
}

/* Mensagem de erro / retorno */
.auth__message {
    display: none;
    align-items: flex-start;
    gap: var(--sp-2);
    margin-top: var(--sp-5);
    padding: 10px 14px;
    font-size: var(--fs-sm);
    border-radius: var(--radius);
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(198, 40, 40, 0.2);
}

.auth__message:not(:empty) { display: flex; }

.auth__message--info {
    background: var(--info-soft);
    color: var(--info);
    border-color: rgba(31, 111, 151, 0.2);
}

/* --------------------------------------------------------------------------
   Responsivo
   -------------------------------------------------------------------------- */

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

    .auth__brand { display: none; }

    .auth__mobile-logo { display: block; }

    .auth__panel {
        min-height: 100vh;
        background: var(--canvas);
    }

    .auth__form {
        padding: var(--sp-8) var(--sp-6);
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow);
    }
}
