/*
 * FleetBuss Login — v2.043
 * Layout: Split-panel corporativo
 * Design System: AiA Soluções v1.0
 * Fontes: Sora (display) + Manrope (body)
 */

/* ============================================================
   TOKENS
   ============================================================ */
:root {
    --brand-primary:    #667eea;
    --brand-secondary:  #764ba2;
    --brand-gradient:   linear-gradient(160deg, #667eea 0%, #764ba2 100%);

    --module-color:       #f59e0b;
    --module-dark:        #92400e;
    --module-light:       rgba(245,158,11,.13);
    --module-border:      rgba(245,158,11,.38);

    --color-success:      #10b981;
    --color-danger:       #ef4444;
    --color-danger-light: #fee2e2;
    --color-danger-dark:  #991b1b;

    --neutral-50:   #f8f9fb;
    --neutral-100:  #f0f2f6;
    --neutral-200:  #e5e8ef;
    --neutral-400:  #9ba3b6;
    --neutral-600:  #4a5373;
    --neutral-800:  #1c2040;
    --neutral-900:  #10132a;

    --text-primary:   #1c2040;
    --text-secondary: #4a5373;
    --text-muted:     #9ba3b6;

    --border-subtle: #e5e8ef;
    --border-brand:  rgba(102,126,234,.28);
    --border-focus:  rgba(102,126,234,.55);

    --shadow-card:   0 24px 64px rgba(16,19,42,.18), 0 4px 16px rgba(16,19,42,.10);
    --shadow-brand:  0 4px 18px rgba(102,126,234,.30);
    --shadow-brand-lg: 0 8px 28px rgba(102,126,234,.42);

    --radius-sm:  8px;
    --radius-md:  12px;
    --radius-lg:  20px;
    --radius-xl:  28px;
    --radius-pill:999px;

    --font-display: 'Sora',    'Segoe UI', system-ui, sans-serif;
    --font-body:    'Manrope', 'Segoe UI', system-ui, sans-serif;

    --ease-out: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --ease-std: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

/* ============================================================
   BODY
   ============================================================ */
body {
    font-family: var(--font-body);
    background: var(--neutral-100);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Textura de fundo */
body::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 15% 50%, rgba(102,126,234,.10) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 20%, rgba(118,75,162,.10) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 90%, rgba(245,158,11,.06) 0%, transparent 50%);
    pointer-events: none;
}

/* Orbs decorativos */
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.45;
    animation: orb-drift 20s ease-in-out infinite alternate;
    pointer-events: none;
}
.orb--1 {
    width: 520px; height: 520px;
    background: radial-gradient(circle, rgba(102,126,234,.5) 0%, transparent 70%);
    top: -180px; left: -160px;
    animation-duration: 24s;
}
.orb--2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(118,75,162,.45) 0%, transparent 70%);
    bottom: -140px; right: -120px;
    animation-duration: 20s;
    animation-delay: -8s;
}

@keyframes orb-drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(30px, 20px) scale(1.06); }
}

/* ============================================================
   WRAPPER + CARD
   ============================================================ */
.login-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    display: flex;
    width: 100%;
    max-width: 820px;
    min-height: 520px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    animation: card-enter 0.65s var(--ease-out) both;
}

@keyframes card-enter {
    from { opacity: 0; transform: translateY(36px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================
   PAINEL ESQUERDO — MARCA
   ============================================================ */
.panel-brand {
    background: var(--brand-gradient);
    width: 42%;
    flex-shrink: 0;
    padding: 44px 36px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

/* Detalhe geométrico de fundo */
.panel-brand::before {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    background: rgba(255,255,255,.06);
    border-radius: 50%;
    bottom: -100px; right: -100px;
    pointer-events: none;
}
.panel-brand::after {
    content: '';
    position: absolute;
    width: 180px; height: 180px;
    background: rgba(255,255,255,.05);
    border-radius: 50%;
    top: -60px; left: -60px;
    pointer-events: none;
}

/* Topo do painel */
.brand-top { position: relative; z-index: 1; }

.brand-icon {
    width: 60px; height: 60px;
    background: rgba(255,255,255,.18);
    border: 1.5px solid rgba(255,255,255,.35);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 20px;
    animation: icon-pop 0.5s var(--ease-out) 0.2s both;
}

@keyframes icon-pop {
    from { opacity: 0; transform: scale(0.75) rotate(-8deg); }
    to   { opacity: 1; transform: scale(1) rotate(0); }
}

.brand-name {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -1px;
    line-height: 1;
    margin-bottom: 10px;
}

.brand-tagline {
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: rgba(255,255,255,.70);
    font-weight: 400;
    line-height: 1.55;
}

/* Features list */
.brand-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    color: rgba(255,255,255,.80);
    font-weight: 500;
    animation: fade-in-left 0.5s var(--ease-std) both;
}

.feature-item:nth-child(1) { animation-delay: 0.25s; }
.feature-item:nth-child(2) { animation-delay: 0.35s; }
.feature-item:nth-child(3) { animation-delay: 0.45s; }

@keyframes fade-in-left {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}

.feature-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--module-color);
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(245,158,11,.6);
}

/* Rodapé do painel */
.brand-bottom {
    position: relative;
    z-index: 1;
}

.brand-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.pill-version,
.pill-module {
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
}

.pill-version {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.25);
    color: rgba(255,255,255,.9);
}

