/**
 * Estilos para Sistema de Filtros de PDFs por Ano - Versão 2.0
 * Adaptado para estrutura existente com Custom Post Types
 * Autor: Marcus Cordeiro - https://marcuscordeiro.com.br
 * Versão: 1.1.0
 * Data: 26/07/2025
 */

/* Importa fonte Manrope se não estiver carregada */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600&display=swap');

/* Container principal do filtro */
#filtro-pdfs-container-v2 {
    width: 100%;
    margin: 20px 0;
    font-family: 'Manrope', Arial, sans-serif;
    position: relative;
}

/* Menu de anos - Layout horizontal conforme especificação */
#menu-anos-v2 {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 30px;
    align-items: center;
    width: fit-content;
    max-width: 100%;
}

/* Botões individuais do menu anual - Especificação exata */
.botao-ano-v2 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 100px;
    height: 52px;
    padding: 16px 32px;
    border: 1px solid #DADADA;
    border-left: none;
    background-color: transparent;
    color: #222222;
    font-family: 'Manrope', Arial, sans-serif;
    font-weight: 600;
    font-style: normal;
    font-size: 15px;
    line-height: 100%;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
    margin: 0;
    outline: none;
}

/* Primeiro botão do menu (borda esquerda) */
.botao-ano-v2:first-child {
    border-left: 1px solid #DADADA;
}

/* Estado ativo do botão (ano selecionado) - Especificação exata */
.botao-ano-v2.ativo {
    background-color: #2973CE;
    color: #FFFFFF;
    border-color: #2973CE;
    opacity: 1;
}

/* Estado hover dos botões - Especificação exata */
.botao-ano-v2:hover:not(.ativo) {
    border-color: #2973CE;
    color: #2973CE;
}

/* Container dos resultados */
#resultados-pdfs-v2 {
    width: 100%;
    margin-top: 20px;
}

/* Seção de categoria - Especificação exata */
.categoria-secao-v2 {
    margin-bottom: 30px;
}

/* Título da categoria - Especificação exata */
.categoria-titulo-v2 {
    font-family: 'Manrope', Arial, sans-serif;
    font-weight: 400;
    font-style: normal;
    font-size: 16px;
    line-height: 100%;
    letter-spacing: 0%;
    color: #222222;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #DADADA;
}

/* Lista de arquivos PDF */
.lista-pdfs-v2 {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Item individual do PDF */
.item-pdf-v2 {
    margin-bottom: 12px;
}

/* Link do arquivo PDF - Especificação exata */
.link-pdf-v2 {
    font-family: 'Manrope', Arial, sans-serif;
    font-weight: 400;
    font-style: normal;
    font-size: 20px;
    line-height: 100%;
    letter-spacing: 0%;
    color: #113663;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.link-pdf-v2:hover {
    color: #2973CE;
    text-decoration: underline;
}

/* Ícone do PDF */
.link-pdf-v2::before {
    content: "📄";
    margin-right: 8px;
    font-size: 16px;
}

/* Estado de carregamento */
.carregando-v2 {
    text-align: center;
    padding: 40px 20px;
    color: #666666;
    font-style: italic;
    font-family: 'Manrope', Arial, sans-serif;
}

/* Mensagem quando não há resultados */
.sem-resultados-v2 {
    text-align: center;
    padding: 40px 20px;
    color: #666666;
    font-style: italic;
    font-family: 'Manrope', Arial, sans-serif;
}

/* Mensagem inicial */
.mensagem-inicial {
    text-align: center;
    padding: 20px;
    color: #666666;
    font-family: 'Manrope', Arial, sans-serif;
    font-style: italic;
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 5px;
}

.loading-spinner {
    padding: 20px 30px;
    background: #f8f9fa;
    border: 1px solid #DADADA;
    border-radius: 5px;
    font-family: 'Manrope', Arial, sans-serif;
    font-size: 14px;
    color: #666666;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Informações adicionais do arquivo */
.info-arquivo {
    font-size: 12px;
    color: #888888;
    margin-left: 24px;
    font-family: 'Manrope', Arial, sans-serif;
}

/* Responsividade para tablets */
@media (max-width: 768px) {
    #menu-anos-v2 {
        justify-content: flex-start;
        gap: 0;
    }
    
    .botao-ano-v2 {
        min-width: 80px;
        padding: 12px 24px;
        font-size: 14px;
        height: 48px;
    }
    
    .categoria-titulo-v2 {
        font-size: 15px;
    }
    
    .link-pdf-v2 {
        font-size: 18px;
    }
}

/* Responsividade para mobile */
@media (max-width: 480px) {
    #filtro-pdfs-container-v2 {
        margin: 15px 0;
    }
    
    #menu-anos-v2 {
        flex-wrap: wrap;
        gap: 2px;
        justify-content: flex-start;
    }
    
    .botao-ano-v2 {
        min-width: 70px;
        height: 44px;
        padding: 10px 16px;
        font-size: 13px;
        margin-bottom: 2px;
    }
    
    .categoria-titulo-v2 {
        font-size: 14px;
        margin-bottom: 12px;
    }
    
    .link-pdf-v2 {
        font-size: 16px;
        line-height: 120%;
    }
    
    .item-pdf-v2 {
        margin-bottom: 10px;
    }
    
    .info-arquivo {
        margin-left: 20px;
        font-size: 11px;
    }
}

