/* ============================================================
   Login / Auth — Layout split moderno (logo solta, sem círculo)
   ============================================================ */

:root {
    --auth-magenta: #E5326E;
    --auth-magenta-dark: #c12a5b;
    --auth-magenta-light: #FCE5EC;
    /* Verde da logomarca da prefeitura — sage green */
    --auth-cyan: #5DAB8E;
    --auth-cyan-dark: #3E8167;
    --auth-cyan-light: #E3F2EB;
    --auth-ink: #0F172A;
    --auth-muted: #64748B;
    --auth-muted-light: #94A3B8;
    --auth-line: #E2E8F0;
    --auth-bg: #F7F8FA;
    --auth-paper: #FFFFFF;
    --auth-success: #16A34A;
    --auth-success-light: #F0FDF4;
    --auth-danger: #DC2626;
    --auth-danger-light: #FEF2F2;
}

/* Reset / globals */
.auth-body {
    display: grid;
    grid-template-columns: 5fr 6fr;
    min-height: 100vh;
    background: var(--auth-bg);
    font-family: 'Manrope', system-ui, -apple-system, sans-serif;
    color: var(--auth-ink);
    margin: 0;
}

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

/* ============================================================
   Painel lateral (esquerda) — só desktop
   ============================================================ */
.auth-side {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background:
        radial-gradient(circle at 25% 25%, rgba(229, 50, 110, 0.95), rgba(229, 50, 110, 0) 55%),
        radial-gradient(circle at 80% 75%, rgba(93, 171, 142, 0.55), rgba(93, 171, 142, 0) 50%),
        linear-gradient(135deg, #1a0d18 0%, #2d1226 40%, #1a2e22 100%);
    color: #fff;
    padding: 3rem;
}

/* Padrão decorativo de pontos */
.auth-side::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255,255,255,0.10) 1px, transparent 0);
    background-size: 28px 28px;
    opacity: 0.5;
    pointer-events: none;
}

/* Linhas diagonais sutis */
.auth-side::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: linear-gradient(135deg,
        transparent 0%,
        transparent 49.5%,
        rgba(255,255,255,0.04) 50%,
        rgba(255,255,255,0.04) 50.5%,
        transparent 51%,
        transparent 100%);
    background-size: 100px 100px;
    opacity: 0.6;
    pointer-events: none;
}

.auth-side-inner {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 420px;
    width: 100%;
}

/* Logo solta — sem círculo, com sombra/brilho */
.auth-side-logo {
    width: 110px;
    height: auto;
    object-fit: contain;
    margin-bottom: 1.25rem;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.4));
}

.auth-side-title {
    font-size: 30px;
    font-weight: 800;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
    line-height: 1.15;
    text-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.auth-side-municipio {
    font-size: 15px;
    margin: 0;
    opacity: 0.85;
    font-weight: 500;
}

.auth-side-divider {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    margin: 1.75rem auto;
}

/* Box de "Acesso Restrito" */
.auth-side-info {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 1.25rem;
    backdrop-filter: blur(12px);
    text-align: center;
}

.auth-side-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 10px;
    border: 1px solid rgba(255,255,255,0.2);
}

.auth-side-info p {
    font-size: 13.5px;
    line-height: 1.55;
    margin: 0;
    opacity: 0.92;
}

/* Box de redirecionamento pra portal público */
.auth-side-redirect {
    margin-top: 1.5rem;
    text-align: center;
}

.auth-side-redirect-label {
    font-size: 12.5px;
    margin: 0 0 8px;
    opacity: 0.75;
}

.auth-side-redirect-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--auth-cyan);
    color: #fff;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
    box-shadow: 0 4px 12px rgba(93, 171, 142, 0.4);
}
.auth-side-redirect-link:hover {
    background: var(--auth-cyan-dark);
    transform: translateY(-1px);
}

@media (max-width: 980px) {
    .auth-side { display: none; }
}

/* ============================================================
   Card principal (direita)
   ============================================================ */
