/**
 * VidéoFlow Player CSS — Inspiré de 15Zine
 * Dark bg #161616, gold accent #f2c231, Lato, ombres subtiles, whitespace généreux.
 */

/* ─── Tokens ────────────────────────────────────────────────────────────────── */

.vf-wrap {
  --vf-bg:           #0d0d0d;
  --vf-bg-stage:     #161616;
  --vf-bg-playlist:  #111111;
  --vf-bg-item:      #1a1a1a;
  --vf-bg-item-hover:#222222;
  --vf-bg-controls:  rgba(13,13,13,.96);
  --vf-bg-overlay:   linear-gradient(to top, rgba(0,0,0,.9) 0%, rgba(0,0,0,.45) 50%, transparent 100%);

  --vf-accent:       #f2c231;    /* Override via style inline par le Renderer */
  --vf-accent-dim:   rgba(242,194,49,.2);

  --vf-text-primary: #f0ede8;
  --vf-text-muted:   #888580;
  --vf-text-dim:     #555250;

  --vf-border:       rgba(255,255,255,.07);
  --vf-border-hover: rgba(255,255,255,.14);

  --vf-radius:       8px;
  --vf-radius-sm:    4px;

  --vf-ease:         cubic-bezier(.22,.61,.36,1);
  --vf-dur:          200ms;

  --vf-bar-h:        3px;
  --vf-ratio:        16/9;

  font-family: 'Lato', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}

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

/* ─── Layout global ──────────────────────────────────────────────────────────── */

.vf-wrap {
  display: flex;
  background: var(--vf-bg);
  border-radius: var(--vf-radius);
  overflow: hidden;
  position: relative;
}

.vf-stage {
  flex: 1;
  min-width: 0;
  position: relative;
  background: #000;
  aspect-ratio: var(--vf-ratio);
  display: flex;
  flex-direction: column;
}

/* Playlist sidebar */
.vf-has-playlist .vf-stage {
  aspect-ratio: unset;
}

/* ─── Loader / Thumbnail initial ─────────────────────────────────────────────── */

.vf-loader {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: var(--vf-bg-stage);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--vf-dur) var(--vf-ease);
}

.vf-loader.vf-hidden {
  opacity: 0;
  pointer-events: none;
}

.vf-loader__thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .88;
}

/* Bouton play central */
.vf-big-play {
  position: relative;
  z-index: 1;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.72);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background var(--vf-dur) var(--vf-ease),
    transform   var(--vf-dur) cubic-bezier(.34,1.56,.64,1);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.vf-big-play svg {
  width: 32px;
  height: 32px;
  fill: #fff;
  margin-left: 4px;
  transition: fill var(--vf-dur) var(--vf-ease);
}

.vf-big-play:hover {
  background: var(--vf-accent);
  transform: scale(1.1);
}

.vf-big-play:hover svg {
  fill: #000;
}

/* ─── Zone média (iframe / video) ────────────────────────────────────────────── */

.vf-media {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.vf-media iframe,
.vf-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

/* ─── Overlay titre ──────────────────────────────────────────────────────────── */

.vf-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: var(--vf-bg-overlay);
  display: flex;
  align-items: flex-end;
  opacity: 0;
  transition: opacity var(--vf-dur) var(--vf-ease);
  pointer-events: none;
}

.vf-wrap:hover .vf-overlay,
.vf-overlay.vf-visible {
  opacity: 1;
}

.vf-overlay__inner {
  padding: 0 1rem 4.5rem;
  width: 100%;
}

.vf-overlay__channel {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--vf-accent);
  margin-bottom: 4px;
}

.vf-overlay__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--vf-text-primary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.vf-overlay__duration {
  font-size: 12px;
  color: var(--vf-text-muted);
  font-variant-numeric: tabular-nums;
}

/* ─── Controls bar ───────────────────────────────────────────────────────────── */

.vf-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 4;
  background: var(--vf-bg-controls);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0 12px 10px;
  transform: translateY(100%);
  transition: transform var(--vf-dur) var(--vf-ease);
}

.vf-wrap:hover .vf-controls,
.vf-controls.vf-visible {
  transform: translateY(0);
}

