/* =========================================================
   1. RESET E ESTRUTURA BASE (Layout tipo "App")
   ========================================================= */
/* === RESET E ESTRUTURA BASE === */
html, body { 
  margin: 0; 
  padding: 0; 
  height: 100%; 
  overflow: hidden; 
  /* ✅ O !important garante que o Bootstrap não sobrescreva esta cor */
  background-color: #8F0C0F !important; 
  font-family: 'Maven Pro', sans-serif;
  color: #ddd;
}

/* =========================================================
   2. ÁREA DE ROLAGEM PRINCIPAL
   ========================================================= */
/* === ÁREA DE ROLAGEM PRINCIPAL === */
.scrollable-content {
  height: 100vh;
  overflow-y: auto;
  padding-top: 110px;
  padding-bottom: 60px;
  max-width: 1400px;
  margin: 0 auto;
  /* ✅ APLICA O BACKGROUND AQUI, NÃO NO BODY */
  background-color: #8F0C0F !important;
}

.wrap {
  margin-top: 20px;
  margin-bottom: 40px;
}

/* =========================================================
   3. BARRA DE ROLAGEM PERSONALIZADA (Desktop)
   ========================================================= */
.scrollable-content::-webkit-scrollbar {
  background-color: #222121;  
  width: 15px; 
}

.scrollable-content::-webkit-scrollbar-track {
  background: #222121;
  border-left: 1px solid #333; 
}

.scrollable-content::-webkit-scrollbar-thumb {
  border-radius: 15px;
  background-color: #8F0C0F;
  border: 3px solid #222121; 
  background-clip: padding-box;
}

.scrollable-content::-webkit-scrollbar-thumb:hover {
  background-color: #a81014; 
}

/* =========================================================
   4. COMPONENTES GERAIS
   ========================================================= */
.white-wrap-shadow { 
  box-shadow: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12); 
  transition: box-shadow .28s cubic-bezier(.4,0,.2,1); 
  background: #222; 
}

