/* ======================================================
   REELS PAMOT - FEED VERTICAL LIMPO
   Corrige: áudio, vídeo fantasma, troca rápida, navbar e mobile.
   ====================================================== */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; min-height: 100%; background: #000; color: #fff; overflow: hidden; }
body { font-family: Arial, Helvetica, sans-serif; }
a { color: inherit; }

.reels-topbar {
  position: fixed;
  top: env(safe-area-inset-top, 0);
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(0,0,0,.86), rgba(0,0,0,.48), rgba(0,0,0,0));
  pointer-events: none;
}

.reels-brand,
.reels-nav { pointer-events: auto; }

.reels-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.reels-brand strong { font-size: 15px; line-height: 1; white-space: nowrap; }
.reels-brand span { font-size: 11px; color: rgba(255,255,255,.72); white-space: nowrap; }

.reels-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  max-width: 72vw;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.reels-nav::-webkit-scrollbar { display: none; }
.reels-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.14);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}
.reels-nav a.active { background: #0A5C33; border-color: #18a058; }
.reels-nav a:hover { background: rgba(255,255,255,.24); text-decoration: none; }

.container {
  width: 100%;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: #000;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}
.container::-webkit-scrollbar { display: none; }

.video-section {
  position: relative;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: #000;
  isolation: isolate;
  contain: layout paint size;
  overscroll-behavior: contain;
}

.reels-video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  object-position: center center !important;
  background: #000;
  opacity: 1;
  visibility: visible;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  will-change: transform;
  transition: none;
  z-index: 1;
}
.reels-video.loaded { opacity: 1; visibility: visible; }
.video-section.is-active .reels-video { opacity: 1; visibility: visible; }
.video-section:not(.is-active) .reels-video { opacity: 1; visibility: visible; }

.video-gradient {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, rgba(0,0,0,0) 28%, rgba(0,0,0,.72) 100%);
}

.loading-video {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  transform: translate(-50%, -50%);
  display: none;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(0,0,0,.56);
  color: #fff;
  font-size: 13px;
}
.video-section:not(.is-active) .loading-video { display: none !important; }
.video-section.is-active.is-loading .loading-video { display: block; }

.video-info {
  position: absolute;
  left: 18px;
  right: 92px;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-shadow: 0 2px 12px rgba(0,0,0,.65);
}

.sponsored-badge,
.info-status span {
  display: inline-flex;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(0,0,0,.42);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.sponsored-badge { background: linear-gradient(135deg, #18a058, #22c55e); }

.info-title a {
  display: inline;
  color: #fff;
  text-decoration: none;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 800;
}
.info-title a:hover { text-decoration: underline; }

.info-location,
.info-stats,
.info-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: rgba(255,255,255,.88);
  font-size: 13px;
  line-height: 1.3;
}
.info-status .status-verified { background: rgba(24,160,88,.82); }
.info-status .status-neutral { background: rgba(255,255,255,.18); }
.separator { opacity: .65; }

.interacoes {
  position: absolute;
  right: 14px;
  bottom: max(28px, env(safe-area-inset-bottom));
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 13px;
  align-items: center;
}

.reels-btn,
.nav-arrow {
  appearance: none;
  border: 0;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.reels-btn {
  width: 58px;
  min-height: 58px;
  padding: 8px 4px;
  border-radius: 18px;
  background: rgba(0,0,0,.46);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.reels-btn:active { transform: scale(.96); }
.btn-icon { font-size: 24px; line-height: 1; }
.btn-label { max-width: 58px; overflow: hidden; text-overflow: ellipsis; font-size: 10px; line-height: 1.1; white-space: nowrap; }
.sound-btn.sound-on { background: rgba(24,160,88,.82); }
.like-btn.liked { background: rgba(239,68,68,.82); }
.like-btn.liked .btn-icon { color: #fff; }

.reels-btn.like-error {
  animation: reelsLikeError .28s linear 0s 2;
}

@keyframes reelsLikeError {
  0%, 100% { transform: translateX(0); }
  33% { transform: translateX(-3px); }
  66% { transform: translateX(3px); }
}

.container:focus {
  outline: none;
}

.nav-arrows {
  position: absolute;
  right: 16px;
  top: 50%;
  z-index: 6;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.nav-arrow {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0,0,0,.38);
  font-size: 26px;
  line-height: 42px;
}

.loading,
.mensagem {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  padding: 80px 18px;
  text-align: center;
  color: #fff;
  background: #000;
}
.btn-reels {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: #18a058;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.seo-header {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (max-width: 768px) {
  .reels-topbar {
    min-height: 54px;
    align-items: flex-start;
    padding: 8px 10px 16px;
    gap: 8px;
  }
  .reels-brand strong { font-size: 13px; }
  .reels-brand span { display: none; }
  .reels-nav { max-width: 76vw; gap: 6px; }
  .reels-nav a { min-height: 32px; padding: 6px 10px; font-size: 12px; }

  .video-info {
    left: 14px;
    right: 82px;
    bottom: max(18px, env(safe-area-inset-bottom));
    gap: 7px;
  }
  .info-title a { font-size: 16px; }
  .info-location,
  .info-stats,
  .info-status { font-size: 12px; }

  .interacoes { right: 10px; gap: 10px; }
  .reels-btn { width: 52px; min-height: 52px; border-radius: 16px; }
  .btn-icon { font-size: 22px; }
  .share-btn .btn-label { display: none; }
  .nav-arrows { display: none; }
}

@media (max-width: 420px) {
  .video-info { right: 74px; }
  .reels-btn { width: 48px; min-height: 48px; }
  .btn-label { font-size: 9px; }
}


/* Mostra X apenas quando o elemento <video> retorna erro real */
.video-section.has-video-error::after {
  content: "✕";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 60;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.68);
  color: #fff;
  font-size: 34px;
  line-height: 54px;
  text-align: center;
  pointer-events: none;
}
