/**
 * CSS para conteudos.php
 * Página de listagem de conteúdos
 */

/* ============================================
   LAYOUT ESTÁVEL - SEM "PULO" NO CARREGAMENTO
   ============================================ */

/* Prevenir scroll horizontal */
body {
    overflow-x: hidden;
    max-width: 100%;
}

/* Reservar espaço fixo para o header principal */
main {
    padding-top: 0;
}

/* Prevenir layout shift durante carregamento */
.hero-article,
.secondary-card,
.tertiary-card {
    opacity: 0;
    animation: fadeInUp 0.4s ease-out forwards;
}

/* Delay progressivo para efeito cascata suave */
.hero-article {
    animation-delay: 0.1s;
}

.secondary-card:nth-child(1) { animation-delay: 0.15s; }
.secondary-card:nth-child(2) { animation-delay: 0.2s; }
.secondary-card:nth-child(3) { animation-delay: 0.25s; }
.secondary-card:nth-child(4) { animation-delay: 0.3s; }

.tertiary-card:nth-child(1) { animation-delay: 0.35s; }
.tertiary-card:nth-child(2) { animation-delay: 0.4s; }
.tertiary-card:nth-child(3) { animation-delay: 0.45s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Skeleton loading para imagens */
.hero-article img,
.secondary-card img,
.tertiary-card img {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
}

/* Altura mínima para evitar "pulo" */
.hero-article {
    min-height: 450px;
}

@media (max-width: 768px) {
    .hero-article {
        min-height: 280px;
    }
}

.secondary-card {
    min-height: 380px;
}

@media (max-width: 768px) {
    .secondary-card {
        min-height: 320px;
    }
}

.tertiary-card {
    min-height: 100px;
}

/* Custom max-width: 1450px */
.max-w-custom {
    max-width: 1450px;
}

/* Portal-style cards */
.hero-article {
    position: relative;
    height: 450px;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.hero-article img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.hero-article:hover img {
    transform: scale(1.05);
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 50%, transparent 100%);
}

.hero-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem;
    color: white;
}

.secondary-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 100%;
    min-height: 380px;
    display: flex;
    flex-direction: column;
}

.secondary-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.tertiary-card {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.tertiary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.1);
}

.tag-pill {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    background: #f3f4f6;
    color: #374151;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    transition: all 0.2s ease;
}

.tag-pill:hover {
    background: #9333EA;
    color: white;
}

.banner-slot {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    border: 2px dashed #e5e7eb;
    border-radius: 8px;
    padding-left: 20px;
}

/* Scrollbar hide para filtros */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

@media (max-width: 768px) {
    .hero-article {
        height: 280px;
        border-radius: 12px;
    }
    
    .hero-content {
        padding: 1rem;
    }
    
    .hero-content h2 {
        font-size: 1.25rem;
        line-height: 1.4;
        margin-bottom: 0.5rem;
    }
    
    .hero-content p {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }
    
    .banner-slot {
        min-height: 60px;
    }
    
    .secondary-card {
        min-height: 320px;
    }
    
    .tertiary-card {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    /* Scroll horizontal suave para pills */
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }
    
    .overflow-x-auto > a {
        scroll-snap-align: start;
    }
}

