/* news-modal.css */
.news-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    padding: 30px;
}

/* Remove padding quando for modal de imagem (mais clean) */
.news-modal.image-modal {
    padding: 0;
}

/* Define max-width menor para modal de imagem */
.news-modal.image-modal .modal-wrapper {
    max-width: 700px;
}

/* Garante que o modal de imagem em tela cheia ocupe toda a altura */
.news-modal.image-modal .modal-wrapper.fullscreen-mode {
    height: 100vh !important;
    max-height: none !important;
}

/* Regra específica para quando o modal estiver visível */
.news-modal[style*="display: flex"] {
    display: flex !important;
}

.news-modal[style*="display:flex"] {
    display: flex !important;
}

/* Novo wrapper para conter o cabeçalho e o conteúdo principal do modal */
.news-modal .modal-wrapper {
    background-color: #fefefe;
    margin: 5% auto;
    border: 1px solid #888;
    width: 90%;
    max-width: 900px;
    max-height: fit-content;
    position: relative;
    display: flex;
    /* Para organizar o cabeçalho e o conteúdo verticalmente */
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    /* Garante que os cantos arredondados sejam aplicados ao conteúdo */
    transition: all 0.3s ease-in-out;
    /* Garante que o wrapper não cresça além do necessário */
    box-sizing: border-box;
}

/* Estilo do cabeçalho superior com a barra de endereço */
.news-modal .modal-header-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Espaça os elementos */
    background-color: #EFF0F4;
    /* Cor de fundo da barra */
    padding: 8px 30px;
    /* Preenchimento interno */
    color: #333;
    font-size: 0.9em;
    flex-shrink: 0;
    /* Impede que a barra encolha */
}

.news-modal .modal-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    /* Espaço entre o título e a barra de endereço */
    flex-grow: 1;
    /* Permite que esta seção ocupe mais espaço */
}

.news-modal .modal-header-title {
    font-weight: 500;
    white-space: nowrap;
    /* Impede que o título quebre linha */
    color: #495057;
    font-size: 14px;
}

.news-modal .modal-address-bar {
    display: flex;
    position: relative;
    /* Garante que o tooltip fique posicionado corretamente */
    align-items: center;
    flex-grow: 1;
    /* Faz a barra de endereço ocupar o máximo de espaço */
    background-color: #EFF0F4;
    /* Fundo branco para o input */
    border-radius: 4px;
    padding: 3px 5px;
    /* Limite a largura da barra de endereço para não ficar muito grande */
    overflow: hidden;
    /* Esconde o que exceder */
}

.news-modal .modal-address-bar input {
    flex-grow: 1;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 14px;
    color: #858E96;
    cursor: text;
    outline: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Adiciona reticências se o texto for muito longo */
}

.news-modal .modal-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Espaço entre os três botões */
}

/* ----------------------------------------------- */
/* INÍCIO DAS CORREÇÕES PARA BOTÕES SUPERIORES */
/* ----------------------------------------------- */

/* NOVO: Estilo base unificado para todos os botões de ação no cabeçalho */
.news-modal .modal-header-action-btn {
    background: none;
    /* Remove qualquer background padrão */
    border: none;
    /* Remove borda padrão */
    cursor: pointer;
    /* Indica que é clicável */
    color: #666;
    /* Cor base unificada para o ícone */
    padding: 0 5px;
    /* Padding interno do botão */

    /* Centraliza o ícone dentro do botão */
    display: flex;
    align-items: center;
    justify-content: center;

    /* Define um tamanho fixo para maior consistência visual entre os botões */
    width: 28px;
    /* Largura do botão */
    height: 28px;
    /* Altura do botão */

    border-radius: 4px;
    /* Leve arredondamento nas bordas */
    transition: background-color 0.2s ease, color 0.2s ease;
    /* Transição suave para hover */
}

/* Conteúdo principal do modal */
.news-modal .modal-content {
    padding: 30px;
    /* Mantém o padding interno */
    /* Removido: background-color, margin, border, width, max-width, position */
    flex-grow: 1;
    /* Permite que o conteúdo ocupe o espaço restante */
    overflow-y: auto;
    /* Scroll automático quando necessário */
    border: 0 !important;
    min-height: 0;
    /* Permite que o conteúdo encolha dentro do flex container */
    /* Garante que o conteúdo não force o modal a crescer */
    max-height: 100%;
    box-sizing: border-box;
}

