/*
  custom.css – Estilos globais da Masterpage
  Portal da Transparência – SICAM.Net
*/

/* =============================================
   ACESSIBILIDADE – Skip Navigation Links
   (eMAG 3.1 | WCAG 2.4.1)

   Técnica: visually-hidden quando inativo
   (clip + overflow:hidden), aparece como
   elemento fixed no foco — nunca vaza pixels.
============================================= */
.skip-link {
    /* Completamente oculto e sem área visual */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;

    /* Propriedades visuais (ativadas no :focus) */
    background: #1351b4;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    border-radius: 0 0 8px 0;
    z-index: 200000;
}

.skip-link:focus {
    /* Torna visível e fixo no topo ao receber foco */
    position: fixed;
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    padding: 0.75rem 1.5rem;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    outline: 3px solid #ffcd07;
    outline-offset: 2px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

/*
  Foco visível: estilos completos em styles/acessibilidade.css
  Override local apenas para compat. com Shards Dashboard
*/
a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
    outline: none;
}

/* =============================================
   CORREÇÃO SHARDS DASHBOARD — card-header colorido
   O Shards define color em .h1–.h6 com alta
   especificidade, quebrando text-white do Bootstrap.
   Força herança da cor do card-header bg-* aqui,
   no head (depois do Shards), com !important.
============================================= */
.card-header[class*="bg-"] .h1,
.card-header[class*="bg-"] .h2,
.card-header[class*="bg-"] .h3,
.card-header[class*="bg-"] .h4,
.card-header[class*="bg-"] .h5,
.card-header[class*="bg-"] .h6,
.card-header[class*="bg-"] span:not(.badge),
.card-header[class*="bg-"] p {
    color: inherit !important;
}

/* Botões outline dentro de card-headers coloridos
   herdam a cor de borda/texto do variant correto */
.card-header.bg-primary .btn-outline-light {
    color: #f8f9fa !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}

.card-header.bg-primary .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
    border-color: #fff !important;
}


/* =============================================
   LAYOUT – Sidebar fixa (Shards Dashboard)
============================================= */

/*
  ARQUITETURA DE SCROLL CORRETA:
  ──────────────────────────────
  • Uma única barra de rolagem: a nativa do browser (body)
  • .main-sidebar → position: fixed, rola internamente se
    o menu for longo (sem criar scroll container no body)
  • .main-content → fluxo normal, sem height/overflow fixos
  • .sticky-top no header funciona em relação ao scroll do body
  • NÃO definir height: 100vh nem overflow-y no .main-content
    para evitar segunda barra de rolagem

  Larguras espelham o grid Bootstrap:
    col-md-3 = 25%  |  col-lg-2 = 16.6667%
*/

/* — Sidebar fixa no desktop (md ≥ 768px) — */
@media (min-width: 768px) {
    .main-sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        height: 100vh;
        width: 25%; /* col-md-3 */
        overflow-y: auto;
        overflow-x: hidden;
        z-index: 1030;
        /* Scrollbar discreta (visível só quando menu é longo) */
        scrollbar-width: thin;
        scrollbar-color: #d0d8e8 transparent;
    }

    .main-sidebar::-webkit-scrollbar       { width: 4px; }
    .main-sidebar::-webkit-scrollbar-track { background: transparent; }
    .main-sidebar::-webkit-scrollbar-thumb { background-color: #d0d8e8; border-radius: 4px; }
}

/* — Largura col-lg-2 em lg ≥ 992px — */
@media (min-width: 992px) {
    .main-sidebar { width: 16.6667%; }
}

/*
  Padding-bottom no conteúdo principal para
  nunca ficar escondido atrás do footer fixo (40px).
  O offset lateral já é tratado pelo grid (offset-md-3 / offset-lg-2).
*/
.main-content {
    padding-bottom: 48px; /* altura do footer + margem de segurança */
}

/* =============================================
   UTILITÁRIOS GERAIS
============================================= */
.icon-blue {
    color: #1351b4;
}

.zebra tbody tr:nth-child(odd) {
    background-color: #f0f0f0;
}

.AlertaErro {
    color: #dc3545;
    font-weight: bold;
}

/* =============================================
   BADGE DE CONTAGEM – Normas Jurídicas
============================================= */
.BadgeTotal {
    vertical-align: middle;
    margin-left: -15px;
    margin-top: -20px;
    font-size: 9px;
}

/* =============================================
   BANNER PWA – iOS
============================================= */
.ios-banner {
    position: fixed;
    bottom: 0;
    width: 100%;
    background-color: #fff3cd;
    color: #856404;
    border-top: 2px solid #ffeeba;
    z-index: 1000;
    padding: 12px 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: slideIn 0.5s ease-out;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.ios-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    text-align: left;
}

.ios-banner-icon {
    width: 36px;
    height: 36px;
}

.icon-share {
    font-size: 1.2em;
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (min-width: 768px) {
    .ios-banner-content {
        font-size: 16px;
    }
}

/* =============================================
   AJUSTE DE PADDING PARA BANNER PWA
============================================= */
.banner-visible {
    padding-bottom: 60px;
}

/* =============================================
   TOPBAR – Logo e Título da Entidade
============================================= */
.navbar-brand-custom {
    min-width: 0;
}

.navbar-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.navbar-title-wrapper {
    line-height: 1.1;
}

.navbar-subtitle {
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    color: #6c757d;
    display: block;
}

.navbar-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #343a40;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 360px;
}

@media (max-width: 768px) {
    .navbar-title {
        max-width: 200px;
        font-size: 0.95rem;
    }
}

/* =============================================
   SIDEBAR – Itens de Navegação
============================================= */

/* Separador de seção dentro da sidebar */
.nav-section-header {
    pointer-events: none;
}

.main-sidebar .nav .nav-item .nav-link {
    transition: all 0.25s ease;
    border-radius: 6px;
    margin: 3px 8px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-sidebar .nav .nav-item .nav-link:hover {
    background-color: #eef2ff;
    color: #1351b4;
    transform: translateX(4px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
}

.main-sidebar .nav .nav-item .nav-link i {
    transition: transform 0.25s ease, color 0.25s ease;
    font-size: 18px;
}

.main-sidebar .nav .nav-item .nav-link:hover i {
    transform: scale(1.15);
    color: #1351b4;
}

/* Estado Ativo – segue paleta govbr */
.main-sidebar .nav .nav-item .nav-link.active {
    background-color: #dce9ff;
    font-weight: 700;
    color: #1351b4;
    border-left: 4px solid #1351b4;
    border-radius: 0 6px 6px 0;
    margin-left: 0;
    padding-left: 19px; /* compensa a borda esquerda de 4px */
}

.main-sidebar .nav .nav-item .nav-link.active i {
    color: #1351b4;
}

/* =============================================
   SIDEBAR – Dropdown de Processo Legislativo
============================================= */
.main-sidebar .dropdown-menu {
    transition: all 0.25s ease;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    margin-top: 5px;
}

.main-sidebar .dropdown-item {
    transition: all 0.2s ease;
    padding: 8px 20px;
    border-radius: 4px;
    margin: 2px 8px;
    width: auto;
}

.main-sidebar .dropdown-item:hover,
.main-sidebar .dropdown-item:focus {
    background-color: #eef2ff;
    color: #1351b4;
    transform: translateX(3px);
}
