﻿/* ===== Films et series (/movies, /series) : reprend la salle sombre de books.css (classes lib-*), vignettes 16:9 + lecteur ===== */

.vid { --lib-card-w: 250px; }
.lib-row-track > .vid-card { flex: 0 0 var(--lib-card-w); scroll-snap-align: start; }
.vid .lib-filters .lib-chips .bi { margin-right: 4px; }

/* ---- vignette 16:9 (image tiree du film, sinon titre sur un degrade) ---- */
.vid-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--lib-surface); }
.vid-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vid-thumb-fallback {
    position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; padding: 12px;
    background: linear-gradient(135deg, hsl(var(--hue) 40% 28%), hsl(calc(var(--hue) + 50) 45% 14%));
    color: #fff;
}
.vid-thumb-fallback span { font-weight: 700; line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.vid-thumb-fallback small { opacity: .75; font-size: .75rem; }

/* ---- barre de progression (deja vu / en cours) ---- */
.vid-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .25); z-index: 1; }
.vid-progress > span { display: block; height: 100%; background: var(--lib-accent); }

/* ---- carte ---- */
.vid-card { position: relative; min-width: 0; }
.vid-card-open {
    position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer;
    border-radius: 8px; overflow: hidden; transition: transform .2s ease, box-shadow .2s ease;
}
.vid-card-open:hover, .vid-card-open:focus-visible { transform: scale(1.03); box-shadow: 0 12px 30px rgba(0, 0, 0, .55); }
.vid-card-open:focus-visible { outline: 2px solid var(--lib-accent); outline-offset: 3px; }
.vid-card-done {
    position: absolute; top: 8px; left: 8px; z-index: 1; width: 24px; height: 24px; border-radius: 50%;
    background: rgba(0, 0, 0, .7); color: #fff; display: grid; place-items: center; font-size: .9rem;
}
.vid-card-play {
    position: absolute; right: 10px; top: calc((var(--lib-card-w) * 9 / 16) - 54px); z-index: 2; width: 44px; height: 44px; border-radius: 50%;
    border: 0; background: var(--lib-accent); color: #111; font-size: 1.5rem; line-height: 1;
    display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
    opacity: 0; transform: translateY(6px); transition: opacity .18s, transform .18s, background .15s;
}
.lib-grid .vid-card-play { top: 10px; }
.vid-card:hover .vid-card-play, .vid-card-play:focus-visible { opacity: 1; transform: none; }
.vid-card-play:hover { background: #ff9233; }
@media (hover: none) { .vid-card-play { display: none; } }
.vid-card-center-play {
    position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.4rem; color: #fff;
    background: rgba(0, 0, 0, .25); opacity: 0; transition: opacity .15s;
}
.vid-card-open:hover .vid-card-center-play { opacity: 1; }
.vid-card-text { display: flex; flex-direction: column; padding: 8px 2px 0; min-width: 0; }
.vid-card-title { color: #f1f1f3; font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vid-card-sub { color: var(--lib-muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- a la une : l'image du film en fond, nette ---- */
.vid-hero { min-height: clamp(260px, 34vw, 420px); display: flex; align-items: flex-end; }
.vid-hero .lib-hero-bg { inset: 0; filter: brightness(.7); transform: none; }
.vid-hero::after { background: linear-gradient(90deg, rgba(18, 18, 20, .92) 0%, rgba(18, 18, 20, .55) 45%, rgba(18, 18, 20, 0) 75%), linear-gradient(0deg, rgba(18, 18, 20, .7), transparent 50%); }
.vid-hero .lib-hero-inner { width: 100%; }

/* ---- fiche ---- */
.vid-modal { width: min(900px, calc(100vw - 32px)); }
.vid-banner { position: relative; }
.vid-banner .vid-thumb { border-radius: 0; }
.vid-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 55%, var(--lib-bg, #121214)); pointer-events: none; }
.vid-banner .vid-progress { bottom: 0; z-index: 2; }
.vid-banner-play {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2;
    width: 72px; height: 72px; border-radius: 50%; border: 0; font-size: 2.4rem; line-height: 1;
    background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; cursor: pointer;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .6); transition: background .15s, transform .15s;
}
.vid-banner-play:hover { background: var(--lib-accent); color: #111; transform: translate(-50%, -50%) scale(1.06); }
.vid-detail { position: relative; z-index: 1; padding: 0 28px 24px; margin-top: -36px; }
.vid-detail h2 { font-size: 1.8rem; font-weight: 700; color: #fff; margin: 0 0 4px; line-height: 1.15; text-transform: none; letter-spacing: -.01em; }
.vid-tag-done { color: #8fe3a5 !important; }
.vid-warn { color: #ffcf8a; font-size: .88rem; margin: 6px 0 0; }
.vid-seasons { margin: 18px 0 6px; }

/* ---- episodes ---- */
.vid-episodes { list-style: none; margin: 8px 0 0; padding: 0; }
.vid-episode { display: flex; align-items: center; gap: 8px; border-radius: 10px; padding-right: 6px; transition: background .12s; }
.vid-episode:hover, .vid-episode:focus-within { background: rgba(255, 255, 255, .06); }
.vid-episode-main {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 8px;
    border: 0; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit;
}
.vid-episode-thumb { position: relative; flex: 0 0 150px; border-radius: 6px; overflow: hidden; }
.vid-episode-thumb .vid-thumb { border-radius: 6px; }
.vid-episode-thumb .vid-thumb-fallback span { font-size: .75rem; }
.vid-episode-play {
    position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.8rem; color: #fff;
    background: rgba(0, 0, 0, .35); opacity: 0; transition: opacity .12s;
}
.vid-episode:hover .vid-episode-play, .vid-episode-main:focus-visible .vid-episode-play { opacity: 1; }
.vid-episode-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vid-episode-title { color: #f1f1f3; font-weight: 600; }
.vid-episode-code { color: var(--lib-muted); font-variant-numeric: tabular-nums; margin-right: 6px; font-weight: 500; }
.vid-episode-done { color: #8fe3a5; margin-left: 4px; }
.vid-episode-sub { color: var(--lib-muted); font-size: .82rem; }

/* ---- page Media (/media) : rangées de clips 16:9 et d'albums carrés ---- */
.med .med-square { --lib-card-w: 180px; }
.med-row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.med-row-head .lib-row-title { margin-bottom: 0; }
.med-row-head + .lib-row, .med-row-head + .lib-grid { margin-top: 12px; }
.med-duration {
    position: absolute; right: 6px; bottom: 8px; z-index: 1; padding: 1px 6px; border-radius: 4px;
    background: rgba(0, 0, 0, .78); color: #fff; font-size: .75rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.med-artist { display: block; max-width: 100%; padding: 0; border: 0; background: none; text-align: left; font: inherit; font-size: .78rem; }
.med-artist:hover { color: #f1f1f3; text-decoration: underline; }

@media (max-width: 640px) {
    .vid { --lib-card-w: 200px; }
    .med .med-square { --lib-card-w: 132px; }
    .lib-grid:has(> .vid-card) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .vid-detail { padding: 0 18px 22px; }
    .vid-detail h2 { font-size: 1.45rem; }
    .vid-episode-thumb { flex-basis: 112px; }
}

/* ===== Lecteur ===== */
body.vp-open { overflow: hidden; }
.vp {
    position: fixed; inset: 0; z-index: 2000; background: #000; color: #fff;
    display: flex; align-items: center; justify-content: center;
}
.vp-video { width: 100%; height: 100%; max-height: 100vh; background: #000; outline: none; }
.vp-video::cue { background: rgba(0, 0, 0, .65); font-size: 1.05em; }
/* Morceau sans image : la pochette (poster) au centre, sur un fond sombre. */
.vp.vp-audio .vp-video { object-fit: contain; background: radial-gradient(circle at 50% 40%, #26262c, #000 70%); }
.vp-pos { flex: 0 0 auto; color: #c9c9cf; font-size: .85rem; font-variant-numeric: tabular-nums; }
.vp-top {
    position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; gap: 12px;
    padding: 14px 18px 40px; background: linear-gradient(rgba(0, 0, 0, .8), transparent);
    transition: opacity .3s;
}
.vp.vp-idle .vp-top { opacity: 0; pointer-events: none; }
.vp.vp-idle { cursor: none; }
.vp-titles { flex: 1; min-width: 0; }
.vp-title { font-weight: 700; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vp-sub { color: #c9c9cf; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vp-btn {
    flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .1);
    color: #fff !important; display: grid; place-items: center; font-size: 1.25rem; cursor: pointer; text-decoration: none;
}
.vp-btn:hover { background: rgba(255, 255, 255, .22); }
.vp-btn[hidden] { display: none; }
.vp-toast {
    position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 2;
    display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-radius: 999px;
    background: rgba(20, 20, 24, .9); box-shadow: 0 8px 24px rgba(0, 0, 0, .5); font-size: .92rem; white-space: nowrap;
}
.vp-toast[hidden], .vp-msg[hidden], .vp-upnext[hidden] { display: none; }
.vp-toast-btn { border: 0; background: none; color: #ff9233; font-weight: 700; cursor: pointer; padding: 0; }
.vp-msg {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; text-align: center;
    width: min(460px, calc(100vw - 32px)); padding: 24px; border-radius: 14px; background: rgba(20, 20, 24, .95);
}
.vp-msg p { margin: 0 0 8px; font-weight: 600; }
.vp-msg .vp-msg-hint { color: #b9b9c0; font-weight: 400; font-size: .9rem; margin-bottom: 16px; }
.vp-upnext {
    position: absolute; right: 24px; bottom: 90px; z-index: 3; width: min(340px, calc(100vw - 48px));
    padding: 16px 18px; border-radius: 14px; background: rgba(20, 20, 24, .95); box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}
.vp-upnext-label { color: #b9b9c0; font-size: .82rem; }
.vp-upnext-title { font-weight: 700; margin: 4px 0 12px; }
.vp-upnext-actions { display: flex; gap: 8px; }
.vp-pill {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 0;
    background: rgba(255, 255, 255, .12); color: #fff !important; font-weight: 600; cursor: pointer; text-decoration: none;
}
.vp-pill:hover { background: rgba(255, 255, 255, .22); }
.vp-pill-light { background: #fff; color: #111 !important; }
.vp-pill-light:hover { background: #e6e6e6; }

/* ===== Page Media en pleine largeur (comme YouTube) ===== */
body:has(.med) { background: #121214; }
body:has(.med) .page-body > .container { max-width: none; padding-inline: 0; }
.lib.med { --lib-card-w: 290px; border-radius: 0; margin: 0; min-height: calc(100vh - 60px); padding: 22px clamp(16px, 2.4vw, 40px) 48px; }
.med .lib-grid { gap: 28px 16px; }
@media (min-width: 1800px) { .lib.med { --lib-card-w: 320px; } }

/* ---- vue watch : lecteur a gauche, "a suivre" a droite ---- */
.med-watch { display: grid; grid-template-columns: minmax(0, 1fr) clamp(340px, 26vw, 440px); gap: 24px; align-items: start; }
.med-player {
    position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: calc(100vh - 190px);
    background: #000; border-radius: 12px; overflow: hidden;
}
.med-player .vp-host { position: absolute; inset: 0; }
.vp.vp-inline { position: absolute; inset: 0; z-index: auto; }
.vp.vp-inline .vp-top { display: none; }
.vp.vp-inline .vp-video { max-height: none; }
.med-watch-title { font-size: 1.35rem; font-weight: 700; color: #fff; margin: 14px 0 6px; line-height: 1.25; text-transform: none; letter-spacing: 0; }
.med-watch-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.med-watch-sub { color: var(--lib-muted); }
.med-watch-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.med-watch-side .lib-row-title { margin-bottom: 10px; }
.med-side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.med-side-item {
    display: flex; gap: 10px; width: 100%; padding: 6px; border: 0; border-radius: 10px;
    background: none; color: inherit; text-align: left; cursor: pointer; font: inherit;
}
.med-side-item:hover, .med-side-item:focus-visible { background: rgba(255, 255, 255, .07); }
.med-side-item.current { background: rgba(255, 122, 0, .14); }
.med-side-thumb { position: relative; flex: 0 0 168px; border-radius: 8px; overflow: hidden; }
.med-side-thumb .vid-thumb { border-radius: 8px; }
.med-side-thumb .vid-thumb-fallback { padding: 8px; }
.med-side-thumb .vid-thumb-fallback span { font-size: .75rem; }
.med-side-thumb.square .vid-thumb img { object-fit: contain; background: #000; }
.med-side-now {
    position: absolute; inset: 0; display: grid; place-items: center; z-index: 1;
    background: rgba(0, 0, 0, .55); color: #fff; font-size: .8rem; font-weight: 700;
}
.med-side-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-top: 2px; }
.med-side-title {
    color: #f1f1f3; font-weight: 600; font-size: .9rem; line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.med-side-sub { color: var(--lib-muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 1100px) {
    .med-watch { grid-template-columns: minmax(0, 1fr); }
    .med-player { max-height: none; }
}
@media (max-width: 640px) {
    .lib.med { --lib-card-w: 200px; padding-inline: 12px; }
    .med .lib-grid:has(> .vid-card) { grid-template-columns: minmax(0, 1fr); }
    .med-watch { margin-inline: -12px; }
    .med-player { border-radius: 0; }
    .med-watch-main > :not(.med-player), .med-watch-side { padding-inline: 12px; }
    .med-side-thumb { flex-basis: 140px; }
}