/* Remove padding do conteúdo quando for modal de imagem */
.news-modal.image-modal .modal-content {
    padding: 0;
}

.news-modal iframe {
    width: 100%;
    height: 600px;
    border: none;
}

/* Espaçamento adequado para o conteúdo do modal */
.modal-content hr {
    margin: 15px 0 !important;
    border: 0 !important;
    border-top: 1px solid #dee2e6 !important;
    padding: 0 !important;
}

#conteudo {
    margin-top: 20px !important;
    padding-top: 0 !important;
    font-size: 14px;
    line-height: 1.6;
    color: #495057;
}

/* CORREÇÃO: Restaura espaçamento para parágrafos dentro de #conteudo
   Isso sobrescreve o reset global do base.css (* { margin: 0; padding: 0; })
   que estava removendo o espaçamento padrão dos parágrafos */
#conteudo p {
    margin-top: 0 !important;
    margin-bottom: 1em !important;
    padding: 0 !important;
}

/* CORREÇÃO CRÍTICA: Força h5 dentro de #conteudo a ter o mesmo estilo de parágrafo
   Isso é necessário porque h5 tem estilos padrão do navegador que não são herdados */
#conteudo h5,
#conteudo h1,
#conteudo h2,
#conteudo h3,
#conteudo h4,
#conteudo h6 {
    font-size: inherit !important;
    font-weight: bold !important;
    line-height: inherit !important;
    margin-top: 0;
    margin-bottom: 1em !important;
    display: inline;
}

/* Primeiro parágrafo não precisa de margin-top */
#conteudo p:first-child {
    margin-top: 0 !important;
}

/* Último parágrafo não precisa de margin-bottom */
#conteudo p:last-child {
    margin-bottom: 0 !important;
}

/* Espaçamento automático para parágrafos formatados */
#conteudo p.formatted-paragraph {
    margin-bottom: 1.2em !important;
    margin-top: 0 !important;
}

/* Parágrafos que contêm títulos de seção */
#conteudo p.has-section-title {
    margin-top: 1.8em !important;
    margin-bottom: 0.8em !important;
}

/* Primeiro parágrafo não precisa de margin-top */
#conteudo p.has-section-title:first-child,
#conteudo p.formatted-paragraph:first-child {
    margin-top: 0 !important;
}

/* Títulos de seção em <b> ou <strong> (identificados automaticamente) */
#conteudo b.section-title,
#conteudo strong.section-title {
    display: block;
    margin-top: 1.5em !important;
    margin-bottom: 0.5em !important;
    font-weight: bold !important;
    font-size: 1.05em !important;
}

/* Títulos de seção em texto simples (sem <b>, como em rec3.htm) */
#conteudo .section-title-text {
    display: block;
    margin-top: 1.5em !important;
    margin-bottom: 0.5em !important;
    font-weight: bold !important;
    font-size: 1.05em !important;
}

/* Primeiro título de seção não precisa de margin-top */
#conteudo b.section-title:first-child,
#conteudo strong.section-title:first-child,
#conteudo .section-title-text:first-child {
    margin-top: 0 !important;
}

/* Quebra de linha após título de seção - espaçamento extra */
#conteudo br.section-break {
    display: block;
    margin-bottom: 0.8em !important;
    height: 0;
    line-height: 0;
}

/* Quebra de linha entre itens de notícia individuais */
#conteudo br.news-item-break {
    display: block;
    margin-bottom: 1em !important;
    height: 0 !important;
    line-height: 0 !important;
}

/* Espaçamento geral para elementos <b> e <strong> que podem ser títulos
   IMPORTANTE: Usa !important para sobrescrever o reset do _reboot.scss e user agent
   que aplicam font-weight: bolder */
#conteudo b,
#conteudo strong {
    font-weight: bold !important;
}

