/* ===== Redação BR — Layout Hierárquico ===== */
/* Design inspirado em G1, UOL, CNN Brasil */

:root {
    --primary: #c62828;
    --primary-dark: #b71c1c;
    --primary-light: #ef5350;
    --accent: #ffd600;
    --bg: #f5f5f5;
    --bg-card: #ffffff;
    --text: #212121;
    --text-light: #757575;
    --text-white: #ffffff;
    --border: #e0e0e0;
    --header-height: 60px;
    --max-width: 1200px;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.15);
    --transition: 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ===== HEADER ===== */
.header {
    background: var(--primary);
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    height: var(--header-height);
    gap: 16px;
}

.header h1 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.header h1 a { color: white; text-decoration: none; }

/* Busca */
.search-box {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    outline: none;
    background: rgba(255,255,255,0.15);
    color: white;
    transition: background 0.3s;
}

.search-box input::placeholder { color: rgba(255,255,255,0.7); }
.search-box input:focus { background: rgba(255,255,255,0.25); }
.search-box .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); opacity: 0.7; }

.local-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    background: rgba(255,255,255,0.15);
    padding: 4px 10px;
    border-radius: 12px;
    white-space: nowrap;
    cursor: pointer;
}

.local-badge .pulsing {
    width: 8px; height: 8px;
    background: #66bb6a;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
}

/* ===== NAVEGAÇÃO ===== */
.nav {
    background: white;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: var(--header-height);
    z-index: 99;
}

.nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.nav a {
    padding: 10px 20px;
    text-decoration: none;
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.nav a:hover { color: var(--primary); }
.nav a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== CONTEÚDO PRINCIPAL ===== */
.main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 20px 16px;
}

