/* =========================================================================
   Diário Oficial — Grandes Rios · folha base (redesign 2026)
   Tailwind via CDN cobre o layout. Este arquivo cobre apenas o que o
   utilitário não alcança: jQuery UI datepicker, popover, modais, loaders,
   VLibras, modo contraste e ajustes de acessibilidade.
   ========================================================================= */

:root {
    --primary: #1763C6;
    --primary-dark: #1251A6;
    --navy: #0C2547;
    --ink: #133A66;
    --bg: #EEF3F9;
    --card-border: #E2E8F1;
    --muted: #6B7886;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; max-width: 100%; }
body {
    background: var(--bg);
    color: #13243A;
    font-family: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}
::selection { background: var(--primary); color: #fff; }
.font-display { font-family: 'Bricolage Grotesque', sans-serif; }

a { text-decoration: none; }
img { display: block; }

.d-none { display: none !important; }

/* ---------- Normalização de campos de formulário ---------- */
input, select, textarea, button { font-family: inherit; }
/* campo de busca principal — garante alinhamento vertical e sem estilos nativos */
#input_palavra {
    -webkit-appearance: none;
    appearance: none;
    line-height: normal;
    padding: 0;
    margin: 0;
    width: 100%;
}
/* remove as setas do input numérico (edição) */
#input_edicao::-webkit-outer-spin-button,
#input_edicao::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#input_edicao { -moz-appearance: textfield; }
/* select de ano com seta própria */
#option_input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237B8694' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 38px;
}

/* ---------- Calendário (jQuery UI datepicker inline) ---------- */
.datepicker { width: 100%; }
.datepicker .ui-datepicker,
.datepicker .ui-datepicker-inline {
    width: 100% !important;
    box-sizing: border-box;
    border: none;
    background: transparent;
    font-family: 'Hanken Grotesk', sans-serif;
    padding: 0;
    margin: 0;
}
.datepicker .ui-datepicker-header {
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 12px;
    position: relative;
}
.datepicker .ui-datepicker-title {
    flex: 1;
    text-align: center;
    font-size: 15.5px;
    font-weight: 700;
    color: #16273A;
}
.datepicker .ui-datepicker-prev,
.datepicker .ui-datepicker-next {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    border: 1px solid var(--card-border);
    background: #fff;
    color: #46566A;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    top: 0;
}
.datepicker .ui-datepicker-prev { order: 0; }
.datepicker .ui-datepicker-title { order: 1; }
.datepicker .ui-datepicker-next { order: 2; }
.datepicker .ui-datepicker-prev:hover,
.datepicker .ui-datepicker-next:hover {
    background: #F1F7FD;
    color: var(--primary);
    border-color: var(--primary);
}
.datepicker .ui-datepicker-prev span,
.datepicker .ui-datepicker-next span { display: none; }
.datepicker .ui-datepicker-prev::after { content: "‹"; font-size: 20px; line-height: 1; }
.datepicker .ui-datepicker-next::after { content: "›"; font-size: 20px; line-height: 1; }

.datepicker .ui-datepicker-calendar {
    width: 100% !important;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 3px;
    margin: 0;
}
.datepicker .ui-datepicker-calendar th {
    font-size: 11px;
    font-weight: 700;
    color: #9AA4B0;
    text-transform: uppercase;
    padding: 4px 0;
}
.datepicker .ui-datepicker-calendar td { padding: 0; text-align: center; }
.datepicker .ui-datepicker-calendar td a,
.datepicker .ui-datepicker-calendar td span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
}
/* dias sem publicação */
.datepicker .ui-datepicker-calendar td span.ui-state-default {
    color: #C0C8D2;
    font-weight: 400;
    background: transparent;
}
/* dias com publicação (selecionáveis) */
.datepicker .ui-datepicker-calendar td a.ui-state-default {
    background: var(--primary);
    color: #fff;
    cursor: pointer;
}
.datepicker .ui-datepicker-calendar td a.ui-state-default:hover {
    background: var(--primary-dark);
}
.datepicker .ui-datepicker-calendar td a.ui-state-active {
    background: var(--ink);
    color: #fff;
}