/* Melhora espaçamento entre blocos de texto separados por <br> */
#conteudo br {
    line-height: 1.8 !important;
}

#conteudo img {
    display: block;
    margin-left: auto !important;
    margin-right: auto !important;
    max-width: 100%;
    height: auto;
    border-radius: 5px;
}

.news-modal .Titulo {
    font-size: 22px;
    font-weight: bold;
    color: #333;
}

.news-modal .data-hora {
    font-size: 14px;
    color: #858E96;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90ch;
}

.news-modal .tarjaN {
    display: none !important;
}

.news-modal .modal-content .actions {
    display: flex;
    /* Para alinhar os botões de ação */
    align-items: center;
    gap: 5px;
    /* Espaço entre os botões */
}

.news-modal .modal-content .actions .btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    margin-right: 0;
    /* Removido margin-right para usar gap */
    color: #ABABAB;
    padding: 3px 6px;
}

.news-modal .modal-content .actions .btn i {
    font-size: 18px;
}

.news-modal .modal-content .actions .btn:hover {
    color: #333;
}

/* Estilo para os botões que terão tooltip */
.news-modal .modal-content .actions button {
    position: relative;
}

/* NOVO: Estilo para os ícones dentro dos botões de ação */
.news-modal .modal-header-action-btn i {
    font-size: 18px;
    /* Tamanho padronizado para todos os ícones */
}

/* NOVO: Estilo de hover unificado para todos os botões de ação */
.news-modal .modal-header-action-btn:hover {
    color: #333;
    /* Cor do ícone no hover */
    background-color: #E0E1E6;
    /* Adiciona um background sutil no hover para destacar o botão */
}

/* NOVO: Estilo de focus para acessibilidade e usabilidade por teclado */

.news-modal .modal-content .actions button[data-tooltip]::before,
.news-modal .modal-header-right button[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);

    background-color: #f0f0f0;
    border: 1px solid #ccc;
    color: #333;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    white-space: nowrap;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
}

.news-modal .modal-content .actions button[data-tooltip]::after,
.news-modal .modal-header-right button[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #f0f0f0 transparent transparent transparent;
    z-index: 1;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
}

.modal-content .actions button:hover::before,
.modal-content .actions button:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Ajustado para focar apenas os botões de ação do conteúdo do modal,
   já que os botões do cabeçalho agora usam .modal-header-action-btn:focus */
.modal-content .actions button:focus,
.modal-header-action-btn:focus {
    outline: none;
    box-shadow: none;
}


/* Estilo para o tooltip do botão de copiar link na barra de endereço */
/* Mantido aqui para o input na barra de endereço */
.modal-address-bar .copy-share-link[data-tooltip]::before {
    bottom: -150%;
    /* Posição abaixo do botão, ajuste conforme necessário */
    border-color: #f0f0f0 transparent transparent transparent;
    /* Seta para cima */
}

.modal-address-bar .copy-share-link[data-tooltip]::after {
    bottom: -100%;
    /* Posição da seta, ajuste conforme necessário */
    border-color: transparent transparent #f0f0f0 transparent;
    /* Seta para baixo */
}

.modal-content .info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Estilos para o modo tela cheia do modal */
.modal-wrapper.fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    z-index: 1000;
    display: flex !important;
    flex-direction: column !important;
}

.modal-wrapper.fullscreen-mode .modal-content {
    flex: 1 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    /* Usa flex: 1 para ocupar todo o espaço restante, em vez de altura fixa */
}

/* NOVO: Estilos para os tooltips dos botões de ação do cabeçalho */
/* Regras substituindo as antigas .fullscreen-btn[data-tooltip] e .copy-share-link[data-tooltip] */
.modal-header-action-btn[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -150%;
    /* Posição abaixo do botão, ajuste conforme necessário */
    left: 50%;
    transform: translateX(-50%);
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    color: #333;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    white-space: nowrap;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
    z-index: 1000;
}

.modal-header-action-btn[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: -100%;
    /* Posição da seta, ajuste conforme necessário */
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: transparent transparent #f0f0f0 transparent;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
}

.modal-header-action-btn:hover::before,
.modal-header-action-btn:hover::after {
    opacity: 1;
    visibility: visible;
}

