/* ============================================================
   Identidade Visual - Alves e Lisboa Advogados Associados
   Paleta extraída do logotipo oficial (alveselisboa.com.br)

   Base herdada do sistema "Reembolso de Despesas" para manter
   consistência visual entre todos os módulos do escritório.
   ============================================================ */
:root {
    --brand-red: #9e1b1b;
    --brand-red-dark: #7a1416;
    --brand-red-light: #c0282a;
    --brand-gray: #58595b;
    --brand-gray-dark: #3d3e40;
    --brand-bg: #f4f5f7;

    /* Tokens adicionais usados pelo layout de Hub (sidebar/topbar) */
    --sidebar-width: 256px;
    --topbar-height: 70px;
}

body {
    background-color: var(--brand-bg) !important;
    color: #2b2b2b;
}

/* ---------- Cabeçalho institucional ---------- */
.brand-header {
    background: #ffffff;
    border-bottom: 3px solid var(--brand-red);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    padding: 0.85rem 0;
    margin-bottom: 1.75rem;
}
.brand-logo {
    height: 46px;
    width: auto;
}

/* ---------- Botões da marca ---------- */
.btn-brand {
    background: linear-gradient(180deg, var(--brand-red-light) 0%, var(--brand-red) 60%, var(--brand-red-dark) 100%);
    border: none;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(122, 20, 22, 0.25);
}
.btn-brand:hover,
.btn-brand:focus {
    background: var(--brand-red-dark);
    color: #fff;
}

.btn-outline-brand {
    border: 1px solid var(--brand-red);
    color: var(--brand-red);
    background: transparent;
    font-weight: 600;
}
.btn-outline-brand:hover,
.btn-outline-brand:focus {
    background: var(--brand-red);
    color: #fff;
}

/* ---------- Utilitários de marca ---------- */
.text-brand { color: var(--brand-red) !important; }
.bg-brand { background-color: var(--brand-red) !important; }
.bg-brand-gray { background-color: var(--brand-gray-dark) !important; }
.border-brand { border-color: var(--brand-red) !important; }

/* ---------- Cabeçalhos de modais ---------- */
.modal-header.bg-brand,
.modal-header.bg-brand-gray {
    color: #fff;
}

/* ---------- Tabelas ---------- */
.table-dark {
    --bs-table-bg: var(--brand-gray-dark);
    --bs-table-border-color: #4a4b4d;
}