.pill-module {
    background: rgba(245,158,11,.22);
    border: 1px solid rgba(245,158,11,.45);
    color: #fcd34d;
}

.brand-licensee {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: rgba(255,255,255,.45);
    font-weight: 500;
}

/* ============================================================
   PAINEL DIREITO — FORMULÁRIO
   ============================================================ */
.panel-form {
    flex: 1;
    background: #fff;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Stripe multicolor (assinatura AiA) */
.form-stripe {
    height: 4px;
    background: linear-gradient(90deg,
        var(--color-success) 0%,
        var(--brand-primary) 30%,
        var(--brand-secondary) 60%,
        var(--module-color) 80%,
        var(--color-danger) 100%
    );
    flex-shrink: 0;
}

.form-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px 44px 36px;
    animation: form-enter 0.55s var(--ease-std) 0.15s both;
}

@keyframes form-enter {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Header do form */
.form-header { margin-bottom: 28px; }

.form-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.form-subtitle {
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Campos */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}

.form-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.form-label svg { color: var(--brand-primary); flex-shrink: 0; }

.form-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--neutral-50);
    outline: none;
    transition: border-color .18s var(--ease-std), box-shadow .18s var(--ease-std), background .18s var(--ease-std), transform .18s var(--ease-std);
    appearance: none;
    -webkit-appearance: none;
}

.form-input::placeholder { color: var(--text-muted); font-weight: 400; }
.form-input:hover  { border-color: var(--border-brand); background: #fff; }
.form-input:focus  {
    border-color: var(--brand-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(102,126,234,.11);
    transform: translateY(-1px);
}

.form-group.has-error .form-input {
    border-color: var(--color-danger);
    box-shadow: 0 0 0 3px rgba(239,68,68,.09);
    background: #fffafa;
}

.field-error {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-danger);
    min-height: 1rem;
}

/* Wrap senha */
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .form-input { padding-right: 44px; }

.btn-toggle-pass {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color .15s;
    line-height: 0;
}
.btn-toggle-pass:hover { color: var(--brand-primary); }
.btn-toggle-pass:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

/* Alerta de erro global */
.alert-error {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    background: var(--color-danger-light);
    border: 1px solid rgba(239,68,68,.22);
    color: var(--color-danger-dark);
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 18px;
    animation: alert-in .22s var(--ease-std);
}
.alert-error[hidden] { display: none; }
.alert-error svg { flex-shrink: 0; margin-top: 1px; }

@keyframes alert-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Botão de login */
.btn-login {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--brand-gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    cursor: pointer;
    box-shadow: var(--shadow-brand);
    transition: transform .22s var(--ease-out), box-shadow .22s var(--ease-std), filter .22s var(--ease-std);
    margin-top: 4px;
    position: relative;
    overflow: hidden;
}

.btn-login::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background .15s;
}
.btn-login:hover:not(:disabled)::before { background: rgba(255,255,255,.08); }
.btn-login:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-brand-lg);
    filter: brightness(1.05);
}
.btn-login:active:not(:disabled) { transform: translateY(0); box-shadow: var(--shadow-brand); }
.btn-login:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-arrow { transition: transform .15s var(--ease-std); flex-shrink: 0; }
.btn-login:hover:not(:disabled) .btn-arrow { transform: translateX(3px); }

.btn-spinner {
    display: none;
    width: 17px; height: 17px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .75s linear infinite;
    flex-shrink: 0;
}
.btn-login.is-loading .btn-spinner { display: block; }
.btn-login.is-loading .btn-arrow   { display: none; }

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