/* ─── Barre de progression ───────────────────────────────────────────────────── */

.vf-progress {
  position: relative;
  height: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  margin: 0 -12px;
  padding: 0 12px;
}

.vf-progress__bg,
.vf-progress__fill {
  position: absolute;
  left: 12px;
  right: 12px;
  height: var(--vf-bar-h);
  border-radius: calc(var(--vf-bar-h) / 2);
  pointer-events: none;
  transition: height var(--vf-dur) var(--vf-ease);
}

.vf-progress__bg {
  background: rgba(255,255,255,.15);
}

.vf-progress__fill {
  background: var(--vf-accent);
  width: 0%;
}

.vf-progress__thumb {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--vf-accent);
  left: 12px;
  transform: translateX(-50%) scale(0);
  transition: transform var(--vf-dur) cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
}

.vf-progress:hover .vf-progress__bg,
.vf-progress:hover .vf-progress__fill {
  height: 5px;
}

.vf-progress:hover .vf-progress__thumb {
  transform: translateX(-50%) scale(1);
}

/* ─── Ligne controls ─────────────────────────────────────────────────────────── */

.vf-controls__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 4px;
  height: 32px;
}

.vf-controls__left,
.vf-controls__right {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* ─── Boutons controls ───────────────────────────────────────────────────────── */

.vf-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--vf-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--vf-radius-sm);
  transition: color var(--vf-dur) var(--vf-ease), background var(--vf-dur) var(--vf-ease), transform var(--vf-dur) var(--vf-ease);
  flex-shrink: 0;
}

.vf-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  pointer-events: none;
}

.vf-btn:hover {
  color: var(--vf-accent);
  background: var(--vf-accent-dim);
}

.vf-btn:active {
  transform: scale(.9);
}

.vf-btn--play svg { width: 22px; height: 22px; }

/* ─── Volume ─────────────────────────────────────────────────────────────────── */

.vf-volume {
  display: flex;
  align-items: center;
  gap: 2px;
}

.vf-volume__input {
  -webkit-appearance: none;
  appearance: none;
  width: 0;
  height: var(--vf-bar-h);
  border-radius: calc(var(--vf-bar-h)/2);
  background: rgba(255,255,255,.2);
  cursor: pointer;
  overflow: hidden;
  transition: width var(--vf-dur) var(--vf-ease);
  outline: none;
  vertical-align: middle;
}

.vf-volume:hover .vf-volume__input,
.vf-volume__input:focus {
  width: 60px;
}

.vf-volume__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--vf-accent);
  box-shadow: -60px 0 0 58px var(--vf-accent);
}

.vf-volume__input::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: none;
  border-radius: 50%;
  background: var(--vf-accent);
}

/* ─── Temps ──────────────────────────────────────────────────────────────────── */

.vf-time {
  font-size: 12px;
  color: var(--vf-text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 0 4px;
  letter-spacing: .02em;
}

.vf-time__cur {
  color: var(--vf-text-primary);
}

/* ─── Vitesse ────────────────────────────────────────────────────────────────── */

.vf-speed {
  position: relative;
}

.vf-btn--speed {
  width: auto;
  padding: 0 6px;
  min-width: 32px;
}

.vf-speed__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}

.vf-speed__menu {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  background: #1a1a1a;
  border: 1px solid var(--vf-border);
  border-radius: var(--vf-radius);
  overflow: hidden;
  min-width: 64px;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}

.vf-speed__menu[hidden] { display: none; }

.vf-speed__item {
  display: block;
  width: 100%;
  padding: 7px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--vf-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: background var(--vf-dur), color var(--vf-dur);
}

.vf-speed__item:hover,
.vf-speed__item--active {
  background: var(--vf-accent-dim);
  color: var(--vf-accent);
}

/* ─── Playlist sidebar ───────────────────────────────────────────────────────── */

.vf-playlist {
  width: 280px;
  flex-shrink: 0;
  background: var(--vf-bg-playlist);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--vf-border);
  max-height: 520px;
}

.vf-playlist__header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--vf-border);
  flex-shrink: 0;
}

.vf-playlist__count {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--vf-text-muted);
}

.vf-playlist__list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--vf-border) transparent;
}

