/* ========================================
   NOTICIA - ESTILOS MODERNOS
   Adaptado aos temas claro/escuro
   ======================================== */

/* ========================================
   0. RESET E AJUSTES ESPECÍFICOS
   ======================================== */
/* Garante que o page-container da notícia se comporta como esperado */
.main-content .page-container {
  width: 100%;
  max-width: 100%;
  padding: var(--spacing-8);
  box-sizing: border-box;
}

/* Garantir que todos os elementos dentro da página de notícia respeitem os containers */
.noticia-container,
.noticia-conteudo,
.noticia-sidebar {
  min-width: 0;
  overflow-wrap: break-word;
}

/* ========================================
   1. CONTAINER PRINCIPAL DA NOTÍCIA
   ======================================== */
.noticia-container {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--spacing-6);
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ========================================
   2. ARTIGO PRINCIPAL
   ======================================== */
.noticia-conteudo {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-6);
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.4s ease-out;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Título da Notícia */
.noticia-titulo {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  line-height: 1.3;
  margin: 0 0 var(--spacing-5);
  padding-bottom: var(--spacing-4);
  border-bottom: 3px solid var(--primary-color);
}

/* Imagem de Capa */
.capa-noticia {
  width: 100%;
  max-height: 500px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-5);
  box-shadow: var(--shadow-md);
}

/* Informações da Notícia */
.noticia-info {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-4);
  align-items: center;
  padding: var(--spacing-4) var(--spacing-5);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-5);
  border-left: 4px solid var(--primary-color);
  box-shadow: var(--shadow-sm);
}

/* Categoria - Elemento principal e mais destacado */
.categoria-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--spacing-1) var(--spacing-3);
  background: var(--primary-color);
  color: #ffffff;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-right: auto;
}

/* Container para data e tempo de leitura */
.noticia-info-meta {
  display: flex;
  align-items: center;
  gap: var(--spacing-5);
  flex-wrap: wrap;
}

.data-noticia {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  white-space: nowrap;
}

.data-noticia::before {
  content: "";
  width: 18px;
  height: 18px;
  background-image: url('img/icon/calendar-check.svg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.8;
  flex-shrink: 0;
}

.tempo-leitura {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

.tempo-leitura::before {
  content: "";
  width: 18px;
  height: 18px;
  background-image: url('img/icon/clock.svg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.8;
  flex-shrink: 0;
}

/* Separador visual entre elementos */
.data-noticia::after {
  content: "";
  width: 1px;
  height: 16px;
  background: var(--border-primary);
  margin-left: var(--spacing-3);
}

/* Conteúdo HTML */
.conteudo-html {
  font-size: var(--font-size-base);
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: var(--spacing-6);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Garantir que todos os elementos filhos respeitem o container */
.conteudo-html > * {
  max-width: 100%;
  box-sizing: border-box;
}

.conteudo-html p {
  margin-bottom: var(--spacing-4);
  text-align: justify;
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.conteudo-html h2,
.conteudo-html h3,
.conteudo-html h4 {
  color: var(--text-primary);
  font-weight: var(--font-weight-semibold);
  margin-top: var(--spacing-6);
  margin-bottom: var(--spacing-3);
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.conteudo-html h2 {
  font-size: var(--font-size-2xl);
  border-bottom: 2px solid var(--border-primary);
  padding-bottom: var(--spacing-2);
}

.conteudo-html h3 {
  font-size: var(--font-size-xl);
}

.conteudo-html h4 {
  font-size: var(--font-size-lg);
}

.conteudo-html ul,
.conteudo-html ol {
  margin: var(--spacing-4) 0;
  padding-left: var(--spacing-6);
  max-width: 100%;
  overflow-wrap: break-word;
}

.conteudo-html li {
  margin-bottom: var(--spacing-2);
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.conteudo-html a {
  color: var(--primary-color);
  text-decoration: underline;
  transition: color var(--transition-base);
  overflow-wrap: break-word;
  word-break: break-all;
}

.conteudo-html a:hover {
  color: var(--primary-dark);
}

.conteudo-html blockquote {
  border-left: 4px solid var(--primary-color);
  padding-left: var(--spacing-4);
  margin: var(--spacing-5) 0;
  font-style: italic;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: var(--spacing-4);
  border-radius: var(--radius-md);
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
}

.conteudo-html code {
  background: var(--bg-tertiary);
  padding: var(--spacing-1) var(--spacing-2);
  border-radius: var(--radius-sm);
  font-family: 'Courier New', monospace;
  font-size: var(--font-size-sm);
  color: var(--primary-color);
  overflow-wrap: break-word;
  word-break: break-all;
}

.conteudo-html pre {
  background: var(--bg-tertiary);
  padding: var(--spacing-4);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: var(--spacing-4) 0;
  max-width: 100%;
  box-sizing: border-box;
}

.conteudo-html pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
  word-break: normal;
}

.conteudo-html img {
  max-width: 100%;
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: var(--spacing-4) 0;
  box-shadow: var(--shadow-sm);
  display: block;
}

.conteudo-html iframe,
.conteudo-html video,
.conteudo-html embed,
.conteudo-html object {
  max-width: 100%;
  width: 100%;
  height: auto;
  display: block;
}

/* Wrapper para tabelas responsivas */
.conteudo-html .table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--spacing-5) 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-primary);
  display: block;
}

.conteudo-html table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  background: var(--card-bg);
  margin: 0;
  display: table;
}

.conteudo-html thead {
  background: var(--primary-color);
  color: #ffffff;
}

.conteudo-html th {
  padding: var(--spacing-4);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.conteudo-html th:last-child {
  border-right: none;
}

.conteudo-html td {
  padding: var(--spacing-4);
  border-bottom: 1px solid var(--border-primary);
  border-right: 1px solid var(--border-secondary);
  font-size: var(--font-size-sm);
  vertical-align: middle;
}

.conteudo-html td:last-child {
  border-right: none;
}

.conteudo-html tbody tr {
  background: var(--bg-primary);
  transition: background-color var(--transition-fast);
}

.conteudo-html tbody tr:hover {
  background-color: var(--bg-tertiary);
}

.conteudo-html tbody tr:last-child td {
  border-bottom: none;
}

.conteudo-html tbody tr:nth-child(odd) {
  background-color: var(--bg-secondary);
}

.conteudo-html tbody tr:nth-child(even) {
  background-color: var(--bg-primary);
}

/* Anúncios Internos */
.ads-internal {
  width: 100%;
  max-height: 280px;
  overflow: hidden;
  margin: var(--spacing-6) 0;
  padding: var(--spacing-4);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border-secondary);
}

/* Botão Voltar */
.btn-voltar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-2);
  padding: var(--spacing-3) var(--spacing-5);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  margin-top: var(--spacing-4);
}