/* Estilos para Seções de Categoria */
.category-section {
    scroll-margin-top: 2rem;
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

.category-section h2 a {
    transition: all 0.2s ease;
}

.category-section h2 a:hover {
    opacity: 0.8;
}

.category-section:nth-child(1) { animation-delay: 0.1s; }
.category-section:nth-child(2) { animation-delay: 0.2s; }
.category-section:nth-child(3) { animation-delay: 0.3s; }
.category-section:nth-child(4) { animation-delay: 0.4s; }
.category-section:nth-child(5) { animation-delay: 0.5s; }
.category-section:nth-child(6) { animation-delay: 0.6s; }

/* Melhorar espaçamento entre seções */
.category-section + .category-section {
    margin-top: 3rem;
}

@media (max-width: 768px) {
    .category-section {
        margin-bottom: 2rem;
    }
    
    .category-section + .category-section {
        margin-top: 2rem;
    }
}

/* ============================================
   LAZY LOADING COM SHIMMER EFFECT
   ============================================ */
.lazy-image {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 20%,
        #e0e0e0 40%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.lazy-image.loading {
    opacity: 1;
}

.lazy-image.loaded {
    opacity: 1 !important;
    background: none;
    animation: none;
}

.lazy-image.error {
    opacity: 1;
    background: #f3f4f6;
    animation: none;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   CATEGORIA V4 - LISTAGEM POR MES/ANO
   ============================================ */
.month-section {
    margin-bottom: 2.5rem;
}

.month-section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0;
}

.month-section-heading h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
}

.month-section-heading span {
    font-size: 0.75rem;
    font-weight: 600;
    color: #7c3aed;
    background: #f5f3ff;
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
}

.month-section-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.line-clamp-2,
.line-clamp-3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    -webkit-line-clamp: 2;
}

.line-clamp-3 {
    -webkit-line-clamp: 3;
}

@media (min-width: 640px) {
    .month-section-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }
}

@media (min-width: 1024px) {
    .month-section-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 1.25rem;
    }
}

