/* Lecteur multimédia — ServicesHub.ca : palette du hub */
:root {
  --nuit: #070d24; --nuit-2: #0d1838; --nuit-3: #14225a; --bleu: #2f6bff; --ciel: #38bdf8; --lis: #f6c744;
  --menthe: #34d399; --rouge: #f87171; --texte: #dbe4ff; --doux: #93a3d1; --ligne: rgba(255,255,255,.12); --verre: rgba(255,255,255,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--nuit); color: var(--texte); font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
body { display: flex; flex-direction: column; overflow: hidden; }
a { color: var(--ciel); }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--doux); margin: 16px 0 8px; }
button, input, select { font: inherit; color: inherit; }
button { background: var(--verre); border: 1px solid var(--ligne); border-radius: 8px; padding: 6px 11px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
button:hover { border-color: var(--ciel); }
button:disabled { opacity: .4; cursor: default; }
button.principal { background: var(--bleu); border-color: var(--bleu); color: #fff; font-weight: 600; }
button.principal:hover { background: #4a7fff; }
a.bouton { display: inline-flex; align-items: center; background: var(--bleu); border: 1px solid var(--bleu); border-radius: 8px; padding: 6px 11px; color: #fff; text-decoration: none; font-weight: 600; }
a.bouton:hover { background: #4a7fff; }
button.actif { background: rgba(47,107,255,.35); border-color: var(--ciel); color: #fff; }
button.danger { color: #ffb4b4; }
button.enregistrement-actif { background: #b91c1c; border-color: #ef4444; color: #fff; }
button.icone { padding: 6px 11px; }
select, input[type=text] { background: var(--nuit-2); border: 1px solid var(--ligne); border-radius: 8px; padding: 7px 9px; color: var(--texte); }
input[type=text]:focus, select:focus { outline: none; border-color: var(--ciel); }
input[type=range] { accent-color: var(--ciel); }
kbd { background: var(--nuit-3); border: 1px solid var(--ligne); border-radius: 4px; padding: 0 5px; font-size: 12px; }
code { background: rgba(0,0,0,.35); border-radius: 4px; padding: 1px 4px; font-size: 12px; }
[hidden] { display: none !important; }
.indice { color: var(--doux); font-size: 12px; margin: 8px 0 0; }
.menthe { color: var(--menthe) !important; }
.ligne { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ligne.centre { justify-content: center; }

/* En-tête */
#entete { height: 56px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--nuit-2); border-bottom: 1px solid var(--ligne); }
.retour { color: var(--doux); text-decoration: none; font-size: 13px; white-space: nowrap; }
.retour:hover { color: #fff; }
.marque { font-size: 16px; white-space: nowrap; }
.marque b { color: var(--ciel); }
.url { flex: 1; display: flex; gap: 6px; min-width: 0; }
.url input { flex: 1; min-width: 0; background: rgba(0,0,0,.35); }

/* Disposition */
#app { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 340px; }
#scene { min-width: 0; min-height: 0; display: flex; background: #000; }
#cadre { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #000; outline: none; display: flex; align-items: center; justify-content: center; }
#cadre.cache-souris { cursor: none; }
#video { width: 100%; height: 100%; object-fit: contain; transition: transform .2s, filter .1s; }
#visu { position: absolute; inset: 0; width: 100%; height: calc(100% - 70px); }
#audioSeul { position: absolute; inset: 0 0 70px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; pointer-events: none; text-align: center; padding: 0 20px; }
#audioSeul .disque { width: 140px; height: 140px; border-radius: 50%; display: grid; place-items: center; font-size: 54px; background: radial-gradient(circle at 30% 25%, #5b8cff, var(--bleu) 45%, #1a3fb3); box-shadow: 0 0 80px rgba(47,107,255,.55); }
#cadre.joue #audioSeul .disque { animation: tourne 6s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
#audioSeul b { font-size: 18px; color: #fff; text-shadow: 0 2px 10px #000; }
#visu:not([hidden]) ~ #audioSeul .disque { display: none; }

/* Accueil */
#accueil { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(800px 500px at 70% 0%, rgba(47,107,255,.22), transparent 60%), var(--nuit); }
.accueil-in { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; max-width: 560px; padding: 34px 26px; border: 2px dashed rgba(56,189,248,.4); border-radius: 20px; background: rgba(56,189,248,.04); }
.accueil-in .gros { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; color: #fff; background: linear-gradient(135deg, var(--bleu), var(--ciel)); box-shadow: 0 10px 40px rgba(47,107,255,.5); margin-bottom: 6px; }
.accueil-in b { font-size: 19px; color: #fff; }
.accueil-in span, .accueil-in small { color: var(--doux); }
.accueil-in .ligne { margin: 10px 0 6px; }

/* Messages */
#message { position: absolute; inset: 0 0 70px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 20px; background: rgba(7,13,36,.55); }
#message .boite { max-width: 520px; background: rgba(13,24,56,.95); border: 1px solid var(--ligne); border-radius: 14px; padding: 18px 20px; }
#message .boite b { display: block; color: #fff; margin-bottom: 6px; font-size: 15px; }
#message .boite p { margin: 4px 0; color: var(--doux); }
.rond { width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--ciel); animation: tourne 1s linear infinite; }
.progres { width: 260px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.progres i { display: block; height: 100%; background: linear-gradient(90deg, var(--bleu), var(--ciel)); width: 0; transition: width .3s; }
#osd { position: absolute; top: 16px; right: 16px; background: rgba(0,0,0,.65); border-radius: 10px; padding: 8px 14px; font-size: 16px; font-weight: 600; color: #fff; pointer-events: none; }
.gros-play { position: absolute; width: 76px; height: 76px; border-radius: 50%; font-size: 30px; background: rgba(47,107,255,.85); border: 0; color: #fff; box-shadow: 0 10px 40px rgba(0,0,0,.5); }

/* Contrôles */
#controles { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 12px 8px; background: linear-gradient(transparent, rgba(0,0,0,.85) 45%); transition: opacity .25s; z-index: 3; }
#cadre.inactif #controles { opacity: 0; pointer-events: none; }
#accueil:not([hidden]) ~ #controles { display: none; }
#controles button { background: transparent; border-color: transparent; color: #fff; padding: 5px 8px; font-size: 15px; min-width: 34px; }
#controles button:hover { background: rgba(255,255,255,.12); border-color: transparent; }
#controles button.actif { background: rgba(56,189,248,.28); }
#controles button.play { font-size: 18px; }
.rangee { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.groupe { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
#volume { width: 86px; }
.temps { font-variant-numeric: tabular-nums; font-size: 13px; color: #e8eeff; margin-left: 8px; white-space: nowrap; }
#barreTemps { position: relative; height: 18px; cursor: pointer; display: flex; align-items: center; margin-bottom: 4px; touch-action: none; }
#barreTemps .piste { position: relative; width: 100%; height: 4px; border-radius: 2px; background: rgba(255,255,255,.22); transition: height .15s; }
#barreTemps:hover .piste { height: 6px; }
#barreTemps .tampon, #barreTemps .joue, #barreTemps .zone-ab { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 2px; }
#barreTemps .tampon { background: rgba(255,255,255,.3); }
#barreTemps .joue { background: var(--ciel); }
#barreTemps .zone-ab { background: rgba(246,199,68,.55); }
#barreTemps .pastille { position: absolute; width: 13px; height: 13px; border-radius: 50%; background: #fff; transform: translateX(-50%); left: 0; box-shadow: 0 0 6px rgba(0,0,0,.5); pointer-events: none; }
#bulleTemps { position: absolute; bottom: 20px; transform: translateX(-50%); background: rgba(0,0,0,.85); color: #fff; font-size: 12px; padding: 3px 7px; border-radius: 6px; pointer-events: none; white-space: nowrap; }

/* Menu contextuel (sous-titres, vitesse, qualité) */
.menu { position: absolute; right: 12px; bottom: 70px; z-index: 6; min-width: 210px; max-height: 60%; overflow-y: auto; background: rgba(13,24,56,.97); border: 1px solid var(--ligne); border-radius: 12px; padding: 6px; box-shadow: 0 18px 50px rgba(0,0,0,.5); }
.menu .titre-menu { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--doux); padding: 6px 10px 4px; }
.menu button { display: flex; width: 100%; justify-content: flex-start; background: transparent; border: 0; border-radius: 8px; padding: 7px 10px; }
.menu button:hover { background: rgba(255,255,255,.08); }
.menu button.coche::before { content: "✓"; color: var(--ciel); width: 14px; }
.menu button:not(.coche)::before { content: ""; width: 14px; }
.menu hr { border: 0; border-top: 1px solid var(--ligne); margin: 5px 0; }

/* Panneau de côté */
#cote { min-height: 0; display: flex; flex-direction: column; background: var(--nuit-2); border-left: 1px solid var(--ligne); }
.onglets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 8px; border-bottom: 1px solid var(--ligne); }
.onglets button { padding: 6px 4px; font-size: 12px; }
.panneau-o { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; }
.panneau-o > label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; color: var(--doux); font-size: 13px; }
.panneau-o > label output { float: right; color: #fff; font-variant-numeric: tabular-nums; }
.panneau-o > label { display: grid; grid-template-columns: 1fr auto; }
.panneau-o > label > select, .panneau-o > label > input { grid-column: 1 / -1; width: 100%; }
.panneau-o > label.case { display: flex; flex-direction: row; align-items: center; gap: 8px; color: var(--texte); margin: 10px 0 0; }
.liste { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; counter-reset: n; }
.liste li { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; counter-increment: n; }
.liste li::before { content: counter(n); color: var(--doux); font-size: 11px; width: 18px; text-align: right; flex: none; }
.liste li:hover { background: var(--verre); }
.liste li.courant { background: rgba(47,107,255,.22); border-color: rgba(56,189,248,.5); }
.liste li .t { flex: 1; min-width: 0; }
.liste li .t b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; }
.liste li .t small { color: var(--doux); font-size: 11px; }
.liste li .x { padding: 2px 7px; font-size: 12px; opacity: .6; }
.liste li .x:hover { opacity: 1; }
.liste .vide { color: var(--doux); cursor: default; }
.liste .vide::before { content: none; }
/* Recherche */
.recherche { display: flex; gap: 6px; margin-bottom: 6px; }
.recherche input { flex: 1; min-width: 0; }
#sourceRecherche { width: 100%; }
.resultats { counter-reset: none; }
.resultats li.resultat { align-items: flex-start; padding: 6px; }
.resultats li.resultat::before { content: none; }
.resultat .vignette { position: relative; flex: none; width: 96px; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; background: var(--nuit-3) center/40% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M12 9v14l11-7z' fill='%2393a3d1'/%3E%3C/svg%3E"); }
.resultat .vignette img { width: 100%; height: 100%; object-fit: cover; display: block; }
.resultat .duree { position: absolute; right: 3px; bottom: 3px; background: rgba(0,0,0,.8); color: #fff; font-size: 10px; padding: 0 4px; border-radius: 3px; font-variant-numeric: tabular-nums; }
.liste li.resultat .t b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 13px; line-height: 1.3; }
.resultat .t small { display: block; }
.resultat .t b, .resultat .t small { overflow-wrap: anywhere; }
#o-chercher { overflow-x: hidden; }
.resultat .t .desc { opacity: .8; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.resultat .actions { display: flex; flex-direction: column; gap: 4px; flex: none; }
.resultat .actions button, .resultat .actions a { padding: 2px 7px; font-size: 13px; text-decoration: none; border: 1px solid var(--ligne); border-radius: 6px; text-align: center; color: var(--texte); }
.resultat.charge { opacity: .55; cursor: progress; }
.rond.petit { display: inline-block; width: 12px; height: 12px; border-width: 2px; vertical-align: -2px; }
.plus { width: 100%; margin-top: 8px; }
.eq { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 6px 0 12px; }
.eq label { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--doux); }
.eq input { writing-mode: vertical-lr; direction: rtl; height: 120px; width: 24px; }
.eq output { color: #fff; font-size: 11px; }
#infos { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0 0 12px; }
#infos dt { color: var(--doux); }
#infos dd { margin: 0; color: #fff; word-break: break-all; }
.encadre { margin-top: 14px; padding: 12px; border-radius: 10px; border: 1px solid rgba(246,199,68,.45); background: rgba(246,199,68,.07); }
.encadre b { color: var(--lis); }
.encadre p { margin: 6px 0 10px; }

/* Aide */
dialog { background: var(--nuit-2); color: var(--texte); border: 1px solid var(--ligne); border-radius: 14px; padding: 0; width: min(700px, 94vw); max-height: 88vh; }
dialog::backdrop { background: rgba(0,0,0,.6); }
.dh { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--ligne); font-weight: 600; color: #fff; }
.db { padding: 0 18px 18px; overflow-y: auto; }
.db p { margin: 0 0 6px; }
.raccourcis { border-collapse: collapse; width: 100%; font-size: 13px; }
.raccourcis td { padding: 4px 6px; border-bottom: 1px solid var(--ligne); }
.raccourcis td:nth-child(odd) { white-space: nowrap; }
.fermer { padding: 3px 9px; }

#depotPlein { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(7,13,36,.82); pointer-events: none; }
#depotPlein div { padding: 40px 60px; border: 3px dashed var(--ciel); border-radius: 22px; font-size: 22px; color: #fff; background: rgba(56,189,248,.1); }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--nuit-3); border: 1px solid var(--ligne); border-radius: 10px; padding: 10px 16px; box-shadow: 0 10px 40px rgba(0,0,0,.45); z-index: 40; max-width: 92vw; display: flex; gap: 10px; align-items: center; }

/* Plein écran : le cadre occupe tout */
#cadre:fullscreen { width: 100vw; height: 100vh; }

@media (max-width: 900px) {
  body { overflow: auto; height: auto; }
  html { height: auto; }
  #app { grid-template-columns: 1fr; }
  #scene { height: 56vw; min-height: 240px; max-height: 70vh; }
  #cote { border-left: 0; border-top: 1px solid var(--ligne); min-height: 50vh; }
  .marque, .retour, #btnFichiers span { display: none; }
  #volume { display: none; }
  #btnRecul, #btnAvance, #btnAB { display: none; }
}