.btn-voltar:hover {
  background: var(--primary-color);
  color: var(--text-inverse);
  border-color: var(--primary-color);
  transform: translateX(-4px);
  box-shadow: var(--shadow-md);
}

/* ========================================
   3. SIDEBAR
   ======================================== */
.noticia-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-5);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Anúncios Verticais */
.ads-vertical {
  position: sticky;
  top: calc(var(--header-height) + var(--spacing-4));
  width: 100%;
  max-width: 320px;
  max-height: 600px;
  overflow: hidden;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-4);
  border: 1px dashed var(--border-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* Notícias Recentes */
.noticia-sidebar h3 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--spacing-3);
  padding-bottom: var(--spacing-2);
  border-bottom: 2px solid var(--primary-color);
  max-width: 100%;
  overflow-wrap: break-word;
}

.noticia-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-3);
  width: 100%;
  max-width: 100%;
}

.noticia-sidebar li {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-3);
  transition: all var(--transition-base);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.noticia-sidebar li:hover {
  background: var(--bg-tertiary);
  border-color: var(--primary-color);
  transform: translateX(4px);
}

.noticia-sidebar li a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  display: block;
  line-height: 1.5;
  transition: color var(--transition-base);
  width: 100%;
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.noticia-sidebar li a:hover {
  color: var(--primary-color);
}

/* ========================================
   4. RESPONSIVIDADE
   ======================================== */