.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    background: var(--auth-paper);
    border-radius: 18px;
    box-shadow:
        0 25px 60px rgba(15, 23, 42, 0.08),
        0 8px 18px rgba(15, 23, 42, 0.04);
    padding: 2.25rem 2rem;
    width: 100%;
    max-width: 460px;
    border: 1px solid var(--auth-line);
    animation: authFadeUp 0.4s ease-out;
}

@media (max-width: 480px) {
    .auth-card { padding: 1.75rem 1.25rem; border-radius: 14px; }
}

/* ============================================================
   Header do card (logo + badge restrita)
   ============================================================ */
.auth-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--auth-line);
}

.auth-logo-link {
    flex-shrink: 0;
    display: inline-block;
    transition: transform 0.15s ease;
}
.auth-logo-link:hover { transform: scale(1.05); }

/* Logo SOLTA — sem círculo */
.auth-logo-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    display: block;
}

.auth-header-text {
    flex: 1;
    min-width: 0;
}

.auth-restrita-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--auth-magenta-light);
    color: var(--auth-magenta);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.auth-municipio {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    color: var(--auth-ink);
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.auth-header-text p {
    font-size: 12.5px;
    color: var(--auth-muted);
    margin: 2px 0 0;
}

/* ============================================================
   Form header (título contextual da página)
   ============================================================ */
.auth-form-header {
    margin-bottom: 1.5rem;
}

.auth-form-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--auth-ink);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.auth-form-title svg { color: var(--auth-magenta); }

.auth-form-subtitle {
    font-size: 13.5px;
    color: var(--auth-muted);
    margin: 0;
    line-height: 1.55;
}

/* ============================================================
   Form
   ============================================================ */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.auth-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-form label {
    font-size: 13px;
    font-weight: 600;
    color: var(--auth-ink);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.auth-form label svg { color: var(--auth-muted-light); }

.auth-form .form-input {
    width: 100%;
    border: 1.5px solid var(--auth-line);
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 14.5px;
    background: var(--auth-paper);
    color: var(--auth-ink);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    font-family: inherit;
    box-sizing: border-box;
}
.auth-form .form-input::placeholder { color: var(--auth-muted-light); }
.auth-form .form-input:focus {
    outline: none;
    border-color: var(--auth-magenta);
    box-shadow: 0 0 0 4px rgba(229, 50, 110, 0.12);
}
.auth-form .form-input:hover:not(:focus) {
    border-color: var(--auth-muted-light);
}

.input-password-wrapper {
    position: relative;
    display: flex;
}
.input-password-wrapper .form-input {
    padding-right: 44px;
}
.btn-toggle-password {
    position: absolute;
    right: 6px; top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 8px;
    color: var(--auth-muted);
    border-radius: 6px;
    display: inline-flex;
    transition: color 0.15s, background 0.15s;
}
.btn-toggle-password:hover {
    color: var(--auth-magenta);
    background: rgba(229, 50, 110, 0.06);
}

/* Checkbox de termos */
.form-group-checkbox { padding-top: 4px; }
.checkbox-label {
    display: flex !important;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font-size: 13px !important;
    line-height: 1.5;
    color: var(--auth-muted) !important;
    font-weight: 400 !important;
}
.checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
    accent-color: var(--auth-magenta);
}
.checkbox-label a {
    color: var(--auth-magenta);
    text-decoration: none;
    font-weight: 600;
}
.checkbox-label a:hover { text-decoration: underline; }

/* ============================================================
   Botão principal
   ============================================================ */
.auth-submit {
    width: 100%;
    margin-top: 6px;
    background: var(--auth-magenta);
    color: #fff;
    border: 0;
    border-radius: 10px;
    padding: 13px 18px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 4px 14px rgba(229, 50, 110, 0.3);
    font-family: inherit;
}
.auth-submit:hover {
    background: var(--auth-magenta-dark);
    box-shadow: 0 6px 20px rgba(229, 50, 110, 0.4);
}
.auth-submit:active { transform: scale(0.985); }
.auth-submit:focus-visible {
    outline: 3px solid var(--auth-magenta-light);
    outline-offset: 2px;
}

