/*
 * vrp-explorer.css - Livrea del widget esploratore condiviso (vrp_explorer).
 *
 * Namespace unico ".vx-" (VittExplorer). Tutto scoped sotto .vx-shell, cosi' due
 * esploratori diversi sulla stessa pagina non si pestano. La palette e' in
 * variabili: un servizio la puo' ritingere ridefinendo le --vx-* sul suo .vx-shell
 * (es. lo share piu' chiaro, il VRV col suo tema) senza toccare questo file.
 *
 * Default: tema scuro (ereditato dal gestore_foto, il modello). Una responsabilita'
 * per blocco: guscio, toolbar, albero, griglia, selezione, lightbox, toast.
 */

.vx-shell {
  /* Pannelli TRASLUCIDI: lo sfondo (la foto del servizio, configurata nel JSON)
     traspare. NIENTE backdrop-filter blur: la foto resta NITIDA (regola di casa).
     La leggibilita' la da' il velo scuro + il testo chiaro, non la sfocatura.
     Un servizio puo' ritingere ridefinendo queste --vx-* sul suo .vx-shell. */
  /* ⚠️ I VALORI NON STANNO PIU' QUI (12/09/2026). Li da' `vrp-livrea.css`, la
     paletta unica di casa: questo blocco non fa che presentarla all'esploratore
     coi nomi che lui gia' usa. I ripieghi dopo la virgola valgono solo se la
     livrea non e' stata caricata, e tengono in piedi il widget da solo.
     Un servizio puo' ancora ritingere le --vx-* sul suo .vx-shell: la
     possibilita' resta, semplicemente adesso nessuno ne ha bisogno. */
  --vx-bg:      var(--vrp-liv2,  rgba(36, 20, 22, .55));   /* velo: la foto si vede sotto */
  --vx-panel:   var(--vrp-panel-a, rgba(46, 22, 25, .82)); /* toolbar: piu' opaca */
  --vx-panel2:  var(--vrp-panel2, #432126);                /* fondo bottoni */
  --vx-tree-bg: var(--vrp-liv1,  rgba(58, 28, 32, .78));   /* colonna albero */
  --vx-tile-bg: var(--vrp-liv3,  rgba(78, 38, 43, .78));   /* mattonella */
  --vx-txt:     var(--vrp-txt,   #f2e7e6);
  --vx-mut:     var(--vrp-mut,   #c6a3a4);
  --vx-accent:  var(--vrp-accent, #e0a458);
  --vx-gold:    var(--vrp-gold,  #eccb8c);
  --vx-danger:  var(--vrp-err,   #ff7a68);
  --vx-line:    var(--vrp-line,  rgba(255, 224, 224, .12));

  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--vx-bg);
  color: var(--vx-txt);
  font: 14px/1.4 system-ui, "Segoe UI", Roboto, sans-serif;
}
.vx-shell * { box-sizing: border-box; }

/* ---- toolbar (briciole + bottoni azione) ---- */
.vx-toolbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  /* spazio riservato a destra per il bottone "Esci" della piattaforma (fixed,
     top-destra): cosi' i bottoni-azione non gli finiscono sotto. */
  padding: 8px 100px 8px 12px;
  background: var(--vx-panel); border-bottom: 1px solid #000;
}
.vx-crumb { color: var(--vx-mut); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.vx-crumb a { color: var(--vx-accent); text-decoration: none; cursor: pointer; }
.vx-crumb a:hover { text-decoration: underline; }
.vx-crumb .vx-sep { color: var(--vx-mut); opacity: .6; }
.vx-crumb b { color: var(--vx-txt); }
.vx-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }
/* conteggio cartella aperta (CR-012): pillola discreta accanto alle briciole */
.vx-gridcount {
  color: var(--vx-txt); opacity: .8; font-size: 13px; white-space: nowrap;
  background: var(--vx-panel2); border-radius: 999px; padding: 3px 10px; user-select: none;
}
.vx-gridcount:empty { display: none; }

.vx-btn {
  background: var(--vx-panel2); color: var(--vx-txt);
  border: 1px solid var(--vx-line); border-radius: 6px;
  padding: 6px 12px; cursor: pointer; font-size: 13px;
}
.vx-btn:hover { background: var(--vrp-panel3); }
.vx-btn.vx-go { background: var(--vx-accent); border-color: #155fa0; }
.vx-btn.vx-danger { background: var(--vrp-err-bg); border-color: var(--vrp-err-line); color: var(--vrp-err); }
.vx-btn.vx-danger:hover { filter: brightness(1.3); }
.vx-btn:focus-visible { outline: 2px solid var(--vx-gold); outline-offset: 2px; }

/* ---- corpo: albero | griglia ---- */
.vx-layout { flex: 1; display: grid; grid-template-columns: 320px 1fr; min-height: 0; }
.vx-tree { border-right: 1px solid var(--vx-line); background: var(--vx-tree-bg); overflow: auto; padding: 8px 4px; }
.vx-grid { overflow: auto; padding: 10px 12px 30px; }
.vx-grid:focus { outline: none; }   /* la posizione la mostra la mattonella attiva (.vx-kb), non il contorno */

/* ---- albero ---- */
.vx-treeroot, .vx-tree ul { list-style: none; margin: 0; padding: 0; }
.vx-tree ul { margin-left: 14px; }
.vx-node {
  display: flex; align-items: center; gap: 2px;
  border-radius: 6px; padding: 2px 4px; white-space: nowrap;
}
.vx-node:hover { background: var(--vx-panel2); }
.vx-node.vx-active { background: var(--vx-tile-bg); }
.vx-node .vx-exp { width: 16px; text-align: center; cursor: pointer; color: var(--vx-mut); user-select: none; }
.vx-node .vx-lbl { cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.vx-node .vx-lbl::before { content: "\1F4C1"; margin-right: 5px; }
.vx-node.vx-active .vx-lbl { font-weight: 700; }

/* modo "scegli destinazione": l'albero si accende e il cursore diventa copia */
.vx-shell.vx-dest-mode .vx-tree { outline: 2px dashed var(--vx-gold); outline-offset: -2px; }
.vx-shell.vx-dest-mode .vx-node .vx-lbl { cursor: copy; }

/* ---- griglia miniature ---- */
.vx-grid-inner { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
/* riga di separazione quando cambia il prefisso (ui.blocchi, 17/10/2026): come la pagina delle scansioni */
.vx-blocco { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin-top: 6px;
             color: var(--vx-gold); font-weight: bold; font-size: 14px; }
.vx-blocco::after { content: ''; flex: 1; border-top: 1px solid var(--vx-line); }
.vx-blocco:first-child { margin-top: 0; }
.vx-blocco-tit { flex: none; white-space: nowrap; }
.vx-blocco-nota { font-weight: normal; color: var(--vx-txt); }
.vx-blocco-nota::before { content: '\2014  '; color: var(--vx-mut); }
.vx-blocco::after { order: 2; }
.vx-blocco-ed { order: 1; background: none; border: 0; color: var(--vx-gold); opacity: .75; cursor: pointer; font-size: 16px; padding: 0 2px; }
.vx-blocco-ed:hover { opacity: 1; }
.vx-tile {
  position: relative; background: var(--vx-tile-bg);
  border: 2px solid transparent; border-radius: 8px; overflow: hidden;
}
.vx-tile img { display: block; width: 100%; height: 120px; object-fit: cover; background: var(--vrp-bg, #241416); }
.vx-tile img.vx-broken { object-fit: contain; opacity: .5; }
/* 01/11/2026: la LOCANDINA intera (2:3) e la SCENA di una puntata (16:9) */
.vx-tile.vx-poster img { height: auto; aspect-ratio: 2 / 3; }
.vx-tile.vx-scena img { height: auto; aspect-ratio: 16 / 9; }
.vx-tile .vx-cap {
  font-size: 11px; color: var(--vx-mut); padding: 3px 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vx-tile .vx-cap .vx-sub { color: var(--vx-mut); opacity: .8; }
.vx-tile .vx-nota { font-size: 11px; color: var(--vx-gold); padding: 0 6px 4px; margin-top: -2px;
                    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* mattonella-cartella + glifo per i file non-immagine */
.vx-fileico {
  display: flex; align-items: center; justify-content: center;
  height: 120px; font-size: 40px; background: var(--vrp-bg, #241416); user-select: none;
}
.vx-tiledir { cursor: pointer; }
.vx-tiledir:hover { border-color: var(--vx-accent); }
/* cartella: glifo oro su velo traslucido (lo sfondo traspare), un filo piu' scuro
   delle mattonelle-foto cosi' le cartelle si distinguono. NIENTE nero pieno. */
.vx-tiledir .vx-fileico { color: var(--vx-gold); background: rgba(20, 23, 29, .72); }

/* badge (es. ▶ sui video) in basso a sinistra */
.vx-tile .vx-badge {
  position: absolute; left: 6px; bottom: 26px; z-index: 2;
  background: rgba(0,0,0,.6); color: #fff; border-radius: 6px;
  padding: 0 6px; font-size: 13px; line-height: 20px;
}
/* casella di multi-selezione, angolo alto-sinistra */
.vx-tile .vx-chk {
  position: absolute; top: 6px; left: 6px; z-index: 3;
  width: 18px; height: 18px; cursor: pointer; accent-color: var(--vx-accent);
}
.vx-tile .vx-zoom {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; line-height: 22px;
  text-align: center; background: rgba(0,0,0,.55); color: #fff; border: none;
  border-radius: 6px; cursor: pointer; font-size: 14px; opacity: 0; transition: opacity .1s;
}
.vx-tile:hover .vx-zoom { opacity: 1; }
/* il «?» della scheda (01/11/2026): alto a destra, sempre visibile */
.vx-tile .vx-info {
  position: absolute; top: 6px; right: 6px; z-index: 3; width: 30px; height: 30px; line-height: 28px;
  text-align: center; background: rgba(0,0,0,.65); color: #fff; border: 2px solid rgba(255,255,255,.85);
  border-radius: 50%; cursor: pointer; font-size: 17px; font-weight: 700; padding: 0;
}
.vx-tile .vx-info:hover { background: var(--vx-accent); }

/* selezione multipla */
.vx-tile.vx-sel { border-color: var(--vx-accent); box-shadow: 0 0 0 3px var(--vx-accent) inset; }
.vx-tile.vx-sel::after {
  content: "\2713"; position: absolute; right: 5px; bottom: 24px;
  width: 22px; height: 22px; line-height: 22px; text-align: center;
  background: var(--vx-accent); color: #fff; border-radius: 50%;
  font-size: 13px; z-index: 3; box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
/* tile "attiva" da tastiera */
.vx-tile.vx-kb { border-color: var(--vx-gold); box-shadow: 0 0 0 3px var(--vx-gold); }
/* modo scelta-foto (picker): gia' inserita nel post */
.vx-tile.vx-picked { outline: 3px solid var(--vx-accent); outline-offset: -3px; }

.vx-empty { color: var(--vx-mut); padding: 40px; text-align: center; }
.vx-subnote { color: var(--vx-mut); margin: 0 0 10px; font-size: 13px; }

/* ---- lightbox ---- */
.vx-lightbox {
  /* z-index sopra il bottone "Esci" della piattaforma (fixed, z-index 9999): mentre
     guardi la foto il visore lo copre, cosi' la X non ci finisce sotto. */
  /* il VISORE resta NERO, e non e' una dimenticanza: una foto si guarda sul
     nero, non sulla livrea di casa. Qui la livrea non entra. */
  position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,.88);
  display: flex; align-items: center; justify-content: center;
}
.vx-lightbox[hidden] { display: none; }
.vx-lightbox .vx-lb-img { max-width: 95vw; max-height: 92vh; border-radius: 6px; box-shadow: 0 6px 30px #000; }
.vx-lb-close {
  position: absolute; top: 14px; right: 20px; width: 42px; height: 42px; line-height: 40px;
  text-align: center; font-size: 24px; color: #fff; background: rgba(255,255,255,.12);
  border: none; border-radius: 50%; cursor: pointer;
}
.vx-lb-close:hover { background: rgba(255,255,255,.25); }
.vx-lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 54px; height: 84px; z-index: 61; border: none;
  background: rgba(255,255,255,.10); color: #fff; font-size: 34px; cursor: pointer;
  border-radius: 10px; user-select: none;
}
.vx-lb-nav:hover { background: rgba(255,255,255,.22); }
.vx-lb-prev { left: 18px; }
.vx-lb-next { right: 18px; }
/* barra sotto la foto: contatore + Seleziona + bottoni-azione del servizio.
   Pillola scura sopra la foto (niente blur), sempre leggibile. */
.vx-lb-bar {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; z-index: 62;
  background: rgba(0,0,0,.55); padding: 8px 14px; border-radius: 999px;
}
.vx-lb-count { color: #ddd; font-size: 14px; min-width: 64px; text-align: center; user-select: none; }
.vx-lb-selcount { color: var(--vrp-ok, #5fbf72); font-size: 14px; user-select: none; }   /* verde chiaro: eco della spunta */
.vx-selcount { color: var(--vx-txt); font-size: 13px; opacity: .85; user-select: none; }
/* vuoti = spariti del tutto (niente buco nel flex-gap) */
.vx-lb-selcount:empty, .vx-selcount:empty { display: none; }
.vx-lb-sel, .vx-lb-act {
  border: none; border-radius: 999px; padding: 8px 16px; font-size: 15px;
  color: #fff; background: rgba(255,255,255,.14); cursor: pointer; user-select: none;
}
.vx-lb-sel:hover, .vx-lb-act:hover { background: rgba(255,255,255,.28); }
.vx-lb-sel.vx-on { background: var(--vrp-ok, #5fbf72); }   /* selezionata: verde come il toast */
.vx-lb-sel.vx-on:hover { filter: brightness(.9); }

/* ---- toast ---- */
.vx-toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--vrp-ok, #5fbf72); color: var(--vrp-accent-txt, #2a1418); padding: 10px 18px; border-radius: 8px;
  opacity: 0; transition: opacity .2s; z-index: 70; pointer-events: none;
}
.vx-toast.vx-err { background: var(--vx-danger); }
.vx-toast.vx-show { opacity: 1; }

/* barra "scegli destinazione" (sposta): sempre un'uscita (Annulla / Esc) */
.vx-destbar {
  position: fixed; left: 50%; transform: translateX(-50%); top: 12px; z-index: 10070;
  display: flex; align-items: center; gap: 14px; max-width: 92vw;
  background: var(--vrp-panel2, #432126); color: var(--vrp-txt, #f2e7e6); border: 1px solid var(--vrp-line-strong);
  border-radius: 10px; padding: 8px 10px 8px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5); font: 500 14px/1.25 system-ui, sans-serif;
}
.vx-destbar-cancel {
  border: 0; background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer;
  border-radius: 7px; padding: 7px 13px; font: 600 13px/1 system-ui, sans-serif; white-space: nowrap;
}
.vx-destbar-cancel:hover { background: var(--vrp-err-bg); }

@media (max-width: 640px) {
  .vx-layout { grid-template-columns: 1fr; }
  .vx-tree { max-height: 220px; }
}

/* ---- Pannello sovrapposto + CESTINO comune (08/10/2026) ----
 * Prima stavano nel wizard (.vrw-panel, .vrw-bin-*): ora il cestino e' uno
 * solo per tutti i servizi (share, wizard...) e veste la livrea. NIENTE blur
 * (regola di casa: le foto sotto restano nitide). */
.vx-panel-back {
  position: fixed; inset: 0; z-index: 10050;
  background: var(--vrp-velo, rgba(8, 10, 14, .55));
  display: flex; align-items: center; justify-content: center;
  padding: 4vh 3vw;
}
.vx-panel {
  width: min(920px, 96vw); max-height: 92vh;
  display: flex; flex-direction: column;
  background: var(--vrp-panel, rgba(46, 22, 25, .96)); color: var(--vx-txt);
  border: 1px solid var(--vx-line); border-radius: 10px; box-shadow: 0 18px 60px rgba(0, 0, 0, .5);
}
.vx-panel-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--vx-line);
}
.vx-panel-head b { font-size: 16px; }
.vx-panel-x {
  margin-left: auto; background: transparent; border: 0; color: var(--vx-mut);
  font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.vx-panel-x:hover { color: var(--vx-txt); }
.vx-panel-body { padding: 12px 14px; overflow: auto; }
.vx-panel-empty {
  background: var(--vrp-err-bg); border: 1px solid var(--vrp-err-line); color: var(--vrp-err);
  border-radius: 6px; padding: 5px 12px; cursor: pointer; font-size: 13px;
}
.vx-panel-empty:disabled { opacity: .45; cursor: default; }
.vx-bin-empty { color: var(--vx-mut); padding: 24px 6px; text-align: center; }
.vx-bin-row { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--vx-line); }
.vx-bin-thumb {
  width: 72px; height: 72px; flex: 0 0 72px;
  display: flex; align-items: center; justify-content: center;
  background: var(--vx-tile-bg); border-radius: 6px; font-size: 30px; overflow: hidden;
}
.vx-bin-thumb img { width: 100%; height: 100%; object-fit: cover; }
.vx-bin-info { flex: 1; min-width: 0; }
.vx-bin-name { font-weight: 600; word-break: break-word; }
.vx-bin-path { color: var(--vx-mut); font-size: 12px; word-break: break-all; }
.vx-bin-date { color: var(--vx-mut); font-size: 11.5px; margin-top: 2px; }
.vx-bin-restore {
  flex: 0 0 auto; background: var(--vrp-ok-bg); border: 1px solid var(--vrp-ok-line); color: var(--vrp-ok);
  border-radius: 6px; padding: 6px 14px; cursor: pointer; font-size: 13px;
}
.vx-bin-restore:disabled { opacity: .5; cursor: default; }

/* ---- finestra bloccata: <html class="vx-finestra"> (19/10/2026) ----
   La pagina sta ferma all'altezza dello schermo; albero e griglia scorrono
   ognuno nel suo riquadro. --vx-alto lo misura vrp-explorer.js (finestraAlta):
   serve al Safari vecchio, dove il flex da solo non stringe la griglia. */
html.vx-finestra, html.vx-finestra body { height: 100%; margin: 0; }
html.vx-finestra body { display: flex; flex-direction: column; }
html.vx-finestra .vx-shell { flex: 1 1 auto; min-height: 0; }
@media (min-width: 641px) {
  html.vx-finestra, html.vx-finestra body { overflow: hidden; }
  html.vx-finestra .vx-tree, html.vx-finestra .vx-grid { height: var(--vx-alto, auto); }
}
