/**
 * Estilos Frontend do Módulo de Notícias & Feed Instagram (GovTech Suite)
 * Inspirado nas Diretrizes de Design da Apple (Human Interface Guidelines)
 */

:root {
    --tn-blue: #007aff;
    --tn-gray-bg: #f2f2f7;
    --tn-card-bg: #ffffff;
    --tn-border: #e5e5ea;
    --tn-text-primary: #1d1d1f;
    --tn-text-secondary: #86868b;
    --tn-green: #34c759;
}

/* Container Principal */
.tn-portal-wrapper, .tn-single-container {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Icons", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: var(--tn-text-primary);
    max-width: 1000px;
    margin: 30px auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* ==========================================================================
   Seção de Busca e Filtros
   ========================================================================== */
.tn-search-filter-section {
    margin-bottom: 35px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tn-search-form {
    width: 100%;
}

.tn-search-box {
    display: flex;
    align-items: center;
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.tn-search-box input[type="text"] {
    width: 100%;
    padding: 12px 45px 12px 18px;
    border: 1px solid var(--tn-border);
    background-color: #fafafc;
    border-radius: 12px;
    font-size: 0.92rem;
    outline: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.tn-search-box input[type="text"]:focus {
    border-color: var(--color-primary, var(--tn-blue));
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
}

.tn-btn-search {
    position: absolute;
    right: 6px;
    background: none;
    border: none;
    color: var(--tn-text-secondary);
    cursor: pointer;
    font-size: 1.05rem;
    padding: 8px 12px;
    transition: color 0.2s ease;
}

.tn-btn-search:hover {
    color: var(--color-primary, var(--tn-blue));
}

/* Pílulas de Categorias (Horizontal Scroll) */
.tn-category-pills {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 0 12px 0;
    scrollbar-width: none; /* Firefox */
}

.tn-category-pills::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.tn-pill {
    white-space: nowrap;
    display: inline-block;
    padding: 8px 18px;
    background: #ffffff;
    border: 1px solid var(--tn-border);
    border-radius: 20px;
    font-size: 0.88rem;
    font-weight: 500;
    color: #48484a;
    text-decoration: none !important;
    transition: all 0.25s ease;
}

.tn-pill:hover {
    background: var(--tn-gray-bg);
    border-color: var(--pill-hover-color, var(--tn-blue));
    color: var(--pill-hover-color, var(--tn-blue));
}

.tn-pill.active {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

/* ==========================================================================
   Grid e Cards de Notícias (Apple HIG Style)
   ========================================================================== */
.tn-news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 28px;
    margin-bottom: 40px;
}

.tn-card-noticia {
    background: var(--tn-card-bg);
    border: 1px solid var(--tn-border);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.015);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tn-card-noticia:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.05);
    border-color: var(--color-primary, var(--tn-blue));
}

.tn-noticia-thumbnail {
    height: 200px;
    background-size: cover;
    background-position: center;
    background-color: var(--tn-gray-bg);
    border-bottom: 1px solid var(--tn-border);
}

.tn-noticia-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.tn-meta-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.tn-card-badge {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tn-noticia-date {
    font-size: 0.78rem;
    color: var(--tn-text-secondary);
}

.tn-card-divider {
    border: none;
    border-top: 1px solid #f2f2f7;
    margin: 8px 0 14px 0;
}

.tn-noticia-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 10px 0;
}

.tn-noticia-title a {
    color: var(--tn-text-primary);
    text-decoration: none !important;
}

.tn-noticia-title a:hover {
    color: var(--color-primary, var(--tn-blue));
}

.tn-noticia-excerpt {
    font-size: 0.88rem;
    color: var(--tn-text-secondary);
    line-height: 1.5;
    margin: 0 0 20px 0;
    flex-grow: 1;
}

.tn-btn-more {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: auto;
    transition: transform 0.2s ease;
}

.tn-btn-more:hover {
    transform: translateX(3px);
}

/* ==========================================================================
   Paginação
   ========================================================================== */
.tn-pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.tn-pagination ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 6px;
    background: var(--tn-gray-bg);
    padding: 4px;
    border-radius: 20px;
}

.tn-pagination li a, .tn-pagination li span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    text-decoration: none !important;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--tn-text-primary);
    transition: all 0.2s ease;
}

