* { box-sizing: border-box; }
/* L'attribut [hidden] doit l'emporter sur les règles display des classes (ex: .center { display:flex }). */
[hidden] { display: none !important; }
body { margin: 0; font-family: system-ui, sans-serif; background: #14161a; color: #e8eaed; }
.center { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; }
.muted { color: #8a909a; }
.error { color: #ff6b6b; }
input, button { font: inherit; padding: .5rem .75rem; border-radius: 8px; border: 1px solid #2a2e36; background: #1c1f26; color: #e8eaed; }
button { cursor: pointer; }
button:hover { background: #262a33; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; background: #1c1f26; border-bottom: 1px solid #2a2e36; }
.tabs { display: flex; gap: .25rem; }
.tab.active { background: #3b82f6; border-color: #3b82f6; }
.topbar #search { flex: 1; max-width: 320px; }
.body { display: flex; height: calc(100vh - 57px); }
.sidebar { width: 260px; overflow: hidden; padding: .5rem; border-right: 1px solid #2a2e36; display: flex; flex-direction: column; gap: .4rem; }
.cat-search { width: 100%; flex: none; }
.cat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .15rem; }
.cat-header { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; padding: .6rem .6rem .2rem; }
.cat { text-align: left; border: none; background: transparent; padding: .4rem .6rem; border-radius: 6px; }
.cat.active { background: #3b82f6; }
.grid { flex: 1; overflow-y: auto; padding: 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; align-content: start; }
.card { background: #1c1f26; border: 1px solid #2a2e36; border-radius: 10px; overflow: hidden; cursor: pointer; }
.card:hover { border-color: #3b82f6; }
.thumb { aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; font-size: 2rem; background: #0f1115; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.title { padding: .5rem; font-size: .85rem; }

/* Lecteur invité plein écran */
.watch-body { height: 100vh; overflow: hidden; background: #000; }
#player { width: 100vw; height: 100vh; object-fit: contain; background: #000; }
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.85); }
.overlay-msg { color: #e8eaed; font-size: 1.4rem; }
/* Barre "en cours" côté hôte */
.nowbar { display: flex; align-items: center; gap: 1rem; padding: .5rem 1rem; background: #0f1115; border-bottom: 1px solid #2a2e36; }
.now-title { font-weight: 600; }
.now-controls { display: flex; gap: .4rem; align-items: center; margin-left: auto; }
.now-controls button[disabled] { opacity: .4; cursor: not-allowed; }
.watch-link { color: #3b82f6; text-decoration: none; padding: .4rem .6rem; }

/* Scène invité (conteneur du lecteur + overlay + contrôles) */
.stage { position: relative; width: 100vw; height: 100vh; background: #000; }
.stage #player { width: 100%; height: 100%; }
.stage .overlay { position: absolute; }

/* Mini-lecteur flottant côté hôte */
.host-preview { position: fixed; bottom: 16px; right: 16px; width: min(42vw, 560px); background: #000; border: 1px solid #2a2e36; border-radius: 10px; overflow: hidden; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.host-preview video { width: 100%; display: block; background: #000; }
.preview-bar { display: flex; align-items: center; justify-content: space-between; padding: .3rem .55rem; background: #0f1115; font-size: .8rem; color: #e8eaed; }
.preview-mute { background: transparent; border: none; color: #e8eaed; cursor: pointer; font-size: 1rem; }

/* Barre de contrôle (temps / progression / plein écran) */
.ctrl-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: .6rem; padding: .55rem .9rem; background: linear-gradient(transparent, rgba(0,0,0,.75)); opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 6; }
.controls-visible .ctrl-bar { opacity: 1; pointer-events: auto; }
.ctrl-cur, .ctrl-dur { color: #fff; font-size: .8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ctrl-track { flex: 1; height: 6px; background: rgba(255,255,255,.3); border-radius: 3px; position: relative; }
.ctrl-bar.seekable .ctrl-track { cursor: pointer; height: 8px; }
.ctrl-fill { height: 100%; width: 0; background: #3b82f6; border-radius: 3px; pointer-events: none; }
.ctrl-fs { background: transparent; border: none; color: #fff; font-size: 1.1rem; cursor: pointer; padding: 0 .2rem; }

/* Plein écran (scène invité ou mini-lecteur hôte) */
:fullscreen { width: 100vw; height: 100vh; }
:fullscreen video { width: 100%; height: 100%; object-fit: contain; background: #000; }
