/* ── NewsPress YouTube Manager — frontend ─────────────
   Usa los tokens --np-* de los temas NewsPress; con fallbacks
   neutros por si el plugin corre sobre otro tema. */

/* ══════════════════════════════════════════════════════
   TARJETA DE VIDEO
   ══════════════════════════════════════════════════════ */
.np-yt-card { min-width: 0; }
.np-yt-card__btn {
  display: block;
  width: 100%;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.np-yt-card__media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--r-md, 8px);
  background: var(--np-surface-dim, #e8e8e8);
}
.np-yt-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s ease;
}
.np-yt-card__btn:hover .np-yt-card__media img { transform: scale(1.04); }
.np-yt-card__play {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  border-radius: 999px;
  background: rgba(0,0,0,.62);
  color: #fff;
  transition: background .15s ease, transform .15s ease;
}
.np-yt-card__btn:hover .np-yt-card__play {
  background: var(--np-accent, #c8102e);
  transform: translate(-50%, -50%) scale(1.08);
}
.np-yt-card__title {
  display: block;
  margin-top: 8px;
  font-family: var(--f-head, inherit);
  font-weight: 700;
  font-size: var(--t-sm, 14px);
  line-height: 1.35;
  color: var(--np-text, #111);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.np-yt-card__btn:hover .np-yt-card__title { color: var(--np-accent, #c8102e); }
.np-yt-card__date {
  display: block;
  margin-top: 3px;
  font-size: var(--t-xs, 12px);
  color: var(--np-text-muted, #777);
}

/* Badge EN VIVO sobre miniatura */
.np-yt-badge-live {
  position: absolute;
  top: 8px; left: 8px;
  background: #d00;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .5px;
  padding: 2px 8px;
  border-radius: 4px;
}

/* Mini (widget sidebar) */
.np-yt-widget .np-yt-card--mini { margin-bottom: var(--sp-3, 12px); }
.np-yt-widget .np-yt-card--mini:last-child { margin-bottom: 0; }

/* Vertical (Shorts, 9:16) */
.np-yt-card--v .np-yt-card__media { aspect-ratio: 9 / 16; }
.np-yt-card--v .np-yt-card__play {
  width: 40px; height: 40px;
}
.np-yt-card--v .np-yt-card__title {
  font-size: var(--t-xs, 12.5px);
  -webkit-line-clamp: 2;
}

/* ══════════════════════════════════════════════════════
   HERO DE VIDEOS (1 principal + 4 lista)
   ══════════════════════════════════════════════════════ */
.np-yt-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: var(--sp-5, 20px);
  margin-bottom: var(--sp-7, 36px);
}
.np-yt-hero__main-title {
  display: block;
  margin-top: 10px;
  font-family: var(--f-head, inherit);
  font-weight: 800;
  font-size: clamp(var(--t-lg, 18px), 2.4vw, var(--t-2xl, 26px));
  line-height: 1.2;
  color: var(--np-text, #111);
}
.np-yt-hero__main .np-yt-card__btn:hover .np-yt-hero__main-title { color: var(--np-accent, #c8102e); }

/* Player embebido del principal (autoplay silenciado) */
.np-yt-hero__player {
  aspect-ratio: 16 / 9;
  border-radius: var(--r-md, 8px);
  overflow: hidden;
  background: #000;
}
.np-yt-hero__player iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.np-yt-hero__main-btn {
  display: block;
  width: 100%;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.np-yt-hero__main-btn:hover .np-yt-hero__main-title { color: var(--np-accent, #c8102e); }
.np-yt-hero__list {
  display: grid;
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: var(--sp-3, 12px);
}
.np-yt-hero__item .np-yt-card__btn {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: var(--sp-3, 12px);
  align-items: center;
  height: 100%;
  padding-bottom: var(--sp-3, 12px);
  border-bottom: 1px solid var(--np-border, #e3e3e3);
}
.np-yt-hero__item:last-child .np-yt-card__btn { border-bottom: none; padding-bottom: 0; }
.np-yt-hero__item .np-yt-card__media { border-radius: var(--r-sm, 6px); }
.np-yt-hero__item-title {
  font-family: var(--f-head, inherit);
  font-weight: 700;
  font-size: var(--t-sm, 14px);
  line-height: 1.35;
  color: var(--np-text, #111);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.np-yt-hero__item .np-yt-card__btn:hover .np-yt-hero__item-title { color: var(--np-accent, #c8102e); }
.np-yt-card__play--sm { width: 30px; height: 30px; }
@media (max-width: 860px) {
  .np-yt-hero { grid-template-columns: 1fr; }
  .np-yt-hero__item .np-yt-card__btn { grid-template-columns: 118px minmax(0, 1fr); }
}

/* ══════════════════════════════════════════════════════
   GRID (3 columnas escritorio → 1 móvil)
   ══════════════════════════════════════════════════════ */
.np-yt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-5, 20px);
  margin-bottom: var(--sp-6, 28px);
}
@media (max-width: 900px) {
  .np-yt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .np-yt-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════
   CARRUSEL (scroll-snap + flechas)
   ══════════════════════════════════════════════════════ */
.np-yt-carousel {
  position: relative;
  margin-bottom: var(--sp-6, 28px);
}
.np-yt-carousel__track {
  display: flex;
  gap: var(--sp-4, 16px);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.np-yt-carousel__track::-webkit-scrollbar { display: none; }
.np-yt-carousel__item {
  flex: 0 0 calc((100% - 2 * var(--sp-4, 16px)) / 3);
  scroll-snap-align: start;
}
@media (max-width: 900px) {
  .np-yt-carousel__item { flex-basis: calc((100% - var(--sp-4, 16px)) / 2); }
}
@media (max-width: 600px) {
  .np-yt-carousel__item { flex-basis: 86%; }
}
.np-yt-carousel__nav {
  position: absolute;
  top: 32%;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: none;
  border-radius: 999px;
  background: var(--np-surface, #fff);
  color: var(--np-text, #111);
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, opacity .15s ease;
}
.np-yt-carousel__nav:hover { background: var(--np-accent, #c8102e); color: #fff; }
.np-yt-carousel__nav--prev { left: -8px; }
.np-yt-carousel__nav--next { right: -8px; }
.np-yt-carousel__nav[disabled] { opacity: .25; pointer-events: none; }

/* Carrusel de Shorts: tarjetas verticales, más por fila */
.np-yt-carousel--shorts .np-yt-carousel__item {
  flex-basis: calc((100% - 5 * var(--sp-4, 16px)) / 6);
}
.np-yt-carousel--shorts .np-yt-carousel__nav { top: 40%; }
@media (max-width: 900px) {
  .np-yt-carousel--shorts .np-yt-carousel__item {
    flex-basis: calc((100% - 3 * var(--sp-4, 16px)) / 4);
  }
}
@media (max-width: 600px) {
  .np-yt-carousel--shorts .np-yt-carousel__item { flex-basis: 38%; }
}

/* ══════════════════════════════════════════════════════
   LIVE (player embebido en landing)
   ══════════════════════════════════════════════════════ */
.np-yt-live { margin-bottom: var(--sp-6, 28px); }
.np-yt-live__frame {
  aspect-ratio: 16 / 9;
  border-radius: var(--r-lg, 12px);
  overflow: hidden;
  background: #000;
}
.np-yt-live__frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ══════════════════════════════════════════════════════
   BARRA GLOBAL "EN VIVO"
   ══════════════════════════════════════════════════════ */
.np-yt-livebar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1500;
  display: flex;
  align-items: stretch;
  background: #16181c;
  color: #fff;
  box-shadow: 0 -4px 16px rgba(0,0,0,.35);
}
.np-yt-livebar.is-oculta { display: none; }
.np-yt-livebar__main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 16px;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-size: var(--t-sm, 14px);
  cursor: pointer;
  text-align: left;
}
.np-yt-livebar__dot {
  width: 10px; height: 10px;
  border-radius: 999px;
  background: #f00;
  flex-shrink: 0;
  animation: np-yt-pulso 1.4s ease-in-out infinite;
}
@keyframes np-yt-pulso {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,0,0,.55); }
  50%      { box-shadow: 0 0 0 7px rgba(255,0,0,0); }
}
.np-yt-livebar__main strong { color: #ff5a5a; letter-spacing: 1px; flex-shrink: 0; }
.np-yt-livebar__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255,255,255,.85);
}
.np-yt-livebar__cta {
  flex-shrink: 0;
  font-weight: 700;
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  padding: 3px 12px;
}
.np-yt-livebar__main:hover .np-yt-livebar__cta {
  background: var(--np-accent, #c8102e);
  border-color: var(--np-accent, #c8102e);
}
.np-yt-livebar__close {
  background: none;
  border: none;
  color: rgba(255,255,255,.6);
  font-size: 22px;
  line-height: 1;
  padding: 0 16px;
  cursor: pointer;
}
.np-yt-livebar__close:hover { color: #fff; }

/* ══════════════════════════════════════════════════════
   LIGHTBOX
   ══════════════════════════════════════════════════════ */
.np-yt-modal {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4vh 16px;
  background: rgba(0,0,0,.86);
}
.np-yt-modal.is-abierto { display: flex; }
.np-yt-modal__box {
  position: relative;
  width: min(1100px, 100%);
  aspect-ratio: 16 / 9;
  max-height: 90vh;
  background: #000;
  border-radius: var(--r-lg, 12px);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.np-yt-modal__box iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.np-yt-modal__close {
  position: absolute;
  top: -2px; right: 0;
  transform: translateY(-100%);
  background: none;
  border: none;
  color: rgba(255,255,255,.75);
  font-size: 34px;
  line-height: 1;
  padding: 6px 4px;
  cursor: pointer;
}
.np-yt-modal__close:hover { color: #fff; }

/* Lightbox vertical (Shorts) */
.np-yt-modal__box--v {
  aspect-ratio: 9 / 16;
  width: min(430px, calc(86vh * 9 / 16), 92vw);
}

/* Botones al canal (canal + publicaciones/Comunidad) */
.np-yt-canal-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3, 12px);
  justify-content: center;
  margin: var(--sp-6, 28px) 0;
}
.np-yt-canal-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  font-family: var(--f-head, inherit);
  font-weight: 700;
  font-size: var(--t-sm, 14px);
  text-decoration: none;
  background: var(--np-accent, #c8102e);
  color: #fff;
  transition: opacity .15s ease;
}
.np-yt-canal-btn:hover { opacity: .88; color: #fff; }
.np-yt-canal-btn--ghost {
  background: transparent;
  color: var(--np-text, #111);
  border: 1px solid var(--np-border-str, #bbb);
}
.np-yt-canal-btn--ghost:hover { border-color: var(--np-accent, #c8102e); color: var(--np-accent, #c8102e); opacity: 1; }

/* ══════════════════════════════════════════════════════
   VARIOS
   ══════════════════════════════════════════════════════ */
.np-yt-single { margin: var(--sp-5, 20px) 0; max-width: 560px; }
.np-yt-sep {
  font-family: var(--f-head, inherit);
  font-size: var(--t-lg, 18px);
  font-weight: 800;
  margin: 0 0 var(--sp-4, 16px);
}