/* Rodapé do form */
.form-footer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.form-footer p {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-footer strong {
    font-weight: 700;
    color: var(--brand-primary);
}

/* ============================================================
   ACESSIBILIDADE
   ============================================================ */
*:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
    border-radius: 3px;
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   RESPONSIVIDADE
   ============================================================ */

/* Tablet — painel esquerdo menor */
@media (max-width: 780px) {
    .login-card { max-width: 480px; flex-direction: column; min-height: auto; }

    .panel-brand {
        width: 100%;
        padding: 28px 32px;
        flex-direction: row;
        align-items: center;
        gap: 20px;
        flex-wrap: wrap;
    }

    .panel-brand::before,
    .panel-brand::after { display: none; }

    .brand-top {
        display: flex;
        align-items: center;
        gap: 14px;
    }

    .brand-icon { margin-bottom: 0; width: 48px; height: 48px; flex-shrink: 0; }
    .brand-name { font-size: 1.6rem; }
    .brand-tagline { font-size: 0.8125rem; }
    .brand-features { display: none; }

    .brand-bottom {
        margin-left: auto;
        text-align: right;
    }

    .form-inner { padding: 28px 32px 32px; }
}

/* Mobile */
@media (max-width: 520px) {
    body { padding: 12px; }

    .login-card { border-radius: var(--radius-lg); }

    .panel-brand { padding: 22px 24px; }
    .brand-name  { font-size: 1.4rem; }

    .form-inner   { padding: 22px 24px 28px; }
    .form-title   { font-size: 1.25rem; }

    .form-input { padding: 11px 13px; font-size: 1rem; }
    .btn-login  { padding: 13px 20px; font-size: 1rem; }
}

@media (max-width: 380px) {
    .panel-brand { flex-direction: column; align-items: flex-start; gap: 10px; }
    .brand-bottom { margin-left: 0; text-align: left; }
}

/* ============================================================
   LOGO FLEETBUSS
   ============================================================ */
.brand-logo-wrap {
    margin-bottom: 20px;
    animation: icon-pop 0.5s var(--ease-out) 0.2s both;
}
.brand-logo {
    width: 180px;
    height: auto;
    display: block;
    mix-blend-mode: screen;
    filter: brightness(1.1) contrast(1.05);
}
@media (max-width: 780px) {
    .brand-logo-wrap { margin-bottom: 0; }
    .brand-logo { width: 130px; }
}
@media (max-width: 520px) {
    .brand-logo { width: 110px; }
}

/* ============================================================
   CENA DE IA — CANVAS + PARTÍCULAS SVG
   ============================================================ */
.ai-scene {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

/* Canvas da rede neural — ocupa toda a tela */
#neural-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.55;
}

/* ── Partículas SVG flutuantes ── */
.ai-particle {
    position: absolute;
    pointer-events: none;
    will-change: transform, opacity;
    color: var(--brand-primary);
    opacity: 0;
}

/* Pulso de dado — ondas circulares */
.ap--pulse-1 {
    width: 90px; height: 90px;
    top: 8%; left: 6%;
    color: var(--brand-primary);
    animation: ap-fade-in .8s ease 1s both,
               ap-float-1 22s ease-in-out infinite alternate;
}
.ap--pulse-2 {
    width: 60px; height: 60px;
    bottom: 18%; right: 8%;
    color: var(--brand-secondary);
    animation: ap-fade-in .8s ease 1.4s both,
               ap-float-2 18s ease-in-out infinite alternate;
}
.ap--pulse-3 {
    width: 44px; height: 44px;
    top: 55%; left: 12%;
    color: var(--brand-primary);
    animation: ap-fade-in .8s ease 1.8s both,
               ap-float-3 26s ease-in-out infinite alternate;
}

/* Hexágono IA */
.ap--hex-1 {
    width: 80px; height: 80px;
    top: 20%; right: 5%;
    color: var(--brand-secondary);
    animation: ap-fade-in .8s ease .8s both,
               ap-spin-slow 35s linear infinite,
               ap-float-1 20s ease-in-out infinite alternate;
}
.ap--hex-2 {
    width: 50px; height: 50px;
    bottom: 10%; left: 20%;
    color: var(--brand-primary);
    animation: ap-fade-in .8s ease 1.6s both,
               ap-spin-slow 28s linear infinite reverse,
               ap-float-3 24s ease-in-out infinite alternate;
}

/* Losango / diamante */
.ap--diamond-1 {
    width: 55px; height: 55px;
    top: 3%; right: 25%;
    color: var(--brand-primary);
    animation: ap-fade-in .8s ease 1.1s both,
               ap-float-2 20s ease-in-out infinite alternate;
}
.ap--diamond-2 {
    width: 36px; height: 36px;
    bottom: 30%; right: 18%;
    color: var(--brand-secondary);
    animation: ap-fade-in .8s ease 2s both,
               ap-float-1 15s ease-in-out infinite alternate;
}

/* Símbolo de circuito / nó */
.ap--node-1 {
    width: 70px; height: 70px;
    top: 68%; right: 28%;
    color: var(--brand-primary);
    animation: ap-fade-in .8s ease 1.3s both,
               ap-float-3 19s ease-in-out infinite alternate;
}
.ap--node-2 {
    width: 45px; height: 45px;
    top: 12%; left: 30%;
    color: var(--brand-secondary);
    animation: ap-fade-in .8s ease .6s both,
               ap-float-2 23s ease-in-out infinite alternate;
}

/* ── Keyframes ── */
@keyframes ap-fade-in {
    from { opacity: 0; transform: scale(0.7); }
    to   { opacity: 0.07; }
}
@keyframes ap-float-1 {
    from { transform: translate(0, 0) rotate(0deg); }
    to   { transform: translate(22px, -16px) rotate(12deg); }
}
@keyframes ap-float-2 {
    from { transform: translate(0, 0) rotate(0deg); }
    to   { transform: translate(-18px, 20px) rotate(-10deg); }
}
@keyframes ap-float-3 {
    from { transform: translate(0, 0) rotate(0deg); }
    to   { transform: translate(14px, 24px) rotate(8deg); }
}
@keyframes ap-spin-slow {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.login-wrapper { z-index: 1; }

@media (prefers-reduced-motion: reduce) {
    .ai-particle, #neural-canvas { animation: none !important; opacity: 0.04 !important; }
}