.tn-pagination li a:hover {
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.tn-pagination li span.current {
    background: var(--color-primary, var(--tn-blue));
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(0, 122, 255, 0.3);
}

/* ==========================================================================
   Página Individual da Notícia (single-noticia.php)
   ========================================================================== */
.tn-single-header {
    max-width: 800px;
    margin: 0 auto 30px auto;
    text-align: left;
}

.tn-single-cat-badge {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: block;
    margin-bottom: 12px;
}

.tn-single-title {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.5px;
    color: var(--tn-text-primary);
    margin: 0 0 12px 0;
}

.tn-single-subtitle {
    font-size: 1.15rem;
    color: #48484a;
    line-height: 1.5;
    margin: 0 0 20px 0;
    font-weight: 400;
}

.tn-single-meta {
    border-bottom: 1px solid var(--tn-border);
    padding-bottom: 18px;
    font-size: 0.88rem;
    color: var(--tn-text-secondary);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tn-meta-author-row {
    font-weight: 500;
    color: var(--tn-text-primary);
}

.tn-meta-sep {
    color: var(--tn-border);
    margin: 0 8px;
}

.tn-meta-sec-link {
    color: var(--color-primary, var(--tn-blue));
    text-decoration: none !important;
}
.tn-meta-sec-link:hover {
    text-decoration: underline !important;
}

.tn-single-featured-box {
    max-width: 800px;
    margin: 30px auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.tn-single-featured-box img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.tn-single-content {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.05rem;
    line-height: 1.7;
    color: #1c1c1e;
}

.tn-single-content p {
    margin-bottom: 20px;
}

/* Galeria de Fotos */
.tn-single-gallery-section, .tn-single-attachments-section {
    max-width: 800px;
    margin: 45px auto;
}

.tn-section-heading {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--tn-text-primary);
    border-bottom: 1px solid var(--tn-border);
    padding-bottom: 8px;
}

.tn-section-heading i {
    color: var(--color-primary, var(--tn-blue));
    margin-right: 6px;
}

.tn-gallery-masonry {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.tn-gallery-item {
    border-radius: 12px;
    overflow: hidden;
    display: block;
    border: 1px solid var(--tn-border);
    transition: all 0.25s ease;
    height: 140px;
}

.tn-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.tn-gallery-item:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

/* Anexos e Arquivos */
.tn-attachments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.tn-attachment-card {
    background: #f8f9fa;
    border: 1px solid var(--tn-border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none !important;
    transition: all 0.25s ease;
}

.tn-attachment-card:hover {
    background: #ffffff;
    border-color: var(--color-primary, var(--tn-blue));
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.tn-attach-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(0, 122, 255, 0.08);
    color: var(--color-primary, var(--tn-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.tn-attach-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.tn-attach-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--tn-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tn-attach-size {
    font-size: 0.75rem;
    color: var(--tn-text-secondary);
}

.tn-attach-btn {
    color: var(--tn-text-secondary);
    font-size: 1rem;
    transition: color 0.2s ease;
}

.tn-attachment-card:hover .tn-attach-btn {
    color: var(--color-primary, var(--tn-blue));
}

/* ==========================================================================
   Navegação Inferior (Notícia Anterior / Próxima)
   ========================================================================== */
.tn-navigation-divider {
    border: none;
    border-top: 1px solid var(--tn-border);
    margin: 40px auto;
    max-width: 800px;
}

.tn-adjacent-navigation {
    display: flex;
    gap: 24px;
    max-width: 800px;
    margin: 0 auto 40px auto;
}

.tn-nav-block {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tn-nav-block.full-width {
    flex: 2;
}

.tn-nav-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--tn-text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tn-nav-next .tn-nav-label {
    justify-content: flex-end;
}

.tn-nav-card {
    background: #ffffff;
    border: 1px solid var(--tn-border);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    gap: 14px;
    text-decoration: none !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    height: 100px;
    box-sizing: border-box;
}

.tn-nav-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-primary, var(--tn-blue));
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.04);
}

.tn-nav-img {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    background-color: var(--tn-gray-bg);
    flex-shrink: 0;
    border: 1px solid var(--tn-border);
}

.tn-nav-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
    text-align: left;
}

.tn-nav-next .tn-nav-details {
    text-align: right;
}

.tn-nav-next .tn-nav-card {
    flex-direction: row-reverse;
}

.tn-nav-date {
    font-size: 0.72rem;
    color: var(--tn-text-secondary);
}

.tn-nav-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--tn-text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tn-nav-excerpt {
    font-size: 0.78rem;
    color: var(--tn-text-secondary);
    line-height: 1.3;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Botões de Ação Inferiores */
.tn-back-action {
    max-width: 800px;
    margin: 40px auto 0 auto;
    text-align: left;
}

.tn-btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid var(--tn-border);
    background: #ffffff;
    border-radius: 8px;
    color: var(--tn-text-primary);
    text-decoration: none !important;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.tn-btn-back:hover {
    background: var(--tn-gray-bg);
}

.tn-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--tn-text-secondary);
}

.tn-empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.4;
}

@media (max-width: 768px) {
    .tn-adjacent-navigation {
        flex-direction: column;
        gap: 16px;
    }
    .tn-nav-card {
        height: auto;
    }
    .tn-nav-excerpt {
        display: none;
    }
}

/* ==========================================================================
   Layout de Lista de Notícias (Modo Listagem - /noticias)
   ========================================================================== */
.tn-news-list-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 40px;
}

.tn-list-noticia {
    background: var(--tn-card-bg);
    border: 1px solid var(--tn-border);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.015);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
}

.tn-list-noticia:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.04);
    border-color: var(--color-primary, var(--tn-blue));
}

.tn-list-thumbnail {
    width: 260px;
    height: 180px;
    background-size: cover;
    background-position: center;
    background-color: var(--tn-gray-bg);
    flex-shrink: 0;
    transition: transform 0.5s ease;
}

.tn-list-noticia:hover .tn-list-thumbnail {
    transform: scale(1.02);
}

.tn-list-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    min-width: 0;
}

.tn-list-meta-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.tn-list-badge {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tn-list-date {
    font-size: 0.78rem;
    color: var(--tn-text-secondary);
}

.tn-list-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 10px 0;
}

.tn-list-title a {
    color: var(--tn-text-primary);
    text-decoration: none !important;
}

.tn-list-title a:hover {
    color: var(--color-primary, var(--tn-blue));
}

.tn-list-excerpt {
    font-size: 0.88rem;
    color: var(--tn-text-secondary);
    line-height: 1.5;
    margin: 0 0 16px 0;
}

.tn-list-btn-more {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: transform 0.2s ease;
    align-self: flex-start;
}

.tn-list-btn-more:hover {
    transform: translateX(3px);
}

/* Responsividade para Lista */
@media (max-width: 768px) {
    .tn-list-noticia {
        flex-direction: column;
    }
    .tn-list-thumbnail {
        width: 100%;
        height: 180px;
    }
    .tn-list-content {
        padding: 20px;
    }
}