a { text-decoration: none; color: #4682B4; }
a:hover { text-decoration: none; color: #58a6ff; }
h2, h3 { margin-top: 10px; margin-bottom: 5px; color: #f4d03f; }

.post {
  background: #222121; 
  color: #ddd; 
  padding: 20px; 
  margin: 30px auto;
  max-width: 800px; 
  border-radius: 8px; 
  box-shadow: 0 3px 8px rgba(0,0,0,.9);
}

.post img {
  max-width: 400px; 
  max-height: 400px; 
  display: block;
  margin: 10px auto; 
  border-radius: 4px;
}

/* Caixa de descrição com altura limitada inicialmente */
.descricao {
    max-height: 120px;
    overflow: hidden;
    position: relative;
    transition: max-height 0.5s ease;
}

/* Quando expandida, remove o limite */
.descricao.expandido {
    max-height: 5000px; /* Valor alto o suficiente para qualquer texto */
}

/* Efeito de "fade" na borda quando está truncado */
.descricao.hidden-text::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: #222;
    pointer-events: none;
}

/* Botão "Ler mais" */
.ler-mais-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 16px;
    background: #4fb6ff;
    color: #fff !important;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s;
}
.ler-mais-btn:hover {
    background: #3aa0e8;
}

/* =========================================================
   5. PAGINAÇÃO
   ========================================================= */
.pager { 
  display: flex; 
  justify-content: center; 
  gap: 8px; 
  list-style: none; 
  padding: 20px 0; 
  margin: 0;
}

.pager li a {
  background: #4682B4; 
  color: #000;
  border: 1px solid #444;
  padding: 8px 14px; 
  border-radius: 6px; 
  text-decoration: none;
  transition: all .3s;
}

.pager li a:hover { background: #5a9fd4; color: #fff; }
.pager li.active a { background: #4682B4; color: #111; font-weight: bold; }

.pager li.previous a,
.pager li.next a {
  background: #333;
  color: #fff;
  font-weight: bold;
}

.pager li.previous a:hover,
.pager li.next a:hover { background: #555; }

.pager li.ellipsis { 
  display: flex; 
  align-items: center; 
  padding: 0 5px; 
  color: #aaa; 
  user-select: none; 
}

/* =========================================================
   6. MÍDIA (Grid, Áudio, Vídeo)
   ========================================================= */
.media-grid {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 15px 0;
}

.media-grid img {
  max-width: 220px;
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
  object-fit: cover;
}

.media-grid img:only-child { max-width: 420px; }

.audio-wrapper { 
  display: flex; 
  flex-direction: column; 
  align-items: flex-start; 
  width: 100%; 
  max-width: 560px; 
}

.audio-player {
  display: flex; 
  align-items: center; 
  gap: 8px; 
  background: #111;
  border-radius: 12px; 
  width: 100%;
  padding: 8px;
}

.play-btn {
  background: #00ffff; 
  color: #111; 
  border: none; 
  border-radius: 50%;
  width: 32px; 
  height: 32px; 
  font-size: 14px; 
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-container {
  flex: 1; 
  height: 6px; 
  background: #333; 
  border-radius: 4px; 
  cursor: pointer; 
  position: relative;
}

.progress-bar {
  position: absolute; 
  height: 100%; 
  width: 0%;
  background: #00ffff; 
  border-radius: 4px; 
  transition: width .1s linear;
}

.time { min-width: 70px; text-align: right; color: #aaa; font-size: 13px; }
.share-btn { background: none; border: none; cursor: pointer; color: #fff; font-size: 16px; }
.file-name { color: #ccc; font-size: 14px; margin-top: 4px; font-style: italic; word-break: break-word; }

/* =========================================================
   7. COMENTÁRIOS E LIKES
   ========================================================= */
.comentarios {
  margin-top: 15px;
  padding: 12px;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 8px;
}

.comentarios h4 {
  color: #f0f0f0;
  margin-bottom: 8px;
  border-bottom: 1px solid #333;
  padding-bottom: 4px;
}

.abrir-comentario {
  background: #0078ff;
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 8px;
}
.abrir-comentario:hover { background: #3399ff; }

.comentario {
  margin-top: 10px;
  background: #2a2a2a;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #333;
  font-size: 14px;
  color: #ddd;
}
.comentario strong { color: #58a6ff; }

.like-section {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.like-section button {
  background: transparent;
  color: #fff;
  border: 1px solid #444;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.like-section button:hover { background: #3399ff; border-color: #3399ff; }
.like-section span { font-weight: bold; color: #bbb; }

/* =========================================================
   8. POPUP / MODAL DE COMENTÁRIO
   ========================================================= */
.popup {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  justify-content: center;
  align-items: center;
}

.popup-conteudo {
  background: #1f1f1f;
  padding: 20px;
  border-radius: 10px;
  width: 5%;
  max-width: 30px;
  color: #eee;
  box-shadow: 0 0 10px #000;
  position: relative;
}

.popup-conteudo h3 { margin-top: 0; text-align: center; color: #58a6ff; }
.popup-conteudo label { display: block; margin-top: 10px; font-size: 14px; }

.popup-conteudo input,
.popup-conteudo textarea {
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #2b2b2b;
  color: #eee;
  box-sizing: border-box;
}

.popup-conteudo button {
  margin-top: 2px;
  background: #0078ff;
  color: #fff;
  border: none;
  padding: 3px 4px;
  border-radius: 6px;
  cursor: pointer;
  width: 5%;
}
.popup-conteudo button:hover { background: #3399ff; }

.fechar {
  position: absolute;
  right: 10px;
  top: 6px;
  font-size: 22px;
  cursor: pointer;
  color: #aaa;
  background: none;
  border: none;
}
.fechar:hover { color: #fff; }

/* =========================================================
   9. CARROSSEL E LIGHTBOX
   ========================================================= */
.carousel-wrapper {
  position: relative;
  max-width: 100%;
  margin: 15px 0;
  border-radius: 8px;
  overflow: hidden;
  background: #1a1a1a;
}

.carousel-track {
  display: flex;
  transition: transform 0.4s ease-in-out;
  width: 100%;
}

.carousel-slide {
  min-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  box-sizing: border-box;
}

.carousel-slide img {
  max-width: 100%;
  max-height: 400px;
  width: auto;
  height: auto;
  border-radius: 6px;
  cursor: zoom-in;
  object-fit: contain;
  transition: transform 0.2s;
}
.carousel-slide img:hover { transform: scale(1.02); }

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.carousel-btn:hover { background: rgba(0,0,0,0.9); }
.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: rgba(0,0,0,0.3);
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: background 0.2s;
}
.carousel-dot.active { background: #4caf50; }

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.95);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
}
.lightbox.active { display: flex; }

.lightbox-img {
  max-width: 95%;
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  cursor: zoom-out;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 40px;
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
}

.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 14px;
  background: rgba(0,0,0,0.6);
  padding: 5px 15px;
  border-radius: 20px;
}

/* =========================================================
   10. RESPONSIVIDADE (Mobile e Tablet)
   ========================================================= */

/* Tablet (até 900px) */
@media (max-width: 900px) {
  .scrollable-content { padding-top: 90px; }
}

/* Celular (até 768px) */
@media (max-width: 768px) {
  .audio-player { max-width: 100%; }
  .post { margin: 15px; padding: 15px; }
  
  iframe {
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
  }

  .carousel-wrapper {
    width: 100%;
    max-width: 100vw;
    margin: 10px 0;
    overflow: hidden;
    position: relative;
    touch-action: pan-y pinch-zoom;
  }
  
  .carousel-track {
    display: flex;
    transition: transform 0.3s ease-out;
    width: 100%;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    will-change: transform;
  }
  
  .carousel-slide {
    min-width: 100%;
    width: 100vw;
    max-width: 100%;
    flex: 0 0 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5px;
    box-sizing: border-box;
    overflow: hidden;
  }
  
  .carousel-slide img {
    max-width: 100%;
    max-height: 35vh;
    width: auto;
    height: auto;
    border-radius: 6px;
    cursor: zoom-in;
    object-fit: contain;
    display: block;
    pointer-events: auto;
    user-select: none;
    -webkit-user-drag: none;
  }
  
  .carousel-btn {
    width: 44px;
    height: 44px;
    font-size: 20px;
    padding: 0;
    margin: 0 5px;
  }
  .carousel-prev { left: 5px; }
  .carousel-next { right: 5px; }
  .carousel-dots { padding: 8px; gap: 10px; }
  .carousel-dot { width: 12px; height: 12px; }
}

/* Celular Pequeno (até 600px) */
@media (max-width: 600px) {
  .scrollable-content { 
    padding-top: 80px; 
    /* ✅ OCULTA A BARRA DE ROLAGEM APENAS NO CELULAR */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge antigo */
  }
  
  .scrollable-content::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge moderno */
  }

  .carousel-slide img { max-height: 300px; }
  .carousel-btn { width: 35px; height: 35px; font-size: 16px; }
}

/* Ajuste específico para Safari iOS */
@supports (-webkit-touch-callout: none) {
  .carousel-track {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
  .carousel-slide img {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
}