/* ===== SEÇÃO DESTAQUES (horizontal scroll) ===== */
.secao-destaques {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 0 0 20px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.secao-destaques::-webkit-scrollbar { display: none; }

.secao-card {
    min-width: 280px;
    flex-shrink: 0;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

.secao-card h3 {
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
}

.secao-item {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: opacity 0.2s;
}
.secao-item:last-child { border-bottom: none; }
.secao-item:hover { opacity: 0.8; }

.secao-item img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.secao-item h4 {
    font-size: 0.8rem;
    line-height: 1.3;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== TAGS COMPARTILHADAS ===== */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.tag-small { font-size: 0.6rem; padding: 1px 6px; }

.tag-internacional { background: #1565c0; color: white; }
.tag-nacional { background: var(--primary); color: white; }
.tag-regional { background: #2e7d32; color: white; }
.tag-opiniao { background: #6a1b9a; color: white; }
.tag { background: var(--primary); color: white; }
.tag-secao { background: #333; color: white; opacity: 0.85; }

/* ===== CAMADA 1: TOP LAYER (Hero + Side) ===== */
.top-layer {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
    min-height: 420px;
}

/* --- Hero (esquerda, grande) --- */
.hero {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    background: linear-gradient(135deg, var(--primary-dark), #4a0000);
    min-height: 420px;
    transition: box-shadow var(--transition);
}
.hero:hover { box-shadow: var(--shadow-lg); }

.hero-img {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0; left: 0;
    object-fit: cover;
}

.hero-img-placeholder {
    width: 100%;
    height: 100%;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    background: linear-gradient(135deg, var(--primary-dark), #4a0000);
    opacity: 0.5;
}

.hero-overlay {
    position: relative;
    height: 100%;
    min-height: 420px;
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: linear-gradient(transparent 30%, rgba(0,0,0,0.85) 100%);
    color: white;
}

.hero-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.hero h2 {
    font-size: 1.6rem;
    line-height: 1.25;
    margin-bottom: 10px;
    max-width: 95%;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.hero-resumo {
    font-size: 0.85rem;
    opacity: 0.9;
    max-width: 95%;
    margin-bottom: 16px;
    line-height: 1.5;
}

.hero-meta {
    font-size: 0.8rem;
    opacity: 0.7;
    display: flex;
    gap: 16px;
}

/* --- Top Side (direita, 2 cards) --- */
.top-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.side-card {
    flex: 1;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), box-shadow var(--transition);
    min-height: 0;
}
.side-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.side-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    flex-shrink: 0;
}

.side-img-placeholder {
    width: 100%;
    height: 140px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    opacity: 0.4;
}

.side-body {
    padding: 14px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.side-tags {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}

.side-body h3 {
    font-size: 0.9rem;
    line-height: 1.35;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-wrap: break-word;
    hyphens: auto;
}

.side-resumo {
    font-size: 0.75rem;
    color: var(--text-light);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: auto;
    word-wrap: break-word;
}

/* ===== CAMADA 2: FEATURED ROW ===== */
.featured-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.featured-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
}
.featured-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.featured-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.featured-img-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    opacity: 0.4;
}

.featured-body {
    padding: 16px;
}

.featured-body .tag {
    margin-bottom: 6px;
}

.featured-body h3 {
    font-size: 0.95rem;
    line-height: 1.35;
    margin: 8px 0 6px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-wrap: break-word;
}

.featured-resumo {
    font-size: 0.78rem;
    color: var(--text-light);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-wrap: break-word;
}

/* ===== CAMADA 3: GRID PADRÃO ===== */
.noticias-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.noticia-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
}
.noticia-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}

.card-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.card-img-placeholder {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, #ddd, #bbb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    opacity: 0.5;
}

.card-body {
    padding: 12px 14px;
}

.card-tags { margin-bottom: 4px; }

.card-body h3 {
    font-size: 0.82rem;
    line-height: 1.35;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-wrap: break-word;
}

.card-resumo {
    font-size: 0.72rem;
    color: var(--text-light);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
    word-wrap: break-word;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--text-light);
    border-top: 1px solid var(--border);
    padding-top: 6px;
}

/* ===== PÁGINA DA NOTÍCIA ===== */
.noticia-page {
    max-width: 720px;
    margin: 0 auto;
}

.noticia-page .categoria { margin-bottom: 8px; }

.noticia-page h1 {
    font-size: 1.8rem;
    line-height: 1.2;
    margin-bottom: 16px;
}

.noticia-page .meta {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 24px;
}

.noticia-page .meta span { margin-right: 16px; }

.noticia-page .imagem-principal {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.noticia-page .conteudo {
    font-size: 1.05rem;
    line-height: 1.8;
}

.noticia-page .conteudo p { margin-bottom: 16px; }

.noticia-page .fonte {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-light);
}

.noticia-page .btn-voltar {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

/* ===== PAGINAÇÃO ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.pagination a {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination a.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== FOOTER ===== */
.footer {
    background: #1a1a1a;
    color: #999;
    margin-top: 48px;
    padding: 32px 16px;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.footer h3 { color: white; font-size: 0.9rem; margin-bottom: 12px; }
.footer a { color: #999; text-decoration: none; display: block; margin-bottom: 6px; font-size: 0.85rem; }
.footer a:hover { color: white; }
.footer .copy { text-align: center; margin-top: 24px; padding-top: 24px; border-top: 1px solid #333; font-size: 0.8rem; }

/* ===== UTILITÁRIOS ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h2 { margin-bottom: 8px; }

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

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

/* ===== RESPONSIVO: TABLET ===== */
@media (max-width: 1024px) {
    .top-layer {
        grid-template-columns: 3fr 2fr;
    }
    .noticias-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .featured-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .hero h2 { font-size: 1.4rem; }
}

/* ===== RESPONSIVO: MOBILE GRANDE ===== */
@media (max-width: 768px) {
    .header-inner { padding: 0 12px; gap: 8px; }
    .header h1 { font-size: 1.1rem; }
    .search-box { max-width: 200px; }
    .local-badge span { display: none; }
    .menu-toggle { display: block; }

    .nav-inner { display: none; flex-direction: column; }
    .nav-inner.open { display: flex; }
    .nav a { padding: 12px 16px; border-bottom: 1px solid var(--border); }

    /* Empilha tudo em coluna única */
    .top-layer {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .hero { min-height: 280px; }
    .hero-overlay { min-height: 280px; padding: 20px; }
    .hero h2 { font-size: 1.3rem; max-width: 100%; }
    .hero-resumo { max-width: 100%; }

    .side-card { flex-direction: row; min-height: 110px; }
    .side-card img,
    .side-img-placeholder {
        width: 120px;
        height: 100%;
        flex-shrink: 0;
    }
    .side-body { padding: 10px 12px; }
    .side-body h3 { font-size: 0.85rem; -webkit-line-clamp: 3; }

    .featured-row {
        grid-template-columns: 1fr;
    }

    .featured-img { height: 160px; }

    .noticias-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .card-img { height: 110px; }

    .noticia-page h1 { font-size: 1.4rem; }
    .noticia-page .conteudo { font-size: 1rem; }
}

/* ===== RESPONSIVO: MOBILE PEQUENO ===== */
@media (max-width: 480px) {
    .header h1 { font-size: 1rem; }
    .search-box { max-width: 120px; }
    .search-box input { font-size: 0.8rem; padding: 6px 8px 6px 28px; }

    .noticias-grid {
        grid-template-columns: 1fr;
    }

    .side-card { flex-direction: column; }
    .side-card img,
    .side-img-placeholder {
        width: 100%;
        height: 120px;
    }

    .hero h2 { font-size: 1.1rem; }
}