.bullet-cinza {
    color: #ABABAB;
}

/* =========================================== */
/* ESTILOS PARA ARRASTAR E REDIMENSIONAR MODAL */
/* =========================================== */

/* Handles de redimensionamento */
.news-modal .modal-wrapper {
    position: relative;
}

.news-modal .resize-handle {
    position: absolute;
    background: transparent;
    z-index: 10;
}

/* Handles dos cantos (8x8px) */
.news-modal .resize-handle-nw,
.news-modal .resize-handle-ne,
.news-modal .resize-handle-se,
.news-modal .resize-handle-sw {
    width: 8px;
    height: 8px;
}

.news-modal .resize-handle-nw {
    top: 0;
    left: 0;
    cursor: nw-resize;
}

.news-modal .resize-handle-ne {
    top: 0;
    right: 0;
    cursor: ne-resize;
}

.news-modal .resize-handle-se {
    bottom: 0;
    right: 0;
    cursor: se-resize;
}

.news-modal .resize-handle-sw {
    bottom: 0;
    left: 0;
    cursor: sw-resize;
}

/* Handles das bordas (mais largos para facilitar o uso) */
.news-modal .resize-handle-n,
.news-modal .resize-handle-s {
    left: 0;
    right: 0;
    height: 4px;
}

.news-modal .resize-handle-n {
    top: 0;
    cursor: n-resize;
}

.news-modal .resize-handle-s {
    bottom: 0;
    cursor: s-resize;
}

.news-modal .resize-handle-e,
.news-modal .resize-handle-w {
    top: 0;
    bottom: 0;
    width: 4px;
}

.news-modal .resize-handle-e {
    right: 0;
    cursor: e-resize;
}

.news-modal .resize-handle-w {
    left: 0;
    cursor: w-resize;
}

/* Hover nos handles - opcional, para melhor feedback visual */
.news-modal .resize-handle:hover {
    background-color: rgba(0, 123, 255, 0.2);
}

/* Cursor de arrastar no cabeçalho */
.news-modal .modal-header-top-bar {
    cursor: move;
}

/* Garante que botões e inputs do cabeçalho não tenham cursor move */
.news-modal .modal-header-top-bar button,
.news-modal .modal-header-top-bar input {
    cursor: pointer;
}

/* Quando o modal está em tela cheia, esconde os handles */
.news-modal .modal-wrapper.fullscreen-mode .resize-handle {
    display: none;
}

/* Indicador de dimensões durante redimensionamento */
.modal-size-indicator {
    position: fixed;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    z-index: 10001;
    pointer-events: none;
    display: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: opacity 0.2s ease;
}

.modal-size-indicator.show {
    display: block;
    opacity: 1;
}

/* =========================================== */
/* ESTILOS PARA CONTEÚDO DO EXPEDIENTE */
/* =========================================== */
/* ESTILOS PARA CONTEÚDO DO EXPEDIENTE */
/* Segue o mesmo padrão visual do "Termos de Uso" */
/* Usa o mesmo estilo de #conteudo (font-size: 14px, line-height: 1.6, color: #495057) */
/* =========================================== */

/* Ajuste para o modal em tela cheia no mobile */
@media (max-width: 768px) {
    .modal-wrapper.fullscreen-mode {
        border: none !important;
    }

    .modal-header-left {
        min-width: 0;
        flex: 1 1 60%;
        gap: 4px;
    }

    .modal-wrapper.fullscreen-mode .modal-header-top-bar {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 10px 15px;
        gap: 6px;
    }

    .modal-address-bar,
    .modal-address-bar input {
        font-size: 12px !important;
    }

    .modal-header-title {
        font-size: 12px !important;
    }

    .modal-header-right {
        flex: 0 0 auto;
        gap: 4px;
    }

    .modal-header-action-btn {
        width: 24px !important;
        height: 24px !important;
        font-size: 16px !important;
        padding: 0 2px !important;
    }

    .expediente-section-title {
        font-size: 1.1em;
        margin: 1em 0 0.8em 0;
    }

    .expediente-content {
        font-size: 0.95em;
    }
}