/* ==========================================================================
   PORTAL DE PUBLICAÇÕES OFICIAIS - PADRÃO APPLE HIG & MATERIAL DESIGN
   Inspirado no modelo oficial de publicações com filtros inteligentes
   ========================================================================== */

/* 1. CONTAINER PRINCIPAL */
.tpo-portal-wrapper,
.tpo-details-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1d1d1f;
    -webkit-font-smoothing: antialiased;
}

/* 2. CABEÇALHO DO PORTAL */
.tpo-header-section {
    text-align: left;
    margin-bottom: 28px;
}

.tpo-header-title {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    color: #1d1d1f;
    margin: 0 0 8px 0;
    letter-spacing: -0.02em;
}

.tpo-header-subtitle {
    font-size: 1.05rem;
    color: #86868b;
    margin: 0;
    font-weight: 400;
}

/* 3. BARRA DE FILTROS INTELIGENTE (APPLE CARD STYLE) */
.tpo-filters-card {
    background-color: #ffffff;
    border: 1px solid #e5e5ea;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.tpo-filters-card:hover {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.05);
}

.tpo-filters-grid {
    display: grid;
    grid-template-columns: 2.2fr 1.3fr 1.3fr 1fr 0.9fr auto;
    gap: 16px;
    align-items: flex-end;
}

