/* ==============================================================================
 * Portal Innovati — base.css (Fase 3, itens 1 e 2)
 * Núcleo de estilos compartilhado pelos 20 templates. Cada template mantém em
 * seu <style> apenas o CSS específico da página; regras aqui presentes com o
 * MESMO seletor podem ser sobrescritas pelo template (o <style> vem depois).
 *
 * Fonte Outfit self-hosted (LGPD/VPN): variável (pesos 100–900), 2 arquivos
 * woff2 em /static/fonts/. Substitui fonts.googleapis.com (removido do CSP).
 * ============================================================================== */

/* --- Fonte Outfit (variável) — font-display: swap evita FOIT --- */
@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/static/fonts/outfit-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/static/fonts/outfit-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Variáveis de tema (idênticas nos 20 templates) --- */
:root {
    --bg-color: #0b0f19;
    --card-bg: rgba(20, 26, 46, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent: #4f46e5;
    --accent-glow: rgba(79, 70, 229, 0.4);
    --danger: #ef4444;
    --success: #10b981;
}

/* --- Reset --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

/* --- Body base (fundo/cor comuns aos dois layouts) --- */
body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
}

/* Layout centrado (login, register, recuperação de senha, MFA, termos...) */
body.page-center {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Layout app (home, admin, systems, profile — header + main) */
body.page-app {
    display: flex;
    flex-direction: column;
}

/* ==============================================================================
 * NÚCLEO DO LAYOUT CENTRADO (canônico: login.html)
 * ============================================================================== */
.container {
    width: 100%;
    max-width: 440px;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.logo {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(to right, #818cf8, #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 30px;
}

.alert {
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    margin-bottom: 24px;
    text-align: left;
    border-left: 4px solid;
    animation: fadeIn 0.3s ease;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: #a7f3d0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn {
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
    background: #4338ca;
}

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

.footer-links {
    margin-top: 30px;
    font-size: 14px;
    color: var(--text-secondary);
}

.footer-links a {
    color: #818cf8;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #34d399;
}

.footer-links span {
    margin: 0 8px;
    opacity: 0.3;
}

/* ==============================================================================
 * NÚCLEO DO LAYOUT APP (canônico: home.html)
 * ============================================================================== */
header {
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-logo {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(to right, #818cf8, #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ------------------------------------------------------------------------
 * SELO DE VERSAO E AMBIENTE (PROD/DEV) — ao lado do logo.
 * CSS em classe, nao style="" inline: o CSP do portal e style-src 'self'
 * 'nonce-<n>' sem unsafe-inline, e o nonce so cobre <style>, nao atributos
 * style="" inline (que ficariam bloqueados, sem estilo nenhum).
 * ------------------------------------------------------------------------ */
.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.env-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 3px 8px;
    border-radius: 6px;
    line-height: 1.4;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.env-badge--prod {
    background: rgba(16, 185, 129, 0.18);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.4);
}

.env-badge--dev {
    background: rgba(251, 146, 60, 0.18);
    color: #fdba74;
    border-color: rgba(251, 146, 60, 0.4);
}

.env-badge--unknown {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.5);
}

/* Fileira de selos nas paginas de auth (login, registro, MFA...), abaixo do .logo */
.env-badge-row {
    margin-bottom: 8px;
    display: flex;
    justify-content: center;
    gap: 6px;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--text-primary);
}

.btn-logout {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-logout:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

main {
    flex: 1;
    padding: 40px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* ==============================================================================
 * TABELAS RESPONSIVAS (Fase 3, item 5) — envolver cada <table> em .table-wrap
 * ============================================================================== */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
