/* ==========================================================================
   1. PERSONALIZAÇÃO DA PREFEITURA DE PARACAMBI (IDENTIDADE VISUAL)
   ========================================================================== */

/* Barra Cinza Superior e Ticker de Notícias Rotativas */
.top-bar {
    background-color: #e9ecef;
    font-size: 0.85rem;
}

.news-ticker-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 24px;
    overflow: hidden;
    width: 100%;
    max-width: 650px;
}

.news-item {
    position: absolute;
    top: 54%;
    left: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50%);
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    line-height: 1;
}

.news-item.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%);
}

.top-news-link {
    color: #880e4f;
    text-decoration: none;
}

.top-news-link:hover {
    text-decoration: underline;
}

.social-icons a {
    color: #6c757d;
    transition: color 0.2s;
}

.social-icons a:hover {
    color: #04488c;
}

/* Sobrescrita de Classes Bootstrap - Azul Paracambi (#04488c) */
.btn-primary {
    background-color: #04488c !important;
    border: 2px solid #04488c !important;
    color: #ffffff !important;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-primary:hover {
    background-color: #ffffff !important;
    border-color: #04488c !important;
    color: #04488c !important;
}

.bg-primary {
    background-color: #04488c !important;
}

.text-primary {
    color: #04488c !important;
}

.btn-outline-primary {
    color: #04488c !important;
    border: 2px solid #04488c !important;
    background-color: transparent !important;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-outline-primary:hover {
    background-color: #04488c !important;
    border-color: #04488c !important;
    color: #ffffff !important;
}

/* Logo */
.logo-img {
    height: 100px !important;
    width: auto !important;
    max-width: 100%;
    mix-blend-mode: multiply;
}

/* Botão Customizado */
.btn-prefeitura {
    background-color: #04488c !important;
    color: #ffffff !important;
    border: 2px solid #04488c !important;
    border-radius: 6px;
    padding: 10px 20px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-prefeitura:hover {
    background-color: #ffffff !important;
    border-color: #04488c !important;
    color: #04488c !important;
}

/* Acordeões e Cards de Secretarias */
.secretaria-accordion,
.item-secretaria.card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    margin-bottom: 16px !important;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05) !important;
}

