/* ============================================================
 * video-embed.css — vídeos do YouTube responsivos.
 * Usado tanto no site público quanto no preview do editor admin.
 *
 * Markup esperado:
 *   <div class="video-embed" data-yt="ABC123">
 *     <iframe src="https://www.youtube-nocookie.com/embed/ABC123" ...></iframe>
 *   </div>
 *
 * No editor (admin), quando ainda não tem iframe (placeholder vazio),
 * mostra a thumb do YouTube com botão play sobreposto.
 * ============================================================ */

.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 1.5rem 0;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.25);
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Placeholder no editor admin (ainda não tem iframe — mostra thumb) */
.video-embed:not(:has(iframe)) {
  background-color: #1a1a1a;
  background-size: cover;
  background-position: center;
  cursor: pointer;
}

/* Botão play centralizado quando é placeholder */
.video-embed:not(:has(iframe))::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  transition: background 0.2s;
}

.video-embed:not(:has(iframe))::after {
  content: '\F4F5'; /* bi-play-fill */
  font-family: 'bootstrap-icons';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 78px;
  height: 78px;
  background: rgba(255, 0, 0, 0.9);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  padding-left: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s, background 0.2s;
}

.video-embed:not(:has(iframe)):hover::after {
  transform: translate(-50%, -50%) scale(1.08);
  background: rgba(255, 0, 0, 1);
}

/* Badge "Vídeo" no canto (só quando é placeholder) */
.video-embed:not(:has(iframe)) .video-embed__badge,
.video-embed__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  z-index: 2;
}

/* Variante "card" pra usar em listas (ex: blog com lista de vídeos) */
.video-embed--card {
  margin: 0;
  border-radius: 10px;
}

/* No editor Summernote, evita o vídeo ficar gigante */
.note-editable .video-embed {
  max-width: 580px;
  margin: 1.2rem auto;
}

/* No site público, dentro de container — limita largura */
.conteudo-rico .video-embed,
.post-conteudo .video-embed,
.pagina-conteudo .video-embed {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================================
 * INSTAGRAM EMBED — Reels (9:16), Posts (variável), IGTV (9:16)
 * ============================================================ */

.instagram-embed {
  position: relative;
  width: 100%;
  margin: 1.5rem 0;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.25);
}

.instagram-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Reels = vertical 9:16, mas com altura útil — limita largura para não estourar */
.instagram-embed--reel {
  aspect-ratio: 9 / 16;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
}

/* Posts = aproximadamente quadrado, mas o embed do Instagram tem header + footer
   então usamos 1:1.4 pra acomodar a UI dele sem barras */
.instagram-embed--p {
  aspect-ratio: 1 / 1.4;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

/* IGTV = vertical longo */
.instagram-embed--tv {
  aspect-ratio: 9 / 16;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
}

/* Placeholder no editor (sem iframe ainda) */
.instagram-embed:not(:has(iframe)) {
  background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  cursor: pointer;
}

.instagram-embed:not(:has(iframe))::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
}

.instagram-embed:not(:has(iframe))::after {
  content: '\F437'; /* bi-instagram */
  font-family: 'bootstrap-icons';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 78px;
  height: 78px;
  background: rgba(255, 255, 255, 0.95);
  color: #dc2743;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s;
}

.instagram-embed:not(:has(iframe)):hover::after {
  transform: translate(-50%, -50%) scale(1.08);
}

.instagram-embed__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  z-index: 2;
}

/* Botão "Abrir no Instagram" — fallback quando o embed não carrega */
.instagram-embed__open {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: linear-gradient(135deg, #f09433, #dc2743, #bc1888);
  color: #fff !important;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  z-index: 5;
  box-shadow: 0 4px 12px rgba(220, 39, 67, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  opacity: 0.92;
}
.instagram-embed__open:hover {
  transform: translateY(-1px);
  opacity: 1;
  box-shadow: 0 6px 16px rgba(220, 39, 67, 0.55);
}
.instagram-embed__open i { font-size: 0.85rem; }

.note-editable .instagram-embed--reel,
.note-editable .instagram-embed--tv {
  max-width: 280px;
}
.note-editable .instagram-embed--p {
  max-width: 360px;
}