/* ---------- Cards ---------- */
.card {
    border: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.card.card-destaque {
    border-top: 4px solid var(--brand-red);
}

/* ---------- Foco de inputs na cor da marca ---------- */
.form-control:focus,
.form-select:focus {
    border-color: var(--brand-red-light);
    box-shadow: 0 0 0 0.2rem rgba(158, 27, 27, 0.15);
}

/* ---------- Rodapé ---------- */
.brand-footer {
    color: var(--brand-gray);
    font-size: 0.8rem;
}

/* ============================================================
   LAYOUT DE HUB (Sistema base extensível)
   ------------------------------------------------------------
   A partir daqui ficam os estilos exclusivos do hub navegável:
   topbar fixa, sidebar de módulos e área de conteúdo.
   Tudo construído sobre a paleta da marca definida acima.
   ============================================================ */

/* ---------- Topbar fixa ---------- */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--topbar-height);
    background: #ffffff;
    border-bottom: 3px solid var(--brand-red);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    gap: 1rem;
}
.app-topbar .topbar-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}
.app-topbar .brand-logo {
    height: 42px;
}
.app-topbar .app-nome {
    font-weight: 700;
    color: var(--brand-red);
    font-size: 1.05rem;
    line-height: 1.1;
    white-space: nowrap;
}
.app-topbar .app-nome small {
    display: block;
    font-weight: 500;
    font-size: 0.7rem;
    color: var(--brand-gray);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.app-topbar .topbar-right {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}
.app-usuario-info {
    text-align: right;
    line-height: 1.15;
}
.app-usuario-info .nome {
    font-weight: 600;
    font-size: 0.9rem;
    color: #2b2b2b;
}
.app-usuario-info .perfil {
    font-size: 0.72rem;
    color: var(--brand-gray);
}

/* Selo de perfil reutilizável (Admin / Advogado / Cliente) */
.badge-perfil {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    text-transform: uppercase;
}
.badge-perfil.admin { background: var(--brand-red); color: #fff; }
.badge-perfil.financeiro { background: var(--brand-red-dark); color: #fff; }
.badge-perfil.advogado { background: var(--brand-gray-dark); color: #fff; }
.badge-perfil.cliente { background: #e3e4e8; color: var(--brand-gray-dark); }

/* ---------- Estrutura: sidebar + conteúdo ---------- */
.app-shell {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - var(--topbar-height));
}

.app-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid #e4e5e9;
    box-shadow: 1px 0 4px rgba(0, 0, 0, 0.03);
    padding: 1.25rem 0.85rem;
    position: sticky;
    top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
}
.app-sidebar .menu-secao {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brand-gray);
    padding: 0.75rem 0.75rem 0.4rem;
}

/* Itens de menu (módulos do hub) */
.menu-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.15rem;
    border-radius: 8px;
    color: #444;
    font-weight: 500;
    font-size: 0.92rem;
    text-decoration: none;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.15s ease, color 0.15s ease;
}
.menu-item .menu-icone {
    width: 20px;
    text-align: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}
.menu-item .menu-rotulo { flex-grow: 1; }
.menu-item:hover {
    background: #f6eded;
    color: var(--brand-red);
}
.menu-item.ativo {
    background: #f6eded;
    color: var(--brand-red);
    border-left-color: var(--brand-red);
    font-weight: 600;
}

/* Módulo ainda não liberado — placeholder "Em breve" */
.menu-item.desabilitado {
    color: #b6b7bb;
    cursor: not-allowed;
    pointer-events: none;
}
.menu-item.desabilitado:hover {
    background: transparent;
    color: #b6b7bb;
}
.menu-item .badge-breve {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: #ededf0;
    color: #9a9ba0;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
}

/* ---------- Área principal de conteúdo ---------- */
.app-main {
    flex-grow: 1;
    padding: 1.75rem 2rem;
    min-width: 0;
}
.page-titulo {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e4e5e9;
}
.page-titulo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-red);
    margin: 0;
}
.page-titulo .subtitulo {
    color: var(--brand-gray);
    font-size: 0.9rem;
}

/* Cartões de boas-vindas / atalhos de módulo no dashboard */
.modulo-card {
    height: 100%;
    border-radius: 12px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.modulo-card.ativo:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.10);
}
.modulo-card .modulo-icone {
    font-size: 1.7rem;
    color: var(--brand-red);
}
.modulo-card.indisponivel {
    opacity: 0.7;
    background: #fbfbfc;
    border: 1px dashed #d8d9de !important;
}
.modulo-card.indisponivel .modulo-icone {
    color: #b6b7bb;
}

/* ---------- Botão hamburger (mobile) ---------- */
.btn-toggle-sidebar {
    display: none;
    border: 1px solid #e4e5e9;
    background: #fff;
    color: var(--brand-gray-dark);
    border-radius: 8px;
    padding: 0.3rem 0.55rem;
    font-size: 1.2rem;
    line-height: 1;
}

/* ---------- Responsividade ---------- */
@media (max-width: 991.98px) {
    .btn-toggle-sidebar { display: inline-block; }
    .app-sidebar {
        position: fixed;
        top: var(--topbar-height);
        left: 0;
        z-index: 1029;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
    }
    .app-sidebar.aberta { transform: translateX(0); }
    .app-main { padding: 1.25rem; }
    .app-usuario-info { display: none; }
    /* Camada escura por trás da sidebar aberta no mobile */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: var(--topbar-height) 0 0 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 1028;
    }
    .sidebar-backdrop.visivel { display: block; }
}
