/* ============================================================
   SIAFIC AUTH — Paleta SigaMunicipal Portal
   Exclusivo para login.php e selecionar_contexto.php
   ============================================================ */

/* ── 1. Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.auth-page {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #030712;
    color: #f3f4f6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

@media (max-width: 1024px) {
    body.auth-page { overflow: auto; }
}

/* ── 2. Background Aurora — mesma estrutura de orbs do portal ── */
.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: radial-gradient(circle at center, #0a0f1c 0%, #030712 100%);
    overflow: hidden;
}

/* Orb 1 — azul (igual orb-1 do portal: rgba(29,78,216,0.4)) */
.auth-bg-orb-1 {
    position: absolute;
    top: -20%;
    left: -15%;
    width: 70%;
    height: 75%;
    background: radial-gradient(ellipse at center, rgba(29,78,216,.35) 0%, rgba(59,130,246,.12) 45%, transparent 70%);
    animation: orb-drift-a 25s ease-in-out infinite alternate;
    filter: blur(80px);
    pointer-events: none;
}

/* Orb 2 — verde esmeralda (igual orb-2 do portal: rgba(16,185,129,0.3)) */
.auth-bg-orb-2 {
    position: absolute;
    bottom: -25%;
    right: -10%;
    width: 60%;
    height: 70%;
    background: radial-gradient(ellipse at center, rgba(16,185,129,.28) 0%, rgba(5,150,105,.1) 50%, transparent 75%);
    animation: orb-drift-b 28s ease-in-out infinite alternate;
    filter: blur(80px);
    pointer-events: none;
}

/* Orb 3 — roxo (igual orb-3 do portal: rgba(139,92,246,0.3)) */
.auth-bg-orb-3 {
    position: absolute;
    top: 35%;
    left: 45%;
    width: 40%;
    height: 45%;
    background: radial-gradient(ellipse at center, rgba(139,92,246,.28) 0%, transparent 70%);
    animation: orb-pulse 32s ease-in-out infinite;
    filter: blur(80px);
    pointer-events: none;
}

@keyframes orb-drift-a {
    from { transform: translate(0,0) scale(1); }
    to   { transform: translate(8%,6%) scale(1.12); }
}
@keyframes orb-drift-b {
    from { transform: translate(0,0) scale(1); }
    to   { transform: translate(-6%,-8%) scale(1.18); }
}
@keyframes orb-pulse {
    0%,100% { opacity: .5; transform: scale(1); }
    50%      { opacity: .9; transform: scale(1.25); }
}

/* Grid de pontos sutil */
.auth-bg-grid {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,.06) 1px, transparent 1px);
    background-size: 36px 36px;
    opacity: .8;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
}

/* Noise/grain overlay */
.auth-bg-noise {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    opacity: .025;
    pointer-events: none;
}

/* ── 3. Layout Split ── */
.auth-layout {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
}

/* ── 4. Branding Panel (esquerda 58%) ── */
.auth-brand-panel {
    flex: 0 0 58%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3.5rem 5rem 3.5rem 5.5rem;
    position: relative;
    overflow: hidden;
}

/* Linha divisória direita — azul primário do portal */
.auth-brand-panel::after {
    content: '';
    position: absolute;
    right: 0; top: 8%; height: 84%;
    width: 1px;
    background: linear-gradient(to bottom, transparent, rgba(59,130,246,.2), rgba(14,165,233,.14), transparent);
}

/* Decorative rings — azul primário */
.auth-deco-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(59,130,246,.06);
    pointer-events: none;
}
.auth-deco-ring-1 { width: 500px; height: 500px; bottom: -180px; left: -120px; }
.auth-deco-ring-2 { width: 320px; height: 320px; bottom: -100px; left: -40px;  border-color: rgba(59,130,246,.04); }
.auth-deco-ring-3 { width: 160px; height: 160px; bottom: -30px;  left:  40px;  border-color: rgba(59,130,246,.08); }

/* Linha decorativa horizontal — azul primário */
.auth-brand-line {
    width: 48px; height: 2px;
    background: linear-gradient(90deg, #3b82f6, transparent);
    border-radius: 2px;
    margin-bottom: 2rem;
}

/* Logo wrap */
.auth-logo-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 1.25rem;
}

/* Raio/bolt — cor #00bfff do portal, com glow azul elétrico */
.auth-logo-bolt {
    filter: drop-shadow(0 0 18px rgba(0,191,255,.55));
    animation: bolt-glow 3s ease-in-out infinite alternate;
}

@keyframes bolt-glow {
    from { filter: drop-shadow(0 0 12px rgba(0,191,255,.4)); }
    to   { filter: drop-shadow(0 0 28px rgba(59,130,246,.8)); }
}