/* Mobile - Único breakpoint em 768px */
@media (max-width: 768px) {
  .main-content .page-container {
    padding: var(--spacing-6);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .noticia-container {
    grid-template-columns: 1fr;
    gap: var(--spacing-4);
    width: 100%;
    max-width: 100%;
  }

  .noticia-conteudo {
    padding: var(--spacing-4);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .noticia-titulo {
    font-size: var(--font-size-xl);
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .capa-noticia {
    max-height: 300px;
    width: 100%;
    height: auto;
  }

  .noticia-info {
    flex-direction: column;
    align-items: flex-start;
    padding: var(--spacing-3);
    gap: var(--spacing-2);
    width: 100%;
    max-width: 100%;
  }

  .conteudo-html {
    font-size: var(--font-size-sm);
    line-height: 1.7;
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
  }

  .conteudo-html * {
    max-width: 100%;
    word-wrap: break-word;
  }

  .conteudo-html h2 {
    font-size: var(--font-size-xl);
    word-wrap: break-word;
  }

  .conteudo-html h3 {
    font-size: var(--font-size-lg);
    word-wrap: break-word;
  }

  .conteudo-html h4 {
    font-size: var(--font-size-base);
    word-wrap: break-word;
  }

  .conteudo-html p {
    text-align: left;
    word-wrap: break-word;
  }

  .conteudo-html img {
    max-width: 100%;
    height: auto;
  }

  .conteudo-html .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: var(--spacing-4) 0;
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-md);
    box-sizing: border-box;
  }

  .conteudo-html table {
    min-width: 500px;
    width: 100%;
  }

  .conteudo-html th,
  .conteudo-html td {
    padding: var(--spacing-3);
    font-size: var(--font-size-xs);
    white-space: nowrap;
  }

  .ads-internal {
    max-height: 200px;
    margin: var(--spacing-4) 0;
    padding: var(--spacing-3);
    width: 100%;
    max-width: 100%;
  }

  .ads-vertical {
    position: relative;
    top: auto;
    width: 100%;
    max-width: 100%;
    max-height: 300px;
  }

  .noticia-sidebar {
    gap: var(--spacing-4);
    width: 100%;
    max-width: 100%;
  }

  .noticia-sidebar h3 {
    font-size: var(--font-size-base);
  }

  .noticia-sidebar ul {
    width: 100%;
  }

  .noticia-sidebar li {
    padding: var(--spacing-2);
    width: 100%;
  }

  .noticia-sidebar li a {
    font-size: var(--font-size-xs);
    word-wrap: break-word;
    white-space: normal;
    display: block;
  }

  .btn-voltar {
    width: 100%;
    max-width: 100%;
    padding: var(--spacing-3) var(--spacing-4);
    font-size: var(--font-size-sm);
    box-sizing: border-box;
  }
}

/* ========================================
   5. ANIMAÇÕES
   ======================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.noticia-conteudo {
  animation: fadeInUp 0.4s ease-out;
}

.noticia-sidebar {
  animation: fadeInUp 0.5s ease-out;
}

/* ========================================
   6. TEMA ESCURO - AJUSTES ESPECÍFICOS
   ======================================== */
[data-theme="dark"] .noticia-info {
  background: var(--bg-secondary);
  border-left-color: var(--primary-color);
}

[data-theme="dark"] .categoria-badge {
  background: rgba(140, 233, 2, 0.15);
  color: var(--primary-color);
}

[data-theme="dark"] .data-noticia::before,
[data-theme="dark"] .tempo-leitura::before {
  filter: brightness(0) saturate(100%) invert(73%) sepia(94%) saturate(373%) hue-rotate(33deg) brightness(104%) contrast(96%);
  opacity: 1;
}

[data-theme="dark"] .ads-internal,
[data-theme="dark"] .ads-vertical {
  background: var(--bg-secondary);
}

[data-theme="dark"] .conteudo-html blockquote {
  background: var(--bg-secondary);
}

[data-theme="dark"] .conteudo-html code {
  background: var(--bg-secondary);
}

[data-theme="dark"] .conteudo-html pre {
  background: var(--bg-secondary);
}

[data-theme="dark"] .conteudo-html .table-wrapper {
  border-color: var(--border-secondary);
}

[data-theme="dark"] .conteudo-html table {
  border-color: var(--border-secondary);
}

[data-theme="dark"] .conteudo-html th {
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .conteudo-html td {
  border-color: var(--border-secondary);
}

[data-theme="dark"] .conteudo-html tbody tr:hover {
  background-color: rgba(140, 233, 2, 0.08);
}

[data-theme="dark"] .noticia-sidebar li:hover {
  background: var(--bg-secondary);
}

/* ========================================
   7. MELHORIAS DE ACESSIBILIDADE
   ======================================== */
.noticia-conteudo:focus-within {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.btn-voltar:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.noticia-sidebar li a:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Redução de movimento */
@media (prefers-reduced-motion: reduce) {
  .noticia-conteudo,
  .noticia-sidebar {
    animation: none;
  }

  .btn-voltar:hover,
  .noticia-sidebar li:hover {
    transform: none;
  }
}

/* ========================================
   8. IMPRESSÃO
   ======================================== */
@media print {
  .ads-internal,
  .ads-vertical,
  .noticia-sidebar,
  .btn-voltar {
    display: none !important;
  }

  .noticia-container {
    grid-template-columns: 1fr;
  }

  .noticia-conteudo {
    box-shadow: none;
    border: none;
  }

  .capa-noticia {
    max-height: 400px;
  }
}
