/* RESET E ESTILOS GERAIS */
.cm-media-section * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Open Sans', 'Segoe UI', Roboto, sans-serif;
}

.cm-media-section {
  --cm-primary: #004d99;
  max-width: 1250px;
  margin: 30px auto;
  padding: 0 10px;
}

.cm-media-grid {
  display: grid;
  grid-template-columns: 1fr 1.8fr;
  gap: 20px;
  align-items: start;
}

/* 1. SEÇÃO INSTAGRAM (ESQUERDA) */
.cm-insta-box {
  background-color: #f8fafc;
  border-radius: 12px;
  padding: 24px;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cm-insta-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.cm-insta-title {
  color: var(--cm-primary);
  font-size: 1.3rem;
  font-weight: 800;
}

.cm-insta-title span {
  color: color-mix(in srgb, var(--cm-primary) 65%, #3399ff 35%);
  font-weight: 400;
}

.cm-insta-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: 2px solid var(--cm-primary);
  object-fit: cover;
}

.cm-insta-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Grade das 3 fotos menores, embaixo da foto em destaque */
.cm-insta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* Post no estilo Instagram: foto + barra de ações (curtir/compartilhar/salvar) */
.cm-insta-post {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
}

.cm-insta-post-media {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  position: relative;
  display: block;
  background: #000;
}

.cm-insta-post-media a,
.cm-insta-post-media img {
  display: block;
  width: 100%;
  height: 100%;
}

.cm-insta-post-media img {
  object-fit: cover;
  transition: transform 0.3s ease;
}

.cm-insta-post-media a:hover img {
  transform: scale(1.05);
}

/* Foto em destaque: maior, ocupando toda a largura */
.cm-insta-post-hero .cm-insta-post-media {
  aspect-ratio: 16 / 10;
}

.cm-insta-post-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
}

.cm-insta-action-right {
  margin-left: auto;
}

/* Cada ação usa um ÚNICO ícone SVG (sem duplicidade). O preenchimento
   (curtir/salvar) é alternado pelo JS diretamente no atributo "fill"
   do path, então não depende de nenhuma outra regra de CSS. */
.cm-insta-action {
  background: none;
  border: none;
  cursor: pointer;
  color: #262626;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  position: relative;
  line-height: 0;
}

.cm-insta-action svg {
  width: 22px;
  height: 22px;
  display: block;
  pointer-events: none;
}

.cm-insta-post-sm .cm-insta-action svg {
  width: 18px;
  height: 18px;
}

.cm-insta-like.is-active {
  color: #ed4956; /* vermelho do "curtir" do Instagram */
}

.cm-insta-save.is-active {
  color: #262626;
}

.cm-insta-action:hover {
  opacity: 0.65;
}

@keyframes cm-insta-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.cm-insta-pop svg {
  animation: cm-insta-pop 0.3s ease;
}

.cm-insta-toast {
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: #262626;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
}

/* 2. SEÇÃO YOUTUBE (DIREITA) */
.cm-yt-box {
  background-color: #ffffff;
  border-radius: 12px;
  padding: 24px;
  border: 1px solid #e2e8f0;
  border-top: 4px solid var(--cm-primary);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.cm-yt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.cm-yt-title {
  color: var(--cm-primary);
  font-size: 1.3rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cm-yt-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--cm-primary);
  object-fit: contain;
  background: #fff;
  padding: 2px;
}

.cm-yt-link {
  color: color-mix(in srgb, var(--cm-primary) 60%, #3399ff 40%);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.cm-yt-link:hover {
  color: var(--cm-primary);
  text-decoration: underline;
}

.cm-yt-content {
  display: grid;
  grid-template-columns: 2.2fr 1fr;
  gap: 12px;
  align-items: stretch;
}

.cm-yt-main-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100%;
}

.cm-yt-main-player {
  width: 100%;
  flex: 1 1 auto;
  min-height: 200px;
  border-radius: 8px;
  overflow: hidden;
  background-color: #000;
}

.cm-yt-main-player iframe,
.cm-yt-thumb iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.cm-yt-main-meta {
  padding: 0 2px;
}

.cm-yt-main-meta-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cm-yt-main-meta-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.cm-yt-main-meta-channel {
  font-size: 0.85rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cm-yt-main-meta-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  border: 1px solid #e2e8f0;
}

.cm-yt-subscribe-btn {
  background: #0f172a;
  color: #fff;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
  transition: background 0.2s ease;
  white-space: nowrap;
}

.cm-yt-subscribe-btn:hover {
  background: color-mix(in srgb, #0f172a 85%, var(--cm-primary) 15%);
  color: #fff;
  text-decoration: none;
}

/* Barra de ações do vídeo em destaque: mesma linguagem visual dos
   botões de ação do Instagram (ícone único + rótulo, pill discreta). */
.cm-yt-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cm-yt-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #262626;
  cursor: pointer;
  position: relative;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.cm-yt-action:hover {
  background: #e2e8f0;
}

.cm-yt-action svg {
  width: 17px;
  height: 17px;
  pointer-events: none;
}

.cm-yt-like.is-active {
  color: #ed4956;
}

.cm-yt-save.is-active {
  color: #262626;
  background: #e2e8f0;
}

.cm-yt-main-info {
  margin-top: 12px;
  background: #f8fafc;
  border-radius: 10px;
  padding: 12px 14px;
}

.cm-yt-main-info-stats {
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
}

.cm-yt-main-info-desc {
  margin-top: 6px;
  font-size: 0.82rem;
  color: #475569;
  line-height: 1.5;
}

.cm-yt-desc-toggle {
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
  color: #64748b;
  font-weight: 700;
  cursor: pointer;
}

/* Capa (thumbnail + botão de play) do player, tanto o do meio quanto os
   da lista lateral. Deixa de ser "facade" (classe cm-yt-facade removida
   pelo JS) assim que o vídeo carrega, para não bloquear o clique nos
   controles de play/pause do YouTube. */
.cm-yt-facade {
  background-size: cover;
  background-position: center;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.cm-yt-facade::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.15);
  transition: background 0.2s ease;
  pointer-events: none;
}

.cm-yt-facade:hover::after {
  background: rgba(0, 0, 0, 0.05);
}

.cm-yt-play-btn {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  transition: transform 0.15s ease;
  pointer-events: none;
}

.cm-yt-play-btn-sm {
  width: 26px;
}

.cm-yt-facade:hover .cm-yt-play-btn {
  transform: scale(1.1);
}

.cm-yt-playlist {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Cada item da lista lateral: miniatura à esquerda, título e canal à
   direita — no mesmo estilo dos vídeos recomendados do próprio YouTube. */
.cm-yt-thumb-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.cm-yt-thumb {
  flex: 0 0 42%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  display: flex;
  background-color: #000;
}

.cm-yt-thumb-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.cm-yt-thumb-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cm-yt-thumb-channel {
  margin-top: 4px;
  font-size: 0.72rem;
  color: #64748b;
}

.cm-media-notice {
  font-size: 0.9rem;
  color: #64748b;
  padding: 10px;
  background: #f1f5f9;
  border-radius: 8px;
}

/* RESPONSIVIDADE */
@media (max-width: 992px) {
  .cm-media-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .cm-yt-content {
    grid-template-columns: 1fr;
  }
  .cm-insta-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