/* Wordmark SIAFIC — gradiente metálico igual à logo do portal */
.auth-logo-wordmark {
    font-size: 3.8rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    background: linear-gradient(140deg, #ffffff 0%, #b0c4de 50%, #4682b4 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.auth-logo-sub {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: rgba(59,130,246,.55);
    margin-bottom: 2.75rem;
}

.auth-headline {
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1.12;
    color: #f3f4f6;
    letter-spacing: -.025em;
    margin-bottom: 1rem;
}

/* Destaque em itálico — gradiente do texto do portal (#60a5fa → #a78bfa → #34d399) */
.auth-headline em {
    font-style: normal;
    background: linear-gradient(120deg, #60a5fa, #a78bfa, #34d399);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-description {
    font-size: .9rem;
    color: #9ca3af;
    line-height: 1.75;
    max-width: 460px;
    margin-bottom: 2.75rem;
    font-weight: 300;
}

/* Feature bullets — azul primário */
.auth-features {
    display: flex;
    flex-direction: column;
    gap: .85rem;
    margin-bottom: 3rem;
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: 14px;
}

.auth-feature-dot {
    width: 32px; height: 32px;
    border-radius: 9px;
    background: rgba(59,130,246,.1);
    border: 1px solid rgba(59,130,246,.2);
    display: flex; align-items: center; justify-content: center;
    color: #60a5fa;
    font-size: .9rem;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(59,130,246,.08);
}

.auth-feature-body strong {
    display: block;
    font-size: .78rem;
    font-weight: 700;
    color: rgba(255,255,255,.8);
    margin-bottom: 1px;
    letter-spacing: .01em;
}

.auth-feature-body span {
    font-size: .72rem;
    color: #9ca3af;
    font-weight: 400;
}

/* Stats — azul primário */
.auth-stats {
    display: flex;
    gap: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,.05);
}

.auth-stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #3b82f6;
    line-height: 1;
    margin-bottom: 3px;
    letter-spacing: -.02em;
}

.auth-stat-label {
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #6b7280;
    font-weight: 600;
}

/* ── 5. Form Panel (direita 42%) ── */
.auth-form-panel {
    flex: 0 0 42%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 3rem;
    position: relative;
}

/* Glass Card — fundo do portal rgba(17,24,39,0.4) com borda azul */
.auth-card {
    width: 100%;
    max-width: 400px;
    background: rgba(17,24,39,.55);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(59,130,246,.15);
    border-radius: 24px;
    padding: 2.5rem 2.25rem;
    box-shadow:
        0 0 0 1px rgba(255,255,255,.03),
        0 30px 70px rgba(0,0,0,.45),
        0 0 80px rgba(59,130,246,.04),
        inset 0 1px 0 rgba(255,255,255,.05),
        inset 0 -1px 0 rgba(0,0,0,.15);
    position: relative;
    opacity: 0;
    transform: translateY(22px);
    animation: card-enter .8s cubic-bezier(.16,1,.3,1) .1s forwards;
}

/* Glow linha topo — azul (cor primary do portal) */
.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 15%; right: 15%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(96,165,250,.35), transparent);
    border-radius: 100%;
}

@keyframes card-enter {
    to { opacity: 1; transform: translateY(0); }
}

/* Card header — ícone azul */
.auth-card-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: rgba(59,130,246,.12);
    border: 1px solid rgba(59,130,246,.22);
    display: flex; align-items: center; justify-content: center;
    color: #3b82f6;
    font-size: 1.15rem;
    margin-bottom: 1.2rem;
    box-shadow: 0 0 18px rgba(59,130,246,.12);
}

.auth-card-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: .3rem;
    letter-spacing: -.015em;
}

.auth-card-subtitle {
    font-size: .68rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-weight: 600;
    margin-bottom: 1.85rem;
}

/* Divider */
.auth-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
    margin: 1.4rem 0;
}

/* Alert erro */
.auth-alert {
    padding: .8rem 1rem;
    background: rgba(239,68,68,.08);
    border: 1px solid rgba(239,68,68,.2);
    border-radius: 10px;
    color: #fca5a5;
    font-size: .78rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1.2rem;
    animation: shake .35s ease;
}

@keyframes shake {
    0%,100% { transform: translateX(0); }
    25%      { transform: translateX(-4px); }
    75%      { transform: translateX(4px); }
}

/* Form groups */
.auth-form-group { margin-bottom: 1rem; }

.auth-label {
    display: block;
    font-size: .65rem;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .09em;
    margin-bottom: 5px;
}

/* Inputs */
.auth-input {
    width: 100%;
    padding: 10px 13px;
    background: rgba(3,7,18,.6);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    color: #f3f4f6;
    font-size: .875rem;
    font-family: inherit;
    transition: all .25s ease;
    outline: none;
}

.auth-input:focus {
    border-color: rgba(59,130,246,.45);
    background: rgba(59,130,246,.04);
    box-shadow: 0 0 0 3px rgba(59,130,246,.12), 0 0 18px rgba(59,130,246,.08);
}

.auth-input::placeholder {
    color: #6b7280;
    font-size: .82rem;
}