.secretaria-header,
.item-secretaria .card-header {
    padding: 16px 20px !important;
    font-weight: 600;
    font-size: 1.05rem;
    background-color: #fafafa !important;
    color: #04488c !important;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border: 2px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.secretaria-header *,
.item-secretaria .card-header * {
    color: #04488c !important;
}

.secretaria-header.bg-primary,
.item-secretaria .card-header.bg-primary {
    background-color: #04488c !important;
}

.secretaria-header.bg-primary *,
.item-secretaria .card-header.bg-primary * {
    color: #ffffff !important;
}

.secretaria-header::-webkit-details-marker {
    display: none;
}

.secretaria-header:hover,
.item-secretaria .card-header:hover {
    background-color: #ffffff !important;
    border-color: #04488c !important;
    box-shadow: 0 4px 12px rgba(4, 72, 140, 0.12) !important;
}

.secretaria-header:hover *,
.item-secretaria .card-header:hover * {
    color: #04488c !important;
}

.arrow-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.secretaria-accordion[open] .arrow-icon {
    transform: rotate(180deg);
}

.secretaria-accordion[open] .secretaria-header {
    border-bottom: 1px solid #e2e8f0;
    background-color: #eef5fc !important;
}

.secretaria-content,
.item-secretaria .card-body {
    padding: 20px !important;
    background-color: #ffffff;
}

/* Lista de Contatos */
.contato-item {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.contato-item:last-child {
    border-bottom: none;
}

.contato-item a {
    color: #04488c !important;
    text-decoration: none;
}

.contato-item a:hover {
    text-decoration: underline;
}

.coluna-setor { width: 40%; }
.coluna-telefone { width: 35%; white-space: nowrap !important; }
.coluna-acao { width: 25%; }


/* ==========================================================================
   2. ESTILOS DO PAINEL DE ACESSIBILIDADE E ESTRUTURA DE PÁGINA
   ========================================================================== */

.btn-a11y {
    background-color: #ffffff;
    color: #333333;
    border-color: #e2e8f0 !important;
    border-radius: 12px;
    padding: 12px 14px;
    transition: background-color 0.2s ease;
}

.btn-a11y:hover {
    background-color: #f8f9fa;
    border-color: #cbd5e1 !important;
}

.btn-a11y.active {
    border: 2px solid #000000 !important;
    background-color: #f1f5f9;
}

.btn-a11y-card {
    background-color: #f1f3f5;
    border: 2px solid transparent !important;
    border-radius: 14px;
    padding: 12px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    position: relative;
    cursor: pointer;
}

.btn-a11y-card:hover {
    background-color: #e9ecef;
}

.btn-a11y-card.active {
    border: 2px solid #000000 !important;
    background-color: #ffffff !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.btn-a11y-card .icon-circle {
    width: 36px;
    height: 36px;
    background-color: #ffffff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #212529;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.btn-a11y-card.active .icon-circle {
    background-color: #000000;
    color: #ffffff;
}

.btn-a11y-card .card-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #343a40;
    line-height: 1.2;
}

.step-bars {
    display: flex;
    gap: 4px;
    width: 100%;
}

.step-bars .bar {
    height: 6px;
    flex: 1;
    background-color: #ced4da;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.step-bars .bar.active {
    background-color: #000000;
}

/* ITENS DO SUBPAINEL DE ESTRUTURA DA PÁGINA */
.btn-structure-item {
    background-color: #ffffff !important;
    border: 1px solid #e9ecef !important;
    border-radius: 10px !important;
    padding: 12px 14px !important;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.btn-structure-item:hover {
    background-color: #f1f5f9 !important;
    border-color: #04488c !important;
    transform: translateX(3px);
}

.a11y-highlight-heading {
    outline: 3px solid #04488c !important;
    outline-offset: 4px !important;
    border-radius: 4px;
}

/* MÁSCARA DE LEITURA */
#a11y-reading-mask {
    position: fixed;
    left: 0;
    width: 100vw;
    height: 50px;
    background: transparent !important;
    border-top: 3px solid #04488c !important;
    border-bottom: 3px solid #04488c !important;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65) !important;
    pointer-events: none;
    z-index: 9999;
}


/* ==========================================================================
   3. REGRAS DE ACESSIBILIDADE GLOBAL
   ========================================================================== */

/* Tamanho de Fonte Global */
html.a11y-fonte-1 { font-size: 112.5% !important; }
html.a11y-fonte-2 { font-size: 125% !important; }
html.a11y-fonte-3 { font-size: 137.5% !important; }

body.a11y-texto-maior,
body.a11y-fonte-1 { font-size: 112.5% !important; }
body.a11y-fonte-2 { font-size: 125% !important; }
body.a11y-fonte-3 { font-size: 137.5% !important; }

/* Altura de Linha */
body.a11y-altura-linha { line-height: 1.8 !important; }
body.a11y-linha-1 * { line-height: 1.5 !important; }
body.a11y-linha-2 * { line-height: 1.8 !important; }
body.a11y-linha-3 * { line-height: 2.1 !important; }

/* Alinhamento e Tipografia (CORRIGIDO: Fonte Atkinson Hyperlegible Acessível para Celulares e Desktop) */
body.a11y-alinhar-direita * { text-align: right !important; }
body.a11y-alinhar-justificado * { text-align: justify !important; }
body.a11y-fonte-legivel,
body.a11y-fonte-legivel * { 
    font-family: 'Atkinson Hyperlegible', Arial, Helvetica, sans-serif !important; 
}

/* Escala de Cinza */
body.a11y-escala-cinza header,
body.a11y-escala-cinza main,
body.a11y-escala-cinza footer,
body.a11y-escala-cinza .top-bar,
body.a11y-cinza header,
body.a11y-cinza main,
body.a11y-cinza footer,
body.a11y-cinza .top-bar {
    filter: grayscale(100%) !important;
}

/* Esconder Imagens */
body.a11y-imagens img, 
body.a11y-imagens svg, 
body.a11y-imagens picture,
body.a11y-imagens .logo-img,
body.a11y-esconder-imagens img, 
body.a11y-esconder-imagens svg, 
body.a11y-esconder-imagens picture,
body.a11y-esconder-imagens .logo-img {
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Pausar Animações */
body.a11y-animacoes * { 
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
}

/* Destacar Links */
body.a11y-links a,
body.a11y-links a *,
body.a11y-destacar-links a,
body.a11y-destacar-links a * {
    background-color: #ffeb3b !important;
    color: #000000 !important;
    text-decoration: underline !important;
    font-weight: bold !important;
}

/* Contorno de Foco Padrão */
body.a11y-foco *:focus { 
    outline: 3px solid #000000 !important; 
    outline-offset: 2px !important;
}

body.a11y-estrutura * { 
    outline: 1px dashed #04488c !important; 
}

/* Alto Contraste Escuro (Totalmente aplicado a tabelas e cards mobile) */
body.a11y-contraste-escuro,
body.a11y-contraste-escuro main,
body.a11y-contraste-escuro header,
body.a11y-contraste-escuro footer,
body.a11y-contraste-escuro .top-bar,
body.a11y-contraste-escuro .card,
body.a11y-contraste-escuro .secretaria-accordion,
body.a11y-contraste-escuro .secretaria-header,
body.a11y-contraste-escuro .secretaria-content,
body.a11y-contraste-escuro table,
body.a11y-contraste-escuro tr,
body.a11y-contraste-escuro td,
body.a11y-contraste-escuro th {
    background-color: #000000 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
}

body.a11y-contraste-escuro *:not([vw], [vw] *, .icon-circle, #a11yPanel, #a11yPanel *) {
    color: #ffff00 !important;
    border-color: #ffff00 !important;
}

/* Alto Contraste Claro */
body.a11y-contraste-claro,
body.a11y-contraste-claro main,
body.a11y-contraste-claro header,
body.a11y-contraste-claro footer,
body.a11y-contraste-claro .top-bar,
body.a11y-contraste-claro .card,
body.a11y-contraste-claro .secretaria-accordion,
body.a11y-contraste-claro .secretaria-header,
body.a11y-contraste-claro .secretaria-content,
body.a11y-contraste-claro table,
body.a11y-contraste-claro tr,
body.a11y-contraste-claro td,
body.a11y-contraste-claro th {
    background-color: #ffffff !important;
    color: #000000 !important;
    border-color: #000000 !important;
}

body.a11y-contraste-claro *:not([vw], [vw] *, .icon-circle, #a11yPanel, #a11yPanel *) {
    color: #000000 !important;
    border-color: #000000 !important;
}

body.a11y-contraste-claro p,
body.a11y-contraste-claro span,
body.a11y-contraste-claro i,
body.a11y-contraste-claro a,
body.a11y-contraste-claro strong,
body.a11y-contraste-claro small,
body.a11y-contraste-claro div:not(.card):not(.top-bar):not(.offcanvas) {
    background-color: transparent !important;
}

/* Alto Contraste Invertido */
body.a11y-contraste-invertido header,
body.a11y-contraste-invertido main,
body.a11y-contraste-invertido footer,
body.a11y-contraste-invertido .top-bar {
    filter: invert(100%) !important;
}


/* ==========================================================================
   4. RESPONSIVIDADE E DISPOSITIVOS MÓVEIS (CORRIGIDO SEM CONFLITOS DE !IMPORTANT)
   ========================================================================== */

@media (max-width: 768px) {

    html, body {
        max-width: 100%;
        overflow-x: clip;
    }

    .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .logo-img {
        height: 65px !important;
    }

    .search-container,
    form.d-flex,
    .input-group {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .input-group > .form-control,
    .input-group > .btn,
    .search-container input,
    .search-container button {
        width: 100% !important;
        border-radius: 6px !important;
        margin-bottom: 4px !important;
    }

    .secretaria-header,
    .item-secretaria .card-header {
        padding: 14px 16px !important;
        font-size: 0.95rem;
    }

    .secretaria-content,
    .item-secretaria .card-body {
        padding: 12px !important;
    }

    /* Tabelas transformadas em Cards Celular sem forçar fundo branco !important */
    table thead, .table thead {
        display: none !important;
    }

    table, tbody, tr, td,
    .table, .table tbody, .table tr, .table td {
        display: block !important;
        width: 100% !important;
    }

    table tbody tr, .table tbody tr {
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 14px;
        margin-bottom: 12px;
    }

    table td, .table td {
        padding: 4px 0 !important;
        border: none !important;
        text-align: left !important;
        white-space: normal;
        word-break: break-word;
    }

    .coluna-setor, 
    table td:first-child {
        font-size: 1rem !important;
        font-weight: 700 !important;
        margin-bottom: 6px !important;
    }

    .coluna-telefone,
    table td:nth-child(2) {
        white-space: nowrap !important;
    }

    .coluna-acao .btn,
    table td .btn {
        display: inline-block !important;
        width: 100% !important;
        margin-top: 8px !important;
        text-align: center !important;
    }
}

/* Forçar a sobreposição do Alto Contraste Escuro nas tabelas transformadas no celular */
@media (max-width: 768px) {
    body.a11y-contraste-escuro table tbody tr,
    body.a11y-contraste-escuro .table tbody tr,
    body.a11y-contraste-escuro table td,
    body.a11y-contraste-escuro .table td {
        background-color: #000000 !important;
        border-color: #ffff00 !important;
    }

    body.a11y-contraste-claro table tbody tr,
    body.a11y-contraste-claro .table tbody tr,
    body.a11y-contraste-claro table td,
    body.a11y-contraste-claro .table td {
        background-color: #ffffff !important;
        border-color: #000000 !important;
    }
}


/* ==========================================================================
   5. BOTÕES FLUTUANTES, VLIBRAS E HIERARQUIA DE CAMADAS (Z-INDEX)
   ========================================================================== */

/* Botão de Acessibilidade (Canto Inferior Esquerdo) */
#a11y-toggle,
.btn-a11y-toggle,
.a11y-float-btn,
.btn-a11y-float {
    position: fixed !important;
    bottom: 20px !important;
    left: 20px !important;
    width: 55px !important;
    height: 55px !important;
    z-index: 1040 !important;
    filter: none !important;
}

/* Widget VLibras (Canto Inferior Direito) */
div[vw] {
    position: fixed !important;
    right: 15px !important;
    bottom: 15px !important;
    z-index: 1040 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: none !important;
    filter: none !important;
}

div[vw] [vw-access-button],
div[vw] .active,
div[vw] [vw-plugin-wrapper] {
    pointer-events: auto !important;
}

div[vw] [vw-access-button] {
    background-color: #04488c !important;
    border-radius: 50% !important;
}

/* Isolamento de Filtros nos Botões Flutuantes */
[vw], [vw] *, .btn-a11y-float, #a11yPanel {
    filter: none !important;
}

/* Hierarquia do Menu e Modais */
.navbar,
.navbar-collapse,
.dropdown-menu,
.offcanvas-backdrop,
.modal-backdrop,
.modal {
    z-index: 1050 !important;
}

#a11yPanel {
    z-index: 1060 !important;
}