.vf-playlist__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--vf-border);
  transition: background var(--vf-dur) var(--vf-ease);
  position: relative;
}

.vf-playlist__item:hover {
  background: var(--vf-bg-item-hover);
}

.vf-playlist__item--active {
  background: var(--vf-bg-item);
}

.vf-playlist__item--active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--vf-accent);
  border-radius: 0 2px 2px 0;
}

/* Thumbnail */
.vf-playlist__thumb {
  position: relative;
  flex-shrink: 0;
  width: 80px;
  height: 52px;
  border-radius: var(--vf-radius-sm);
  overflow: hidden;
  background: var(--vf-bg-stage);
}

.vf-playlist__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vf-playlist__thumb-placeholder {
  width: 100%;
  height: 100%;
  background: #2a2a2a;
}

.vf-playlist__num {
  position: absolute;
  top: 3px;
  left: 4px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,.6);
  line-height: 1;
}

.vf-playlist__play-icon {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 20px;
  height: 20px;
  fill: #fff;
  opacity: 0;
  transition: opacity var(--vf-dur) var(--vf-ease);
}

.vf-playlist__item:hover .vf-playlist__play-icon {
  opacity: .9;
}

.vf-playlist__item--active .vf-playlist__play-icon {
  opacity: 1;
  fill: var(--vf-accent);
}

/* Info */
.vf-playlist__info {
  flex: 1;
  min-width: 0;
}

.vf-playlist__title {
  font-size: 12px;
  font-weight: 500;
  color: var(--vf-text-primary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 3px;
}

.vf-playlist__item--active .vf-playlist__title {
  color: var(--vf-accent);
}

.vf-playlist__duration {
  font-size: 10px;
  color: var(--vf-text-muted);
  font-variant-numeric: tabular-nums;
}

/* ─── Focus / Accessibilité ──────────────────────────────────────────────────── */

.vf-wrap :focus-visible {
  outline: 2px solid var(--vf-accent);
  outline-offset: 1px;
}

.vf-wrap :focus:not(:focus-visible) {
  outline: none;
}

/* ─── Fullscreen ─────────────────────────────────────────────────────────────── */

.vf-wrap:fullscreen,
.vf-wrap:-webkit-full-screen {
  border-radius: 0;
  width: 100vw;
  height: 100vh;
}

.vf-wrap:fullscreen .vf-stage,
.vf-wrap:-webkit-full-screen .vf-stage {
  height: 100%;
  aspect-ratio: unset;
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .vf-playlist {
    width: 100%;
    max-height: 200px;
    border-left: none;
    border-top: 1px solid var(--vf-border);
  }

  .vf-has-playlist {
    flex-direction: column;
  }

  .vf-stage {
    aspect-ratio: var(--vf-ratio);
  }

  .vf-playlist__thumb {
    width: 64px;
    height: 42px;
  }

  .vf-time__sep,
  .vf-time__total { display: none; }
}

@media (max-width: 380px) {
  .vf-btn--speed,
  .vf-btn--pip { display: none; }
  .vf-volume__input { display: none; }
}

/* ─── Animations ─────────────────────────────────────────────────────────────── */

@keyframes vf-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.vf-media iframe,
.vf-media video {
  animation: vf-fade-in .25s var(--vf-ease) both;
}

/* ─── Reduced motion ────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .vf-wrap * { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

/* ─── Hint "son désactivé" (autoplay muté) ───────────────────────────────────── */

.vf-mute-hint {
  position: absolute;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(13,13,13,.9);
  border: 1px solid var(--vf-accent);
  border-radius: 24px;
  color: var(--vf-text-primary);
  font-size: 12px;
  font-family: var(--vf-font);
  white-space: nowrap;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: vf-hint-in .3s cubic-bezier(.34,1.56,.64,1) both;
  transition: opacity .2s, transform .2s;
}

.vf-mute-hint:hover {
  background: var(--vf-accent);
  color: #000;
  transform: translateX(-50%) scale(1.04);
}

@keyframes vf-hint-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Bouton mute en état actif (mis en évidence) */
.vf-btn--muted {
  color: var(--vf-accent) !important;
  position: relative;
}

.vf-btn--muted::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--vf-accent);
}