.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #f3f4f6 !important;
    -webkit-box-shadow: 0 0 0px 1000px #111827 inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Select — seta azul (cor secondary do portal) */
select.auth-input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(96,165,250,.6)'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 1em;
    padding-right: 2.25rem;
    cursor: pointer;
}

select.auth-input:disabled {
    opacity: .35;
    cursor: not-allowed;
}

select.auth-input option {
    background: #111827;
    color: #f3f4f6;
}

/* ── BOTÃO PRINCIPAL — gradiente btn-premium do portal ── */
@keyframes btn-aurora {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes btn-glow-pulse {
    0%, 100% { box-shadow: 0 4px 18px rgba(29,78,216,.5), 0 0 32px rgba(109,40,217,.25); }
    50%       { box-shadow: 0 4px 28px rgba(29,78,216,.75), 0 0 52px rgba(109,40,217,.45); }
}

.btn-auth-primary {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(to right, #1d4ed8, #6d28d9, #2d6a4f);
    background-size: 250% 100%;
    background-position: 0% 50%;
    border: 1px solid rgba(109,40,217,.35);
    border-radius: 12px;
    color: #ffffff;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    position: relative;
    overflow: hidden;
    margin-top: .5rem;
    animation: btn-aurora 5s ease infinite, btn-glow-pulse 3s ease-in-out infinite;
    transition: transform .2s ease, filter .2s ease;
}

/* Shimmer on hover */
.btn-auth-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 25%, rgba(255,255,255,.18) 50%, transparent 75%);
    transform: translateX(-130%);
    transition: transform .5s ease;
    pointer-events: none;
}
.btn-auth-primary:hover::before { transform: translateX(130%); }

.btn-auth-primary:hover {
    background-position: 100% 50%;
    transform: translateY(-2px);
    filter: brightness(1.18) saturate(1.2);
    animation-play-state: paused;
}

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

.btn-auth-primary:disabled {
    opacity: .35;
    cursor: not-allowed;
    transform: none !important;
    pointer-events: none;
    animation: none;
}

/* ── User block ── */
.auth-user-block {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    background: rgba(3,7,18,.5);
    border: 1px solid rgba(59,130,246,.12);
    border-radius: 12px;
    margin-bottom: 1.4rem;
}

.auth-user-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: rgba(59,130,246,.14);
    border: 1px solid rgba(59,130,246,.22);
    display: flex; align-items: center; justify-content: center;
    color: #3b82f6;
    font-size: 1rem;
    flex-shrink: 0;
}

.auth-user-name {
    font-size: .84rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.2;
}

.auth-user-login {
    font-size: .65rem;
    color: #6b7280;
    font-family: monospace;
    letter-spacing: .05em;
}

/* ── Link sair ── */
.auth-link-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: .72rem;
    color: #6b7280;
    text-decoration: none;
    padding: .6rem;
    transition: color .2s;
    margin-top: .25rem;
}
.auth-link-logout:hover { color: rgba(239,68,68,.7); }

/* ── Footer rodapé ── */
.auth-page-footer {
    position: absolute;
    bottom: 1.25rem;
    left: 0; right: 0;
    text-align: center;
    font-size: .6rem;
    color: #6b7280;
    letter-spacing: .08em;
    text-transform: uppercase;
    pointer-events: none;
}

/* ── Loading overlay ── */
.auth-loading {
    position: fixed;
    inset: 0;
    background: rgba(3,7,18,.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 9999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

/* Ring loader — azul primário */
.auth-loader-ring {
    width: 52px; height: 52px;
    border: 2px solid rgba(59,130,246,.12);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin-blue .75s linear infinite;
    box-shadow: 0 0 20px rgba(59,130,246,.2);
}

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

.auth-loader-logo {
    display: flex; align-items: center; gap: 10px;
    filter: drop-shadow(0 0 12px rgba(0,191,255,.4));
}

/* Wordmark loader — gradiente metálico do portal */
.auth-loader-wordmark {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -.02em;
    background: linear-gradient(140deg, #ffffff 0%, #b0c4de 50%, #4682b4 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-loader-text {
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .28em;
    color: rgba(96,165,250,.7);
    font-weight: 700;
}

/* ── Partículas — azul elétrico do portal ── */
.auth-particle {
    position: fixed;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59,130,246,.35), transparent 70%);
    animation: particle-rise linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes particle-rise {
    0%   { transform: translateY(0)   scale(0); opacity: 0; }
    8%   { opacity: 1; }
    85%  { opacity: .25; }
    100% { transform: translateY(-105vh) scale(1.2); opacity: 0; }
}

/* ── Mobile ── */
@media (max-width: 1024px) {
    .auth-brand-panel { display: none; }
    .auth-form-panel  { flex: 1; padding: 1.5rem; }
}

@media (max-width: 480px) {
    .auth-card { padding: 2rem 1.5rem; border-radius: 20px; }
    .auth-form-panel { padding: 1rem; }
}