/* Animações suaves */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.categoria-secao-v2 {
    animation: fadeIn 0.5s ease-out;
}

.resultados-container {
    transition: opacity 0.3s ease;
}

.resultados-container.loading {
    opacity: 0.5;
}

/* Acessibilidade */
.botao-ano-v2:focus {
    outline: 2px solid #2973CE;
    outline-offset: 2px;
    z-index: 10;
}

.link-pdf-v2:focus {
    outline: 2px solid #113663;
    outline-offset: 2px;
}

/* Estados para leitores de tela */
.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;
}

/* Melhorias de performance */
.botao-ano-v2,
.link-pdf-v2 {
    will-change: transform, color, border-color;
}

/* Estilos para impressão */
@media print {
    #menu-anos-v2 {
        display: none;
    }
    
    .link-pdf-v2 {
        color: #000000 !important;
        text-decoration: underline;
    }
    
    .link-pdf-v2::after {
        content: " (" attr(href) ")";
        font-size: 12px;
        color: #666666;
    }
    
    .loading-overlay {
        display: none !important;
    }
}

/* Estilos específicos para quando não há categorias */
.sem-categoria .lista-pdfs-v2 {
    margin-top: 20px;
}

/* Contador de documentos */
.contador-documentos {
    font-family: 'Manrope', Arial, sans-serif;
    font-size: 14px;
    color: #666666;
    margin-bottom: 20px;
    text-align: right;
}

/* Separador visual entre anos */
.separador-anos {
    width: 1px;
    height: 30px;
    background-color: #DADADA;
    margin: 0 10px;
}

/* Estilo para anos sem documentos */
.botao-ano-v2.sem-documentos {
    opacity: 0.5;
    cursor: not-allowed;
}

.botao-ano-v2.sem-documentos:hover {
    border-color: #DADADA;
    color: #222222;
}

/* Tooltip para anos sem documentos */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
}

/* Melhorias de contraste para acessibilidade */
@media (prefers-contrast: high) {
    .botao-ano-v2 {
        border-color: #000000;
        color: #000000;
    }
    
    .botao-ano-v2.ativo {
        background-color: #000000;
        color: #FFFFFF;
        border-color: #000000;
    }
    
    .link-pdf-v2 {
        color: #000080;
    }
}

/* Modo escuro */
@media (prefers-color-scheme: dark) {
    #filtro-pdfs-container-v2 {
        color: #ffffff;
    }
    
    .botao-ano-v2 {
        background-color: #2a2a2a;
        color: #ffffff;
        border-color: #555555;
    }
    
    .categoria-titulo-v2 {
        color: #ffffff;
        border-bottom-color: #555555;
    }
    
    .link-pdf-v2 {
        color: #4a9eff;
    }
    
    .loading-overlay {
        background: rgba(42, 42, 42, 0.9);
    }
    
    .loading-spinner {
        background: #2a2a2a;
        border-color: #555555;
        color: #ffffff;
    }
}
