/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #fcfcfc;
  color: #111;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== HEADER ===== */
.site-header {
  border-bottom: 1px solid #eaeaea;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 650;
  text-decoration: none;
  color: #111;
  letter-spacing: -0.3px;
}

.logo svg {
  color: #111;
  transition: transform 0.2s;
}

.logo:hover svg {
  transform: rotate(-2deg);
}

nav a {
  text-decoration: none;
  color: #555;
  font-size: 0.95rem;
  font-weight: 450;
  transition: color 0.2s;
}

nav a:hover {
  color: #000;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ===== CONTAINER ===== */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
  flex: 1;
  width: 100%;
}

.page-title {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #f0f0f0;
  letter-spacing: -0.5px;
  color: #0a0a0a;
}

/* ===== ÁREA DE BUSCA E FILTRO ===== */
.search-area {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #aaa;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1.2rem 0.75rem 2.8rem;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
  background: #fff;
  color: #111;
}

.search-box input:focus {
  border-color: #aaa;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.04);
}

#category-filter,
#period-filter {
  padding: 0.75rem 2.5rem 0.75rem 1.2rem;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  font-size: 0.95rem;
  background: #fff;
  outline: none;
  cursor: pointer;
  min-width: 210px;
  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='%23555' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  color: #111;
  transition: all 0.2s ease;
}

#category-filter:focus,
#period-filter:focus {
  border-color: #aaa;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.04);
}

.date-input {
  padding: 0.6rem 0.8rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #fff;
}

#custom-period span {
  font-size: 0.9rem;
  color: #666;
}

/* ===== LISTA DE ARTIGOS ===== */
.articles-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.article-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  text-decoration: none;
  color: #111;
  padding: 1.2rem 1rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #f0f0f0;
  transition: all 0.2s ease;
  position: relative;
}

.article-card:hover {
  border-color: #d5d5d5;
  box-shadow: 0 4px 14px rgba(0,0,0,0.04);
  transform: translateY(-1px);
}

.article-info {
  flex: 1;
  margin-right: 1rem;
}

.article-info h2 {
  font-size: 1.2rem;
  font-weight: 550;
  margin-bottom: 0.3rem;
  color: #0a0a0a;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.article-summary-preview {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.5;
  margin-top: 0.3rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-date {
  font-size: 0.8rem;
  color: #999;
  white-space: nowrap;
  margin-top: 0.3rem;
  font-weight: 400;
}

.new-badge {
  display: inline-block;
  background: #111;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  vertical-align: middle;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.4rem;
}

.tag-badge {
  display: inline-block;
  background: #f0f0f0;
  color: #555;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: lowercase;
}

/* ===== ESTADOS ===== */
.loading {
  color: #888;
  font-style: italic;
  padding: 2rem;
  text-align: center;
}

.empty-state {
  color: #777;
  text-align: center;
  padding: 3rem 0;
  font-size: 1rem;
}

.site-footer {
  border-top: 1px solid #eee;
  text-align: center;
  padding: 1.4rem;
  font-size: 0.8rem;
  color: #aaa;
  margin-top: auto;
  background: #fff;
}

@media (max-width: 600px) {
  .header-inner {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
  .container {
    padding: 2rem 1rem;
  }
  .search-area {
    flex-direction: column;
  }
  .article-card {
    flex-direction: column;
  }
  .article-date {
    margin-top: 0.6rem;
    align-self: flex-start;
  }
}

/* ===== HEADER ===== */
.site-header {
  border-bottom: 1px solid #eaeaea;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 1.15rem;
  font-weight: 650;
  text-decoration: none;
  color: #111;
}

nav {
  display: flex;
  gap: 1.2rem;
  align-items: center;
}

nav a {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  text-decoration: none;
  color: #555;
  font-size: 0.9rem;
  padding: 0.4rem 0;
  transition: color 0.15s;
}

nav a:hover {
  color: #000;
  text-decoration: underline;
}

/* Link ativo (opcional, se quiser destacar a página atual) */
nav a.active {
  color: #111;
  font-weight: 500;
  border-bottom: 2px solid #111;
}

/* Responsivo */
@media (max-width: 600px) {
  .header-inner {
    padding: 0.8rem 1rem;
    flex-direction: column;
    gap: 0.5rem;
  }
  nav {
    gap: 1rem;
  }
}

.article-card {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  text-decoration: none;
  border-bottom: 1px solid #eee;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
}

.article-cover-wrapper {
  flex-shrink: 0;
  width: 100px;
  height: 100px;
}

.article-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  background: #f5f5f5;
}

.article-info {
  flex: 1;
}

/* Responsivo: em telas pequenas a capa fica acima */
@media (max-width: 600px) {
  .article-card {
    flex-direction: column;
    gap: 0.8rem;
  }
  .article-cover-wrapper {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

.article-author,
.article-metrics span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.article-metrics {
  display: flex;
  gap: 1rem;
  margin: 0.3rem 0;
  color: #444;
}

/* Badge de tendência (🔥 Em alta) */
.trending-badge {
  display: inline-block;
  background: #fff0e0;
  color: #c45100;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: 20px;
  margin-left: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid #ffd6a5;
  vertical-align: middle;
}
/* Paginação */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 2rem 0;
}
.page-btn {
  background: #fff;
  border: 1px solid #ddd;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.page-btn.active {
  background: #111;
  color: #fff;
  border-color: #111;
}
.page-btn:hover {
  background: #f0f0f0;
}
/* Seletor de ordenação */
.sort-select {
  padding: 0.6rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}
/* Destaque dos termos buscados */
mark {
  background: #fff3b0;
  color: #111;
  padding: 0 0.2rem;
  border-radius: 3px;
  display: inline-block; /* evita quebras de linha indesejadas */
}
body.dark-mode mark {
  background: #5a4a1a;
  color: #ffd966;
}

.dark-mode-toggle {
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem;
  border-radius: 50%;
  transition: background 0.2s;
}
.dark-mode-toggle:hover {
  background: rgba(0,0,0,0.05);
}
body.dark-mode .dark-mode-toggle:hover {
  background: rgba(255,255,255,0.1);
}

