/* ================================================================
   SIRA+ — Lecteur vidéo premium (style Netflix)
   ================================================================ */

.sira-player {
  position: relative;
  width: 100%;
  height: calc(100vh - var(--nav-total));
  height: calc(100svh - var(--nav-total));
  background: #000;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
.sira-player.fullscreen {
  height: 100vh; height: 100svh;
}

.sira-player video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
}

/* ── Loader ──────────────────────────────────────────────────────── */
.sp-loader {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 5; pointer-events: none;
  opacity: 0; transition: opacity .2s;
}
.sp-loader.show { opacity: 1; }
.sp-spinner {
  width: 52px; height: 52px;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: var(--c-gold);
  border-radius: 50%;
  animation: sp-spin .8s linear infinite;
}
@keyframes sp-spin { to { transform: rotate(360deg); } }

/* ── Overlay de contrôles ────────────────────────────────────────── */
.sp-overlay {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column;
  justify-content: space-between;
  opacity: 1;
  transition: opacity .3s var(--ease);
}
.sp-overlay.hidden { opacity: 0; pointer-events: none; }
.sira-player.playing .sp-overlay.hidden { cursor: none; }

/* Gradients haut et bas pour lisibilité */
.sp-overlay::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 140px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(0,0,0,.7), transparent);
}
.sp-overlay::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 180px; pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,.8), transparent);
}

/* ── Haut ────────────────────────────────────────────────────────── */
.sp-top {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 16px;
  padding: calc(var(--safe-top) + 18px) max(24px, var(--safe-right)) 18px max(24px, var(--safe-left));
}
.sp-back {
  width: 42px; height: 42px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; border-radius: 50%;
  transition: background .2s, transform .2s;
}
.sp-back:hover { background: rgba(255,255,255,.15); transform: scale(1.05); }
.sp-back svg { width: 24px; height: 24px; }
.sp-title-wrap { min-width: 0; }
.sp-title {
  font-family: var(--f-display); font-weight: 700;
  font-size: 1.15rem; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
}
.sp-subtitle {
  font-size: .82rem; color: rgba(255,255,255,.75); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
}

/* ── Centre ──────────────────────────────────────────────────────── */
.sp-center {
  position: relative; z-index: 2;
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: clamp(36px, 10vw, 80px);
}
.sp-bigplay {
  width: 76px; height: 76px;
  border: none; border-radius: 50%;
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s var(--ease), background .2s;
}
.sp-bigplay:hover { background: rgba(255,255,255,.28); transform: scale(1.08); }
.sp-bigplay:active { transform: scale(.95); }
.sp-bigplay svg { width: 34px; height: 34px; }
.sp-icon-play { margin-left: 4px; }

.sp-skip {
  background: none; border: none; cursor: pointer; color: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  position: relative; opacity: .9;
  transition: transform .2s, opacity .2s;
}
.sp-skip:hover { opacity: 1; transform: scale(1.1); }
.sp-skip svg { width: 34px; height: 34px; }
.sp-skip span {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -40%);
  font-size: .58rem; font-weight: 800;
}

/* ── Bas ─────────────────────────────────────────────────────────── */
.sp-bottom {
  position: relative; z-index: 2;
  padding: 0 max(24px, var(--safe-right)) calc(var(--safe-bottom) + 18px) max(24px, var(--safe-left));
}

/* Barre de progression */
.sp-progress {
  padding: 12px 0; cursor: pointer;
}
.sp-progress-track {
  position: relative; height: 4px;
  background: rgba(255,255,255,.25);
  border-radius: 99px;
  transition: height .15s;
}
.sp-progress:hover .sp-progress-track { height: 6px; }
.sp-progress-buffer {
  position: absolute; top: 0; left: 0; height: 100%;
  background: rgba(255,255,255,.3); border-radius: 99px; width: 0;
}
.sp-progress-fill {
  position: absolute; top: 0; left: 0; height: 100%;
  background: var(--c-gold); border-radius: 99px; width: 0;
}
.sp-progress-handle {
  position: absolute; top: 50%; left: 0;
  width: 14px; height: 14px;
  background: var(--c-gold); border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform .15s var(--ease);
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.sp-progress:hover .sp-progress-handle { transform: translate(-50%, -50%) scale(1); }

/* Contrôles */
.sp-controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 4px;
}
.sp-controls-left, .sp-controls-right {
  display: flex; align-items: center; gap: 6px;
}
.sp-ctrl {
  width: 40px; height: 40px; flex-shrink: 0;
  background: none; border: none; cursor: pointer; color: #fff;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; opacity: .92;
  transition: background .2s, opacity .2s, transform .15s;
  text-decoration: none;
}
.sp-ctrl:hover { background: rgba(255,255,255,.15); opacity: 1; transform: scale(1.05); }
.sp-ctrl svg { width: 22px; height: 22px; }
.sp-ctrl.active { color: var(--c-gold); }

