/* ==========================================================================
   Portal SMFO — folha unica (login + hub + paginas internas)
   Base visual: index2.html (card escuro sobre fundo animado).
   ========================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --azul:        #0284c7;
    --azul-escuro: #0369a1;
    --azul-claro:  #38bdf8;
    --noite:       #0f172a;
    --tinta:       #1e293b;
    --texto:       #334155;
    --suave:       #64748b;
    --borda:       #e2e8f0;
    --fundo:       #f1f5f9;
    --erro:        #b91c1c;
    --ok:          #15803d;
}

html, body {
    width: 100%;
    min-height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--noite);
    color: var(--texto);
}

/* ==========================================================================
   1. FUNDO ANIMADO — comum ao login e ao hub
   ========================================================================== */

.bg-container {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 1;
}

.bg-image {
    width: 115%;
    height: 115%;
    object-fit: cover;
    position: absolute;
    top: -7.5%;
    left: -7.5%;
    opacity: 0.30;
    filter: blur(2px) contrast(1.1);
    animation: slowPan 25s ease-in-out infinite alternate;
}

@keyframes slowPan {
    0%   { transform: scale(1)    translate(0, 0); }
    50%  { transform: scale(1.08) translate(-1.5%, -1%); }
    100% { transform: scale(1.03) translate(1.5%, 1%); }
}

.bg-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(15,23,42,0.30) 0%, rgba(15,23,42,0.85) 100%);
    z-index: 2;
}

/* Respeita quem pediu menos animacao no sistema. */
@media (prefers-reduced-motion: reduce) {
    .bg-image, .login-card { animation: none !important; }
}

/* ==========================================================================
   2. LOGIN
   ========================================================================== */

body.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    min-height: 100vh;
}

.login-card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px;
    padding: 40px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.2);
    animation: float 6s ease-in-out infinite;
}

.card-bg-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.9) contrast(1.05);
    z-index: -2;
}

.card-glass-layer {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(15,23,42,0.45) 0%, rgba(15,23,42,0.65) 100%);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: -1;
}

@keyframes float {
    0%   { transform: translateY(0); }
    50%  { transform: translateY(-12px); }
    100% { transform: translateY(0); }
}

.login-header { text-align: center; margin-bottom: 28px; }

.login-header h2 {
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
    text-shadow: 0 2px 6px rgba(0,0,0,0.8);
}