.tpo-filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tpo-filter-field label {
    font-size: 11px;
    font-weight: 700;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tpo-filter-field input,
.tpo-filter-field select {
    height: 44px;
    padding: 0 14px;
    border: 1px solid #d2d2d7;
    border-radius: 10px;
    font-size: 14px;
    color: #1d1d1f;
    background-color: #f5f5f7;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

.tpo-filter-field select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2.5' 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 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.tpo-filter-field input:focus,
.tpo-filter-field select:focus {
    border-color: var(--color-primary, #0a2540);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(10, 37, 64, 0.12);
}

.tpo-filter-actions {
    display: flex;
    align-items: flex-end;
}

.tpo-btn-limpar {
    height: 44px;
    padding: 0 18px;
    background-color: #f5f5f7;
    color: #1d1d1f;
    border: 1px solid #d2d2d7;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tpo-btn-limpar:hover {
    background-color: #e5e5ea;
    border-color: #c7c7cc;
    transform: translateY(-1px);
}

/* 4. INFORMAÇÃO DO RESULTADO */
.tpo-info-resultado {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #86868b;
    margin-bottom: 14px;
    padding: 0 4px;
    font-weight: 500;
}

.tpo-info-resultado strong {
    color: #1d1d1f;
    font-weight: 700;
}

/* 5. TABELA DE PUBLICAÇÕES (APPLE TABLE STYLE) */
.tpo-tabela-wrapper {
    background-color: #ffffff;
    border: 1px solid #e5e5ea;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    margin-bottom: 24px;
    transition: opacity 0.25s ease;
}

.tpo-tabela {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.tpo-tabela thead th {
    background-color: #fbfbfd;
    color: #86868b;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e5ea;
}

.tpo-tabela tbody tr {
    border-bottom: 1px solid #f2f2f7;
    transition: background-color 0.18s ease;
}

.tpo-tabela tbody tr:last-child {
    border-bottom: none;
}

.tpo-tabela tbody tr:hover {
    background-color: #f9f9fb;
}

.tpo-tabela td {
    padding: 18px 20px;
    vertical-align: middle;
    color: #1d1d1f;
}

/* Tags de Categorias Coloridas (Inspiradas em Itacambira com paleta refinada Apple) */
.tpo-cat-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #ffffff;
    white-space: nowrap;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.cat-portaria { background-color: #e05252; }
.cat-resolucao { background-color: #16a34a; }
.cat-decreto { background-color: #2563eb; }
.cat-edital, .cat-chamamento { background-color: #d97706; }
.cat-certidao { background-color: #ea580c; }
.cat-lei { background-color: #7c3aed; }
.cat-concurso, .cat-processo-seletivo { background-color: #0284c7; }
.cat-default { background-color: #6b7280; }

/* Número do ato */
.tpo-col-numero {
    font-weight: 700;
    font-size: 14px;
    color: #1d1d1f;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Ementa */
.tpo-col-ementa {
    line-height: 1.5;
}

.tpo-ementa-link {
    color: #1d1d1f;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.tpo-ementa-link:hover {
    color: var(--color-primary, #007aff);
    text-decoration: underline;
}

/* Data de publicação */
.tpo-col-data {
    color: #515154;
    font-size: 13px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Badges de Situação (Pill Shape) */
.tpo-situacao-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.situacao-em-vigor {
    background-color: #d1fae5;
    color: #065f46;
}

.situacao-alterada {
    background-color: #e0f2fe;
    color: #0369a1;
}

.situacao-suspensa {
    background-color: #ffedd5;
    color: #c2410c;
}

.situacao-revogada-parcialmente,
.situacao-revogada-totalmente {
    background-color: #fee2e2;
    color: #b91c1c;
}

.situacao-inconstitucional,
.situacao-anulada {
    background-color: #f3e8ff;
    color: #6b21a8;
}

.situacao-vigencia-esgotada {
    background-color: #f3f4f6;
    color: #4b5563;
}

/* Botões de Ações */
.tpo-acoes-buttons {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.tpo-btn-acao {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.tpo-btn-detalhes {
    background-color: #f5f5f7;
    color: #1d1d1f;
    border: 1px solid #d2d2d7;
}

.tpo-btn-detalhes:hover {
    background-color: #e5e5ea;
    border-color: #c7c7cc;
    color: #000000;
    transform: translateY(-1px);
}

.tpo-btn-pdf {
    background-color: #dc2626;
    color: #ffffff;
    border: 1px solid transparent;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.2);
}

.tpo-btn-pdf:hover {
    background-color: #b91c1c;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.3);
}

/* 6. ESTADO VAZIO (EMPTY STATE) */
.tpo-empty-state {
    padding: 60px 20px;
    text-align: center;
    color: #86868b;
}

.tpo-empty-state i {
    font-size: 3rem;
    color: #d2d2d7;
    margin-bottom: 16px;
    display: block;
}

.tpo-empty-state p {
    font-size: 1.05rem;
    margin: 0;
}

/* 7. PAGINAÇÃO (APPLE HIG / MATERIAL DESIGN) */
.tpo-paginacao-wrapper {
    margin-top: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.tpo-paginacao-list {
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0;
    padding: 6px 10px;
    background-color: #ffffff;
    border: 1px solid #e5e5ea;
    border-radius: 9999px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
}

.tpo-paginacao-list .page-item {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tpo-paginacao-list .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: #1d1d1f;
    background-color: transparent;
    border: 1px solid transparent;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    user-select: none;
    font-variant-numeric: tabular-nums;
}

.tpo-paginacao-list .page-link:hover:not(.disabled):not(.active) {
    background-color: #f5f5f7;
    border-color: #d2d2d7;
    color: #000000;
    transform: translateY(-1px);
}

.tpo-paginacao-list .page-item.active .page-link,
.tpo-paginacao-list .page-link.active {
    background-color: var(--color-primary, #0a2540);
    color: #ffffff;
    border-color: var(--color-primary, #0a2540);
    box-shadow: 0 4px 12px rgba(10, 37, 64, 0.28);
    cursor: default;
    pointer-events: none;
}

.tpo-paginacao-list .prev-next-btn {
    padding: 0 16px;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
    background-color: #f5f5f7;
    border: 1px solid #e5e5ea;
    color: #1d1d1f;
}

.tpo-paginacao-list .prev-next-btn:hover:not(.disabled) {
    background-color: #ffffff;
    border-color: #c7c7cc;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.tpo-paginacao-list .page-item.disabled .page-link,
.tpo-paginacao-list .page-link.disabled {
    opacity: 0.35;
    background-color: #f5f5f7;
    border-color: #e5e5ea;
    color: #86868b;
    cursor: not-allowed;
    pointer-events: none;
}

.tpo-paginacao-list .page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 40px;
    font-size: 16px;
    color: #86868b;
}

/* 8. PÁGINA DE DETALHES (SINGLE DOCUMENT VIEW) */
.tpo-details-card {
    background-color: #ffffff;
    border: 1px solid #e5e5ea;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
}

.tpo-details-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f2f2f7;
    flex-wrap: wrap;
    gap: 12px;
}

.tpo-btn-voltar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #007aff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.tpo-btn-voltar:hover {
    transform: translateX(-3px);
    text-decoration: underline;
}

.tpo-details-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: #1d1d1f;
    margin: 0 0 16px 0;
    line-height: 1.3;
}

.tpo-details-ementa {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #3a3a3c;
    margin-bottom: 32px;
    padding: 20px 24px;
    background-color: #fbfbfd;
    border-left: 4px solid var(--color-primary, #0a2540);
    border-radius: 0 12px 12px 0;
}

.tpo-details-grid-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    background-color: #f5f5f7;
    padding: 24px;
    border-radius: 14px;
    margin-bottom: 32px;
}

.tpo-meta-item strong {
    display: block;
    font-size: 11px;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.tpo-meta-item span {
    font-size: 15px;
    font-weight: 600;
    color: #1d1d1f;
}

.tpo-details-main-action {
    display: flex;
    justify-content: center;
    margin-bottom: 36px;
}

.tpo-btn-download-main {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: #dc2626;
    color: #ffffff;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
    transition: all 0.25s ease;
}

.tpo-btn-download-main:hover {
    background-color: #b91c1c;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
}

.tpo-anexos-section {
    border-top: 1px solid #e5e5ea;
    padding-top: 28px;
}

.tpo-anexos-section h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.tpo-anexos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.tpo-anexo-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #e5e5ea;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

/* 9. RESPONSIVIDADE MOBILE (TABLET & CELULAR) */
@media (max-width: 992px) {
    .tpo-filters-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .tpo-filters-grid {
        grid-template-columns: 1fr;
    }

    /* Transforma a tabela em cartões no mobile */
    .tpo-tabela thead {
        display: none;
    }

    .tpo-tabela,
    .tpo-tabela tbody,
    .tpo-tabela tr,
    .tpo-tabela td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .tpo-tabela tr {
        margin-bottom: 16px;
        border: 1px solid #e5e5ea;
        border-radius: 14px;
        background-color: #ffffff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
        padding: 14px;
    }

    .tpo-tabela td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid #f2f2f7;
    }

    .tpo-tabela td:last-child {
        border-bottom: none;
        padding-top: 12px;
        justify-content: flex-end;
    }

    .tpo-tabela td::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 700;
        color: #86868b;
        text-transform: uppercase;
        margin-right: 12px;
    }

    .tpo-col-ementa {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .tpo-col-ementa::before {
        margin-bottom: 4px;
    }

    .tpo-details-card {
        padding: 24px 18px;
    }
}

/* Evita duplicação do título se o tema já exibir o internal-page-header */
.publicacoes-page-wrapper .tpo-header-section,
.internal-content-wrapper .tpo-header-section {
    display: none;
}