/* Volume */
.sp-volume { display: flex; align-items: center; }
.sp-vol-slider {
  width: 0; opacity: 0; overflow: hidden;
  transition: width .25s var(--ease), opacity .2s;
  -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 99px;
  background: rgba(255,255,255,.3); cursor: pointer;
}
.sp-volume:hover .sp-vol-slider { width: 72px; opacity: 1; margin: 0 8px 0 2px; }
.sp-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; border-radius: 50%; background: #fff; cursor: pointer;
}
.sp-vol-slider::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%; background: #fff; border: none; cursor: pointer;
}

/* Temps */
.sp-time {
  font-size: .82rem; font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,.9); margin-left: 6px; white-space: nowrap;
}

/* ── Zones de double-tap (mobile) ────────────────────────────────── */
.sp-tap-zone {
  position: absolute; top: 15%; bottom: 25%; width: 30%;
  z-index: 8; display: none;
}
.sp-tap-left  { left: 0; }
.sp-tap-right { right: 0; }
.sp-tap-flash {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: #fff; font-size: .75rem; font-weight: 700;
  pointer-events: none; opacity: 0;
}
.sp-tap-flash svg { width: 40px; height: 40px; }
.sp-tap-flash.show { animation: tapFlash .6s ease; }
@keyframes tapFlash {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.8); }
  30% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.1); }
}

/* ── Autoplay ────────────────────────────────────────────────────── */
.sp-autoplay {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(0,0,0,.85);
  display: none; align-items: center; justify-content: center;
}
.sp-autoplay.show { display: flex; }
.sp-autoplay-card { text-align: center; }
.sp-autoplay-label {
  font-size: .8rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--c-text-2); margin-bottom: 16px;
}
.sp-autoplay-ring {
  position: relative; width: 80px; height: 80px; margin: 0 auto 20px;
}
.sp-autoplay-ring svg { width: 80px; height: 80px; transform: rotate(-90deg); }
.sp-autoplay-ring circle {
  fill: none; stroke: var(--c-gold); stroke-width: 3;
  stroke-dasharray: 126; stroke-dashoffset: 0;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}
.sp-autoplay-ring span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-display); font-size: 2rem; font-weight: 800; color: #fff;
}
.sp-autoplay-actions { display: flex; gap: 10px; justify-content: center; }

/* ── Erreur ──────────────────────────────────────────────────────── */
.sp-error {
  position: absolute; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center; padding: 24px; background: #000;
}

/* ── Responsive lecteur ──────────────────────────────────────────── */
@media (max-width: 700px) {
  .sp-tap-zone { display: block; }
  .sp-bigplay { width: 64px; height: 64px; }
  .sp-bigplay svg { width: 28px; height: 28px; }
  .sp-skip svg { width: 28px; height: 28px; }
  .sp-title { font-size: 1rem; }
  .sp-subtitle { font-size: .76rem; }
  .sp-top { padding: calc(var(--safe-top) + 14px) 16px 14px; }
  .sp-bottom { padding: 0 16px calc(var(--safe-bottom) + 14px); }
  .sp-time { font-size: .76rem; }
  /* Cacher volume slider sur mobile (le système gère) */
  .sp-volume:hover .sp-vol-slider { width: 0; opacity: 0; margin: 0; }
  .sp-ctrl { width: 38px; height: 38px; }
  .sp-ctrl svg { width: 20px; height: 20px; }
  /* Cacher temps total sur très petit écran, garder current */
}

@media (max-width: 420px) {
  .sp-controls-left .sp-time { font-size: .72rem; }
  .sp-center { gap: 28px; }
}

/* Plein écran natif */
.sira-player:fullscreen { height: 100vh; }
.sira-player:fullscreen video { object-fit: contain; }
.sira-player:-webkit-full-screen { height: 100vh; }