.login-header p {
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 500;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.login-card .form-group { margin-bottom: 18px; }

.login-card label {
    display: block;
    margin-bottom: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.login-card input[type="text"],
.login-card input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 10px;
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(15,23,42,0.55);
    color: #fff;
    backdrop-filter: blur(4px);
}

.login-card input::placeholder { color: #cbd5e1; }

.login-card input:focus {
    border-color: var(--azul-claro);
    box-shadow: 0 0 0 3px rgba(56,189,248,0.4);
    background: rgba(15,23,42,0.8);
}

.link-btn {
    background: none;
    border: none;
    padding: 6px 0 0;
    color: var(--azul-claro);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.link-btn:hover { text-decoration: underline; }

.btn-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--azul) 0%, var(--azul-escuro) 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-submit:hover  { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(2,132,199,0.5); }
.btn-submit:active { transform: translateY(0); }

.login-rodape {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(255,255,255,0.18);
    color: #e2e8f0;
    font-size: 12.5px;
    line-height: 1.6;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.login-rodape strong { color: #fff; }

/* Alertas dentro do card escuro */
.alert {
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 18px;
    line-height: 1.5;
}
.alert-error   { background: rgba(185,28,28,0.85);  color: #fff; }
.alert-success { background: rgba(21,128,61,0.85);  color: #fff; }
.alert-info    { background: rgba(3,105,161,0.85);  color: #fff; }

/* ==========================================================================
   3. HUB E PAGINAS INTERNAS
   ========================================================================== */

body.app-body {
    background: var(--fundo);
    color: var(--texto);
    min-height: 100vh;
}

.topo {
    position: relative;
    z-index: 10;
    background: linear-gradient(135deg, var(--noite) 0%, #14264a 100%);
    color: #fff;
    padding: 18px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    box-shadow: 0 4px 18px rgba(15,23,42,0.35);
}

.topo .marca { display: flex; align-items: center; gap: 12px; }
.topo .marca .sigla {
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--azul) 0%, var(--azul-escuro) 100%);
    font-weight: 700; font-size: 14px; letter-spacing: 0.5px;
}
.topo .marca h1 { font-size: 17px; font-weight: 700; line-height: 1.2; }
.topo .marca p  { font-size: 12px; color: #94a3b8; }

.topo .conta { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.topo .conta .quem { text-align: right; line-height: 1.35; }
.topo .conta .quem strong { display: block; font-size: 13.5px; }
.topo .conta .quem span   { color: #94a3b8; font-size: 11.5px; }

.btn-topo {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    background: rgba(255,255,255,0.06);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
}
.btn-topo:hover { background: rgba(255,255,255,0.16); }

.conteudo {
    position: relative;
    z-index: 10;
    max-width: 1080px;
    margin: 0 auto;
    padding: 34px 24px 60px;
}

.saudacao   { margin-bottom: 26px; }
.saudacao h2 { font-size: 22px; color: var(--tinta); font-weight: 700; }
.saudacao p  { font-size: 14px; color: var(--suave); margin-top: 4px; }

/* --- Cards das aplicacoes --- */

.grade-apps {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.card-app {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--borda);
    border-radius: 14px;
    padding: 22px;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.card-app::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--cor-app, var(--azul));
}
.card-app:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(15,23,42,0.14);
    border-color: var(--cor-app, var(--azul));
}

.card-app .icone {
    width: 46px; height: 46px;
    display: grid; place-items: center;
    border-radius: 12px;
    margin-bottom: 14px;
    background: color-mix(in srgb, var(--cor-app, #0284c7) 12%, #fff);
    color: var(--cor-app, var(--azul));
}
.card-app .icone svg { width: 24px; height: 24px; }

.card-app h3 { font-size: 16.5px; color: var(--tinta); font-weight: 700; }
.card-app p  { font-size: 13px; color: var(--suave); margin-top: 6px; line-height: 1.55; flex: 1; }

.card-app .rodape-card {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.etiqueta {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    background: var(--fundo);
    color: var(--suave);
    border: 1px solid var(--borda);
}
.etiqueta.nivel { background: color-mix(in srgb, var(--cor-app, #0284c7) 12%, #fff);
                  color: var(--cor-app, var(--azul));
                  border-color: color-mix(in srgb, var(--cor-app, #0284c7) 35%, #fff); }

.card-app .abrir { font-size: 13px; font-weight: 700; color: var(--cor-app, var(--azul)); }

/* --- Estado vazio --- */

.vazio {
    background: #fff;
    border: 1px dashed var(--borda);
    border-radius: 14px;
    padding: 42px 26px;
    text-align: center;
}
.vazio h3 { font-size: 16px; color: var(--tinta); margin-bottom: 6px; }
.vazio p  { font-size: 13.5px; color: var(--suave); line-height: 1.6; }

/* --- Cartao de formulario/tabela nas paginas internas --- */

.painel {
    background: #fff;
    border: 1px solid var(--borda);
    border-radius: 14px;
    padding: 26px;
    margin-bottom: 20px;
}
.painel h2 { font-size: 17px; color: var(--tinta); margin-bottom: 4px; }
.painel .subtitulo { font-size: 13px; color: var(--suave); margin-bottom: 20px; line-height: 1.55; }

.painel .form-group { margin-bottom: 16px; max-width: 420px; }
.painel label { display: block; font-size: 13px; font-weight: 600; color: var(--texto); margin-bottom: 6px; }
.painel input[type="text"],
.painel input[type="password"],
.painel input[type="email"],
.painel select {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14.5px;
    outline: none;
    background: #fff;
    color: var(--texto);
}
.painel input:focus, .painel select:focus {
    border-color: var(--azul);
    box-shadow: 0 0 0 3px rgba(2,132,199,0.18);
}
.painel .ajuda { font-size: 12px; color: var(--suave); margin-top: 5px; }

.acoes { display: flex; gap: 10px; align-items: center; margin-top: 22px; flex-wrap: wrap; }

.btn {
    display: inline-block;
    padding: 11px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
}
.btn-primario { background: linear-gradient(135deg, var(--azul) 0%, var(--azul-escuro) 100%); color: #fff; }
.btn-primario:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(2,132,199,0.35); }
.btn-neutro   { background: #fff; color: var(--texto); border: 1px solid #cbd5e1; }
.btn-neutro:hover { background: var(--fundo); }
.btn-mini     { padding: 6px 12px; font-size: 12.5px; }

/* Alertas nas paginas claras */
.painel .alert-error   { background: #fee2e2; color: #991b1b; }
.painel .alert-success { background: #dcfce7; color: #166534; }
.painel .alert-info    { background: #e0f2fe; color: #075985; }

/* --- Tabelas --- */

.tabela-rolagem { overflow-x: auto; }

table.lista {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    min-width: 640px;
}
table.lista th {
    text-align: left;
    padding: 10px 12px;
    background: var(--fundo);
    color: var(--suave);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--borda);
    white-space: nowrap;
}
table.lista td { padding: 11px 12px; border-bottom: 1px solid var(--borda); vertical-align: middle; }
table.lista tr:last-child td { border-bottom: none; }
table.lista tr:hover td { background: #f8fafc; }
table.lista .inativo { opacity: 0.55; }

.check-app { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; }
.check-app input { width: auto; }

.rodape-portal {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 26px 20px 40px;
    font-size: 12px;
    color: var(--suave);
    line-height: 1.7;
}

@media (max-width: 650px) {
    .topo { padding: 14px 18px; }
    .topo .conta .quem { display: none; }
    .conteudo { padding: 24px 16px 44px; }
    .login-card { padding: 30px 24px; }
}