/* ============================================================
   Alerts (erro / sucesso)
   ============================================================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    line-height: 1.5;
    margin-bottom: 1rem;
}
.alert svg { flex-shrink: 0; margin-top: 2px; }
.alert-error {
    background: var(--auth-danger-light);
    color: #991B1B;
    border: 1px solid #FECACA;
}
.alert-success {
    background: var(--auth-success-light);
    color: #15803D;
    border: 1px solid #BBF7D0;
}

/* Box informativo (não é erro nem sucesso) */
.auth-info-box {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: #F0F9FF;
    color: #0369A1;
    border: 1px solid #BAE6FD;
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.5;
    margin-top: 1rem;
}
.auth-info-box svg { flex-shrink: 0; margin-top: 1px; }

/* ============================================================
   Links extras (esqueci senha / criar conta / voltar)
   ============================================================ */
.auth-links {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}
.auth-links a {
    color: var(--auth-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.auth-links a:hover {
    color: var(--auth-magenta);
    background: rgba(229, 50, 110, 0.06);
}
.auth-links-separator {
    color: var(--auth-line);
    font-weight: 700;
}

/* Footer do card: voltar ao portal público */
.auth-footer {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--auth-line);
    text-align: center;
}
.auth-back-portal {
    color: var(--auth-cyan);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.15s;
}
.auth-back-portal:hover {
    background: rgba(93, 171, 142, 0.1);
}

/* ============================================================
   Animação suave de entrada
   ============================================================ */
@keyframes authFadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card { animation: none; }
}

/* ============================================================
   Password strength meter (cadastro)
   ============================================================ */
.password-strength {
    height: 4px;
    background: var(--auth-line);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
    position: relative;
}
.password-strength::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 0;
    background: var(--auth-danger);
    transition: width 0.25s, background 0.25s;
    border-radius: 2px;
}
.password-strength[data-strength="1"]::before { width: 25%; background: #DC2626; }
.password-strength[data-strength="2"]::before { width: 50%; background: #F59E0B; }
.password-strength[data-strength="3"]::before { width: 75%; background: #5DAB8E; }

/* ============================================================
   Tela "Aguardando liberação"
   ============================================================ */
.auth-aguardando-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px; height: 72px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: var(--auth-magenta-light);
    color: var(--auth-magenta);
    animation: authPulse 2s ease-in-out infinite;
}
@keyframes authPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(229, 50, 110, 0.3); }
    50%      { box-shadow: 0 0 0 12px rgba(229, 50, 110, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .auth-aguardando-icon { animation: none; }
}

.auth-aguardando-info {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 1.5rem;
}

.auth-aguardando-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px;
    background: #F8FAFC;
    border: 1px solid var(--auth-line);
    border-radius: 10px;
    transition: border-color 0.15s, background 0.15s;
}
.auth-aguardando-step:hover {
    border-color: var(--auth-cyan);
    background: var(--auth-cyan-light);
}
.auth-aguardando-step-num {
    flex-shrink: 0;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--auth-cyan);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}
.auth-aguardando-step strong {
    font-size: 13.5px;
    color: var(--auth-ink);
    font-weight: 700;
    display: block;
    margin-bottom: 3px;
}
.auth-aguardando-step p {
    font-size: 12.5px;
    color: var(--auth-muted);
    margin: 0;
    line-height: 1.5;
}

/* Botão secundário (sair) */
.auth-submit--secondary {
    background: var(--auth-paper) !important;
    color: var(--auth-ink) !important;
    border: 1.5px solid var(--auth-line) !important;
    box-shadow: none !important;
}
.auth-submit--secondary:hover {
    background: #F8FAFC !important;
    border-color: var(--auth-magenta) !important;
    color: var(--auth-magenta) !important;
}
.password-strength[data-strength="4"]::before { width: 100%; background: #16A34A; }
