/* ==============================================
   VIDEOS.HTML — estilos de página
   ============================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --orange: #FF4500;
  --bg: #0f0f0f;
  --font-display: 'Anton', sans-serif;
  --font-body: 'Poppins', system-ui, sans-serif;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: #fff;
  font-family: var(--font-body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Grid 4×5 ── */
.videos-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  padding: 3px;
  padding-top: calc(61px + 3px); /* header height + gap */
}

/* ── Celda de video ── */
.video-cell {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #111;
  cursor: pointer;
}

/* Placeholder (celda vacía) */
.video-cell__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: rgba(255,255,255,0.15);
  transition: color 0.25s, background 0.25s;
}

.video-cell:hover .video-cell__placeholder {
  color: rgba(255,255,255,0.35);
  background: rgba(255,69,0,0.04);
}

.video-cell.has-video .video-cell__placeholder {
  display: none;
}

.video-cell__placeholder svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.video-cell__placeholder span {
  font-family: var(--font-body);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* iframe embed (YouTube / Vimeo) */
.video-cell iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Video nativo (MP4 / WebM) */
.video-cell video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

/* Overlay de edición (visible en hover sobre celda con video) */
.video-cell__overlay {
  position: absolute;
  inset: auto 0 0 0;
  height: 44px;
  background: linear-gradient(to top, rgba(0,0,0,0.65), transparent);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 8px;
  pointer-events: none; /* pasa clics al iframe/video */
  z-index: 5;
  opacity: 0;
  transition: opacity 0.25s;
}

.video-cell:hover .video-cell__overlay {
  opacity: 1;
}

.video-cell__edit-btn {
  pointer-events: auto; /* el botón sí captura clics */
  width: 28px;
  height: 28px;
  background: rgba(17,17,17,0.88);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 2px;
  color: rgba(255,255,255,0.65);
  font-size: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
  touch-action: manipulation;
}

.video-cell__edit-btn:hover {
  border-color: var(--orange);
  color: var(--orange);
}

/* ── Footer mínimo ── */
.videos-footer {
  padding: 3rem 4vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.videos-footer__brand {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.22);
}

.videos-footer__copy {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.18);
  letter-spacing: 0.06em;
}

/* ── Modal para añadir video ── */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.video-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.video-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.84);
  backdrop-filter: blur(4px);
}

.video-modal__box {
  position: relative;
  z-index: 1;
  background: #181818;
  border: 1px solid rgba(255,255,255,0.1);
  border-top: 3px solid var(--orange);
  padding: 2rem;
  width: min(440px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.video-modal__close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 28px;
  height: 28px;
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 2px;
  color: rgba(255,255,255,0.45);
  font-size: 0.72rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s;
  touch-action: manipulation;
}

.video-modal__close:hover {
  color: var(--orange);
  border-color: var(--orange);
}

.video-modal__title {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.2em;
  color: var(--orange);
}

.video-modal__section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.video-modal__label {
  font-family: var(--font-body);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
}

.video-modal__url {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  padding: 0.7rem 0.85rem;
  font-family: var(--font-body);
  font-size: 16px; /* iOS: evita zoom automático */
  outline: none;
  transition: border-color 0.2s;
}

.video-modal__url:focus {
  border-color: rgba(255,69,0,0.5);
}

.video-modal__url.error {
  border-color: var(--orange);
}

.video-modal__btn {
  align-self: flex-start;
  padding: 0.65rem 1.8rem;
  background: transparent;
  border: 1.5px solid #fff;
  border-radius: 50px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  min-height: 44px;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.video-modal__btn:hover {
  background: #fff;
  color: #111;
}

.video-modal__or {
  text-align: center;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.2);
  font-family: var(--font-body);
}

.video-modal__hint {
  font-family: var(--font-body);
  font-size: 0.6rem;
  color: rgba(255,255,255,0.28);
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.video-modal__remove {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 1rem;
}

.video-modal__remove-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.28);
  font-family: var(--font-body);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
  touch-action: manipulation;
}

.video-modal__remove-btn:hover {
  color: rgba(255,69,0,0.75);
}

/* ── Editor panel: mini grid de celdas ── */
.ep-vcell-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  margin-top: 0.5rem;
}

.ep-vcell-item {
  position: relative;
  aspect-ratio: 16 / 9;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.ep-vcell-item:hover {
  border-color: rgba(255,69,0,0.5);
  background: rgba(255,69,0,0.06);
}

.ep-vcell-item--has {
  border-color: rgba(255,69,0,0.35);
  background: rgba(255,69,0,0.07);
}

.ep-vcell-num {
  font-family: 'Anton', sans-serif;
  font-size: 0.52rem;
  color: rgba(255,255,255,0.3);
  line-height: 1;
}

.ep-vcell-item--has .ep-vcell-num {
  color: rgba(255,255,255,0.55);
}

.ep-vcell-type {
  font-family: 'Poppins', sans-serif;
  font-size: 0.42rem;
  letter-spacing: 0.05em;
  color: var(--orange);
  font-weight: 500;
  text-transform: uppercase;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .videos-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .videos-grid { grid-template-columns: repeat(2, 1fr); }

  .videos-footer {
    flex-direction: column;
    gap: 0.4rem;
    align-items: flex-start;
    padding: 2rem 4vw;
  }
}

@media (max-width: 420px) {
  .videos-grid { grid-template-columns: 1fr; }
}
