/* CONTAINER PRINCIPAL */
.blog-container {
  display: flex;
  gap: 40px;
  padding: 50px 20px;
}

/* LISTA DE POSTS */
.blog-posts {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.blog-card {
  display: flex;
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-light-card);
  border: 1px solid var(--border-color);
  transition: transform 0.3s;
  height: 300px;
}

.blog-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.blog-card-img {
  flex: 0 0 40%;
}

.blog-card-img img,
.blog-card-img iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: none;
}

.blog-card-content {
  padding: 30px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.blog-card-content h2 {
  font-size: 1.4rem;
  color: var(--primary-dark);
  margin-bottom: 15px;
  line-height: 1.3;
}

[data-theme="dark"] .blog-card-content h2 {
  color: var(--gold);
}

.blog-card-content p {
  color: var(--text-gray);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.btn-read-more {
  display: inline-block;
  background: transparent;
  border: none;
  color: var(--gold);
  padding: 0;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: color 0.3s, text-decoration 0.3s;
  cursor: pointer;
}

.btn-read-more:hover {
  color: var(--pure-white);
  text-decoration: underline;
}

/* BARRA LATERAL */
.blog-sidebar {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.sidebar-widget {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 25px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-light-card);
}

.sidebar-widget:nth-child(1) {
  height: 300px;
}

.sidebar-widget:nth-child(2) {
  height: 630px;
  display: flex;
  flex-direction: column;
}

.sidebar-widget:nth-child(2) h3 {
  flex-shrink: 0;
}

.sidebar-widget h3 {
  font-size: 1.2rem;
  color: var(--primary-dark);
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

[data-theme="dark"] .sidebar-widget h3 {
  color: var(--gold);
}

.categories-list {
  list-style: none;
}

.categories-list li {
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.categories-list a {
  color: var(--text-dark);
  font-size: 0.95rem;
  transition: color 0.3s;
}

.categories-list a:hover {
  color: var(--success);
  padding-left: 5px;
}

/* Posts Populares Side */
.popular-posts {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  overflow: hidden;
}

.popular-post-item {
  display: flex;
  align-items: center;
  gap: 15px;
}

.popular-post-item img {
  width: 70px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
}

.popular-post-item a {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.3;
  transition: color 0.3s;
}

.popular-post-item a:hover {
  color: var(--success);
}

/* MODAL DE LEITURA */
.modal-blog-reader {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.85);
  backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-reader-content {
  background-color: var(--bg-card);
  width: 100%;
  max-width: 800px;
  height: 90vh; /* Altura fixa para permitir o scroll interno */
  border-radius: 16px;
  position: relative;
  overflow: hidden; /* Oculta scroll externo */
  display: flex;
  flex-direction: column;
  animation: modalScale 0.3s ease-out;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

@keyframes modalScale {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.close-reader {
  position: absolute;
  right: 20px;
  top: 15px;
  font-size: 32px;
  color: var(--text-dark);
  cursor: pointer;
  z-index: 10;
  background: var(--bg-light);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.reader-body {
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1;
  overflow: hidden;
}

#modal-post-img {
  width: 100%;
  height: 350px;
  object-fit: cover;
  border-bottom: 5px solid var(--success);
  flex-shrink: 0;
}

.reader-text {
  padding: 40px;
  overflow-y: auto; /* Scroll apenas no texto */
  flex: 1;
}

.reader-text h2 {
  font-size: 2rem;
  color: var(--success);
  margin-bottom: 10px;
  line-height: 1.2;
}

[data-theme="dark"] .reader-text h2 {
  color: var(--gold);
}

.post-date {
  color: var(--text-gray);
  font-size: 0.9rem;
  margin-bottom: 25px;
}

.post-full-text {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-dark);
  white-space: pre-line;
}

.reader-text::-webkit-scrollbar {
  width: 8px;
}
.reader-text::-webkit-scrollbar-thumb {
  background: var(--success);
  border-radius: 10px;
}

/* RESPONSIVIDADE */
@media (max-width: 992px) {
  .blog-container {
    flex-direction: column;
  }
  .blog-sidebar {
    width: 100%;
  }
  .blog-card {
    flex-direction: column;
  }
  .blog-card-img {
    height: 200px;
  }
  .reader-text {
    padding: 20px;
  }
  .reader-text h2 {
    font-size: 1.5rem;
  }
}

/* ---- CARROSSEL VERTICAL SIDEBAR ---- */
#popular-posts-container {
  height: 350px;
  overflow: hidden;
  position: relative;
  border-radius: 10px;
}

.vertical-carousel-track {
  display: flex;
  flex-direction: column;
  gap: 15px;
  /* Animação que translada o conteúdo para cima 50% (já que está duplicado, é seamless) */
  animation: scrollVertical 25s linear infinite;
}

.vertical-carousel-track:hover {
  animation-play-state: paused;
}

@keyframes scrollVertical {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

.popular-post-item {
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(0,0,0,0.02);
  padding: 10px;
  border-radius: 8px;
  transition: background 0.3s ease;
}

[data-theme="dark"] .popular-post-item {
  background: rgba(255,255,255,0.03);
}

.popular-post-item:hover {
  background: rgba(0, 153, 81, 0.1);
}

.popular-post-item img {
  width: 70px;
  height: 50px;
  object-fit: cover;
  border-radius: 5px;
}

.popular-post-item a {
  font-size: 0.9rem;
  color: var(--text-dark); /* Já se adapta automaticamente ao modo light e dark */
  font-weight: 600;
  text-decoration: none;
  line-height: 1.3;
}

.popular-post-item a:hover {
  color: var(--primary-dark);
}

[data-theme="dark"] .popular-post-item a:hover {
  color: var(--gold);
}