/* ---------- Popover de informações da edição ---------- */
.popover {
    display: none;
    position: absolute;
    z-index: 50;
    right: 0;
    top: calc(100% + 8px);
    width: 240px;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(8, 28, 55, .16);
    font-size: 13px;
}
.popover .header {
    padding: 11px 14px;
    border-bottom: 1px solid #EDF1F6;
}
.popover .header h3 { margin: 0; font-size: 14px; font-weight: 700; color: #16273A; }
.popover .body { padding: 12px 14px; color: #46566A; }
.popover .body p { margin: 0 0 7px; }
.popover .body p:last-child { margin-bottom: 0; }
.popover .body b { color: #16273A; }
.popover .arrow { display: none; }

/* ---------- Modais (filtro avançado + comprovante) ---------- */
.dia-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(11, 26, 50, .55);
    backdrop-filter: blur(2px);
    padding: 16px;
    /* display:flex aplicado via JS ao abrir; centraliza o conteúdo */
    align-items: center;
    justify-content: center;
}
@media (min-width: 640px) { .dia-modal { padding: 24px; } }

/* opções de "Poder" no filtro avançado */
.poder-opt {
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1.5px solid #E1E8F1;
    background: #fff;
    color: #46566A;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.poder-opt.is-active {
    border-color: var(--primary);
    background: #E7F0FB;
    color: var(--primary);
    font-weight: 700;
}

/* comprovante — painéis de busca/resultado */
.receipt-view { display: none; }
.ajax_message { display: block; font-size: 13px; color: #BD4B2F; min-height: 0; }
.ajax_message:empty { display: none; }
.message_ajax-warning {
    background: #FBEAE3; border: 1px solid #F2D2C6; color: #BD4B2F;
    border-radius: 10px; padding: 10px 12px;
}
.message_ajax-warning .message-h2 { font-size: 13.5px; font-weight: 600; margin: 0; }
.receipt-view-cont { display: flex; flex-direction: column; gap: 10px; }
.receipt-view_item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    border: 1px solid var(--card-border); border-radius: 12px; padding: 12px 14px; background: #F8FAFD;
}
.receipt-view_info-file { display: flex; flex-direction: column; gap: 3px; }
.receipt-view_info { font-size: 13.5px; color: #46566A; }
.receipt-view_info strong { color: var(--ink); }
.btn_view {
    flex: none; background: var(--primary); color: #fff; text-decoration: none;
    padding: 9px 16px; border-radius: 9px; font-size: 13px; font-weight: 700;
}
.btn_view:hover { background: var(--primary-dark); }
.btn_back {
    display: inline-flex; align-items: center; gap: 8px;
    background: #F1F6FB; border: 1px solid var(--card-border);
    border-radius: 10px; padding: 9px 14px; font-size: 13.5px; font-weight: 600;
    color: #46566A; cursor: pointer; font-family: inherit;
}
.btn_back .img-btn { width: 16px; }

/* ---------- Loaders ---------- */
.loader-container,
.animation_search_cont,
.ajax_animation {
    position: fixed;
    inset: 0;
    z-index: 9500;
    background: rgba(238, 243, 249, .96);
    display: flex;
    align-items: center;
    justify-content: center;
}
.animation_search_cont, .ajax_animation { display: none; }
.loader-container_search { text-align: center; }
.logo-loader, .logo-loader_busca { width: 70px; margin: 0 auto 18px; }
.outline {
    width: 54px; height: 54px; margin: 0 auto;
    border: 3px solid #D7E2F0; border-top-color: var(--primary);
    border-radius: 50%; animation: dia-spin .8s linear infinite;
}
.loader { display: none; }
.msg_loading { margin-top: 16px; font-size: 15px; font-weight: 600; color: var(--ink); }
@keyframes dia-spin { to { transform: rotate(360deg); } }

/* ---------- VLibras / botões de acessibilidade mobile ---------- */
.acessibilidade_mobile_btn-cont {
    position: fixed; right: 16px; z-index: 8000;
}
.acessibilidade_mobile_btn-cont { bottom: 80px; }
.vlibras-mb-button { bottom: 140px; }
@media (min-width: 768px) { .acessibilidade_mobile_btn-cont { display: none; } }
.acessibilidade_mobile_btn {
    width: 52px; height: 52px; border-radius: 50%;
    border: none; background: var(--primary); color: #fff;
    box-shadow: 0 8px 22px rgba(8, 28, 55, .25); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; font-size: 22px;
}

/* ---------- Página de acessibilidade (conteúdo institucional) ---------- */
.header-container { max-width: 1200px; margin: 0 auto; padding: 28px 24px 0; }
.header-text__superior { font-family: 'Bricolage Grotesque', sans-serif; font-size: 28px; font-weight: 700; color: var(--ink); display: block; }
.header-text__inferior { font-size: 15px; color: var(--muted); font-weight: 600; display: block; }
.page-wrapper_default { max-width: 880px; margin: 0 auto; padding: 24px; }
.accessibility-cont { background: #fff; border: 1px solid var(--card-border); border-radius: 16px; padding: 32px; box-shadow: 0 10px 26px rgba(8, 28, 55, .05); }
.accessibility-h2 { font-family: 'Bricolage Grotesque', sans-serif; font-size: 24px; font-weight: 700; color: var(--ink); margin: 0 0 18px; }
.accessibility-p { font-size: 15.5px; line-height: 1.7; color: #3C4A5B; margin: 0 0 14px; }
.accessibility-ul { margin: 0 0 16px; padding-left: 22px; }
.accessibility-li { font-size: 15px; line-height: 1.7; color: #3C4A5B; }

/* ---------- VLibras: evita overflow horizontal no mobile ---------- */
/* o popup promocional do VLibras é posicionado fora da tela à direita e
   estoura a largura no celular — ocultamos esse hint (o widget continua ativo) */
.vp-pop-up,
[vp-pop-up],
div[vp-pop-up] { display: none !important; }
[vw] { max-width: 100vw; }

/* ---------- Aviso de cookies ---------- */
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.pp {
    transform: translateY(140%);
    opacity: 0;
    transition: transform .45s cubic-bezier(.2, .7, .3, 1), opacity .45s ease;
    pointer-events: none;
}
.pp.-active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* ---------- Leitor de PDF (visualizar) ---------- */
#reader-scroll { touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; }
/* garante que arrastar com o dedo role/arraste (em vez de selecionar texto) */
#reader-scroll .rd-page,
#reader-scroll .rd-canvas,
#reader-scroll .textLayer { touch-action: pan-x pan-y; }
/* "safe center": centraliza quando cabe, mas alinha ao início quando a página
   é maior que a área visível — assim o conteúdo cortado fica acessível ao arrastar */
/* width:max-content + min-width:100% mantém as páginas centralizadas quando cabem
   e deixa rolar/arrastar por toda a largura quando a página é maior que a tela */
#reader-pages { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 16px; width: max-content; min-width: 100%; }
.rd-page {
    position: relative;
    background: #fff;
    box-shadow: 0 6px 22px rgba(8, 28, 55, .16);
    overflow: hidden;
}
.rd-page canvas.rd-canvas { display: block; }

/* tela cheia do leitor (funciona em iOS/Android via CSS) */
#viewer-shell.dia-fs { position: fixed; inset: 0; z-index: 9999; height: 100vh; height: 100dvh; background: #DDE3EC; }
#viewer-shell.dia-fs #reader-scroll { height: auto; flex: 1 1 auto; min-height: 0; }
body.dia-fs-lock { overflow: hidden; }
#viewer-shell .rd-ic-compress { display: none; }
#viewer-shell.dia-fs .rd-ic-expand { display: none; }
#viewer-shell.dia-fs .rd-ic-compress { display: block; }

/* camada de texto do pdf.js (seleção/cópia) */
.textLayer {
    position: absolute;
    left: 0; top: 0;
    overflow: hidden;
    line-height: 1;
    text-align: initial;
    transform-origin: 0 0;
    z-index: 2;
}
.textLayer span, .textLayer br {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
}
.textLayer ::selection { background: rgba(23, 99, 198, .35); }
.textLayer .rd-mark { background: rgba(255, 214, 0, .45); border-radius: 2px; }
.textLayer .rd-mark.is-active { background: rgba(255, 145, 0, .8); }
.textLayer .endOfContent {
    display: block; position: absolute; inset: 100% 0 0; z-index: -1;
    cursor: default; user-select: none;
}
.rd-status {
    padding: 60px 24px; text-align: center; color: #6B7886; font-weight: 600; font-size: 14.5px;
    display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.rd-status a { color: var(--primary); font-weight: 700; }
.rd-spin {
    width: 42px; height: 42px; border: 3px solid #C8D4E4; border-top-color: var(--primary);
    border-radius: 50%; animation: dia-spin .8s linear infinite;
}

/* ---------- Widget flutuante de acessibilidade (botão + painel à direita) ---------- */
.a11y-widget { position: fixed; right: 0; top: 28%; z-index: 8000; }
.a11y-fab {
    display: flex; height: 48px; width: 48px; cursor: pointer;
    align-items: center; justify-content: center;
    border-top-left-radius: 12px; border-bottom-left-radius: 12px; border: 0;
    background: var(--primary); color: #fff;
    box-shadow: 0 2px 6px rgba(16,24,40,.05), 0 18px 40px rgba(16,24,40,.12);
    transition: background .15s;
}
.a11y-fab:hover { background: var(--primary-dark); }
.a11y-fab svg { width: 26px; height: 26px; }
.a11y-panel {
    visibility: hidden; position: absolute; right: 100%; top: 0; margin-right: 8px;
    width: 290px; max-width: 86vw; transform-origin: top right; transform: scale(.95);
    border-radius: 16px; border: 1px solid var(--card-border); background: #fff; padding: 16px; opacity: 0;
    box-shadow: 0 2px 6px rgba(16,24,40,.05), 0 24px 50px rgba(16,24,40,.22);
    transition: transform .2s cubic-bezier(.4,0,.2,1), opacity .2s, visibility .2s;
}
.a11y-panel.is-open { visibility: visible; transform: scale(1); opacity: 1; }
.a11y-panel__head { margin-bottom: 12px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid #EDF1F6; padding-bottom: 12px; font-family: 'Bricolage Grotesque', sans-serif; font-size: 15px; font-weight: 700; color: var(--ink); }
.a11y-panel__head svg { width: 18px; height: 18px; }
.a11y-panel__group { margin-bottom: 12px; }
.a11y-panel__label { margin-bottom: 8px; display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #64748B; }
.a11y-panel__row { display: flex; flex-wrap: wrap; gap: 8px; }
.a11y-panel__row a, .a11y-panel__row button {
    display: inline-flex; cursor: pointer; align-items: center; justify-content: center; gap: 7px;
    border-radius: 8px; border: 1px solid var(--card-border); background: #F4F6F9;
    padding: 8px 12px; font-size: 13px; font-weight: 600; color: #374151; font-family: inherit; text-decoration: none;
    transition: all .15s;
}
.a11y-panel__row a svg, .a11y-panel__row button svg { width: 15px; height: 15px; flex: none; }
.a11y-panel__row a:hover, .a11y-panel__row button:hover { background: #E8F1FB; color: var(--primary); border-color: var(--primary); }
.a11y-panel__row .a11y-toggle.is-on { border-color: var(--primary); background: var(--primary); color: #fff; }
.a11y-panel__note { margin-top: 8px; display: flex; align-items: flex-start; gap: 6px; font-size: 11.5px; color: #64748B; }
.a11y-panel__note svg { width: 14px; height: 14px; flex: none; margin-top: 1px; }

/* estado ativo dos botões de contraste/modo escuro na barra superior */
.a11y-topbtn.is-on { background: var(--primary) !important; border-color: var(--primary) !important; color: #fff !important; }

/* alto contraste e modo escuro aplicados pelo widget (no <html>) */
html.a11y-contrast { filter: contrast(1.25) saturate(1.35); }
html.a11y-dark { background: #fff; filter: invert(1) hue-rotate(180deg); }
html.a11y-dark img, html.a11y-dark video, html.a11y-dark iframe, html.a11y-dark canvas, html.a11y-dark [style*="background-image"] { filter: invert(1) hue-rotate(180deg); }
html.a11y-contrast.a11y-dark { filter: invert(1) hue-rotate(180deg) contrast(1.25); }

/* ---------- Modo de alto contraste ---------- */
body.contrast { filter: invert(1) hue-rotate(180deg); background: #000; }
body.contrast img,
body.contrast .img-modal_default,
body.contrast iframe { filter: invert(1) hue-rotate(180deg); }