.loading-spinner {
    border: 3px solid #e5e7eb;
    border-top-color: #7c3aed;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

@media (max-width: 1023px) {
    .category-header-v4 {
        position: relative !important;
        top: auto !important;
        height: 56px !important;
        z-index: 10 !important;
        box-shadow: none !important;
    }

    .category-header-v4 .category-header-pattern {
        opacity: 0.12 !important;
    }

    .category-header-v4 .category-header-inner {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .category-header-v4 .category-icon-box {
        width: 2.25rem !important;
        height: 2.25rem !important;
        border-radius: 0.5rem !important;
    }

    .category-header-v4 .category-icon-box i {
        font-size: 1rem !important;
    }

    .category-filter-bar-v4 {
        display: none !important;
    }

    .mobile-category-hero-v4 a {
        height: 390px !important;
    }

    .category-month-timeline-v4 .timeline-heading p,
    .category-month-timeline-v4 #contadorResultados,
    .month-section-heading > span,
    .month-section-heading .month-count {
        display: none !important;
    }

    .category-secondary-highlights-v4 {
        height: 390px !important;
    }

    .category-secondary-highlights-v4 {
        background: #ffffff !important;
        border-bottom: 0 !important;
    }

    .category-secondary-highlights-v4 .secondary-heading {
        display: none !important;
    }

    .category-secondary-highlights-v4 .secondary-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .category-secondary-highlights-v4 article {
        border: 0 !important;
        border-radius: 0.75rem !important;
        box-shadow: none !important;
        background: #ffffff !important;
    }

    .category-secondary-highlights-v4 article a {
        display: flex;
        gap: 0.75rem;
        padding: 0;
    }

    .category-secondary-highlights-v4 article .secondary-thumb {
        width: 7.5rem;
        height: 5.25rem;
        flex-shrink: 0;
        border-radius: 0.5rem;
    }

    .category-secondary-highlights-v4 article .secondary-card-body {
        min-width: 0;
        padding: 0 !important;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .category-secondary-highlights-v4 article:first-child a {
        display: block;
    }

    .category-secondary-highlights-v4 article:first-child .secondary-thumb {
        width: 100%;
        height: 12rem;
        border-radius: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .category-secondary-highlights-v4 article:first-child .secondary-card-body {
        display: block;
    }

    .category-secondary-highlights-v4 h3,
    .category-main-list-v4 h3 {
        -webkit-line-clamp: 3 !important;
        font-size: 0.95rem !important;
        line-height: 1.25 !important;
    }

    .category-main-list-v4 {
        padding-top: 1.25rem !important;
    }

    .category-main-list-v4 .main-list-heading {
        margin-bottom: 1rem !important;
    }

    .category-main-list-v4 .main-list-heading p,
    .category-main-list-v4 #contadorResultados {
        display: none !important;
    }

    .category-main-list-v4 #feedsGrid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .category-main-list-v4 .feed-item {
        border: 0 !important;
        border-radius: 0.75rem !important;
        box-shadow: none !important;
        background: #ffffff !important;
    }

    .category-main-list-v4 .feed-item a {
        display: flex;
        gap: 0.75rem;
        padding: 0;
    }

    .category-main-list-v4 .feed-thumb {
        width: 7.25rem;
        height: 5rem;
        flex-shrink: 0;
        border-radius: 0.5rem;
    }

    .category-main-list-v4 .feed-card-body {
        min-width: 0;
        padding: 0 !important;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .category-main-list-v4 .feed-summary {
        display: none;
    }

    .category-main-list-v4 .feed-item:nth-child(6n+1) a {
        display: block;
    }

    .category-main-list-v4 .feed-item:nth-child(6n+1) .feed-thumb {
        width: 100%;
        height: 12rem;
        border-radius: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .category-main-list-v4 .feed-item:nth-child(6n+1) .feed-card-body {
        display: block;
    }

    .category-main-list-v4 .feed-item:nth-child(6n+1) .feed-summary {
        display: none !important;
    }

    .category-secondary-highlights-v4 {
        height: auto !important;
        overflow: visible !important;
        padding: 0.25rem 0 0.75rem !important;
    }

    .category-secondary-highlights-v4 .max-w-custom,
    .category-month-timeline-v4 .max-w-custom {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .category-secondary-highlights-v4 .secondary-grid,
    .month-section-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .category-secondary-highlights-v4 article,
    .category-main-list-v4 .feed-item {
        width: 100% !important;
        min-width: 0 !important;
        overflow: visible !important;
        position: relative !important;
        clear: both !important;
    }

    .category-secondary-highlights-v4 article a,
    .category-secondary-highlights-v4 article:first-child a,
    .category-main-list-v4 .feed-item a,
    .category-main-list-v4 .feed-item:nth-child(6n+1) a {
        display: flex !important;
        align-items: flex-start !important;
        gap: 0.875rem !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .category-secondary-highlights-v4 article .secondary-thumb,
    .category-secondary-highlights-v4 article:first-child .secondary-thumb,
    .category-main-list-v4 .feed-thumb,
    .category-main-list-v4 .feed-item:nth-child(6n+1) .feed-thumb {
        width: 9rem !important;
        height: 6.25rem !important;
        flex: 0 0 9rem !important;
        border-radius: 0.5rem !important;
        margin: 0 !important;
        overflow: hidden !important;
    }

    .category-secondary-highlights-v4 img,
    .category-main-list-v4 img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        transform: none !important;
    }

    .category-secondary-highlights-v4 article .secondary-card-body,
    .category-secondary-highlights-v4 article:first-child .secondary-card-body,
    .category-main-list-v4 .feed-card-body,
    .category-main-list-v4 .feed-item:nth-child(6n+1) .feed-card-body {
        display: flex !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        padding: 0 !important;
        flex-direction: column !important;
        justify-content: center !important;
    }

    .category-secondary-highlights-v4 h3,
    .category-main-list-v4 h3 {
        font-size: 1rem !important;
        line-height: 1.15 !important;
        margin: 0 0 0.5rem !important;
        word-break: normal !important;
        overflow-wrap: anywhere !important;
    }

    .category-secondary-highlights-v4 .secondary-card-body > div,
    .category-main-list-v4 .feed-card-body > div {
        min-width: 0 !important;
    }

    .month-section {
        margin-bottom: 1.5rem !important;
    }

    .month-section-heading {
        display: block !important;
        margin-bottom: 0.875rem !important;
    }
}

