/* ===== Overlay + box ===== */
.rm-modal-overlay{
  position:fixed; inset:0; display:none; z-index:10050;
  background:rgba(15,23,42,.55);
  align-items:center; justify-content:center; padding:16px;
}
.rm-modal{
  position:relative; width:min(980px, 96vw); max-height:92vh;
  background:#fff; border-radius:14px; overflow:auto;
  box-shadow:0 18px 50px rgba(0,0,0,.30);
  margin-left: auto;
    margin-right: auto;
}
.rm-modal-close{
  position:absolute; top:10px; right:12px; border:0; background:transparent;
  font-size:28px; line-height:1; cursor:pointer; opacity:.7;
}
.rm-modal-close:hover{opacity:1;}
.rm-modal-content{ padding:16px; }

/* ===== Header (legacy) ===== */
.rm-header h3{ margin:0 0 10px; font-size:22px; }

/* ===== Loader / error ===== */
.rm-loading{ display:flex; align-items:center; justify-content:center; padding:40px; }
.rm-loading:after{
  content:""; width:28px; height:28px; border-radius:50%;
  border:3px solid #d1d5db; border-top-color:#111827; animation:spin 0.8s linear infinite;
}
@keyframes spin{ to{ transform:rotate(360deg);} }
.rm-error{ padding:16px; color:#a00; }

/* ===== Carousel (legacy) ===== */
.rm-carousel{ position:relative; overflow:hidden; border-radius:10px; }
.rm-track{ display:flex; transition:transform .35s ease; }
.rm-slide{ flex:0 0 100%; user-select:none; }
.rm-slide img{ width:100%; height:auto; display:block; }

.rm-nav{
  position:absolute; top:50%; transform:translateY(-50%);
  background:rgba(0,0,0,.4); color:#fff; border:0; width:38px; height:38px;
  border-radius:50%; cursor:pointer;
}
.rm-prev{ left:10px; } .rm-next{ right:10px; }

/* ===== Video (legacy) ===== */
.rm-video{ margin:14px 0; position:relative; padding-top:56.25%; }
.rm-video video{
  position:absolute; inset:0; width:100%; height:100%; border:0; border-radius:10px; background:#000;
}

/* ===== Testo + features (legacy) ===== */
.rm-desc{ margin:12px 0 6px; color:#333; }
.rm-desc .rm-short{ font-weight:600; }
.rm-features ul{ list-style:none; padding:0; margin:10px 0 0; columns:2; column-gap:24px; }
.rm-features li{ break-inside:avoid; margin:6px 0; color:#222; }
.rm-features i{ margin-right:8px; color:#444; }

@media (max-width:680px){
  .rm-features ul{ columns:1; }
}

/* ====== Stato loading & error (diagnostica) ====== */
.rm-loading{ padding:24px; text-align:center; font-size:16px; }
.rm-error{ background:#ffecec; border:1px solid #f5a5a5; color:#a11; padding:12px; border-radius:8px; }
.rm-error-url{ margin-top:6px; font-size:12px; overflow-wrap:anywhere; }
.rm-error-preview{ white-space:pre-wrap; margin-top:8px; max-height:220px; overflow:auto; background:#fff; padding:8px; border:1px dashed #f2caca; }

/* ====== Header & testo (compact) ====== */
.rm-head{ margin:4px 0 12px 0; }
.rm-title{ margin:0; font-size:22px; line-height:1.25; }
.rm-short{ margin:12px 0 0 0; }
.rm-long{ margin-top:10px; }

/* ====== Features (compact grid) ====== */
.rm-features{ list-style:none; padding:0; margin:14px 0 0 0; display:grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap:8px 12px; }
.rm-feature{ display:flex; align-items:flex-start; gap:8px; }
.rm-feature-ico{ width:20px; text-align:center; line-height:1.2; }
.rm-ico-fallback{ display:inline-block; width:1em; }

/* ====== Galleria (legacy) ====== */
.rm-gallery{ position:relative; margin:8px 0 12px 0; }
.rm-g-stage{ position:relative; width:100%; background:#111; border-radius:12px; overflow:hidden; }
.rm-g-slide{ width:100%; height:100%; }
.rm-g-img, .rm-g-video{ display:block; width:100%; height:auto; max-height:62vh; object-fit:cover; background:#000; outline:none; }
.rm-g-prev, .rm-g-next{
  position:absolute; top:50%; transform:translateY(-50%);
  border:0; background:rgba(0,0,0,.45); color:#fff; width:36px; height:36px;
  border-radius:999px; cursor:pointer; z-index:2; font-size:22px; line-height:36px; text-align:center;
}
.rm-g-prev{ left:8px; }
.rm-g-next{ right:8px; }
.rm-g-prev:hover,.rm-g-next:hover{ background:rgba(0,0,0,.65); }

/* Thumbs (legacy) */
.rm-g-thumbs{ display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.rm-g-thumb{ border:2px solid transparent; background:#f6f6f6; padding:0; border-radius:8px; cursor:pointer; width:70px; height:50px; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.rm-g-thumb img{ width:100%; height:100%; object-fit:cover; display:block; }
.rm-g-thumb.is-active{ border-color:#4f46e5; box-shadow:0 0 0 2px rgba(79,70,229,.15); }

/* ===================================================================== */
/* =====================  V2 – Nuovo layout galleria  =================== */
/* ===================================================================== */

/* Head nuova + sottotitolo */
.rm-subtitle { margin:0; opacity:.85; }

/* Corpo + colonne */
.rm-body { margin-top: 10px; }
.rm-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
@media (max-width: 980px){ .rm-cols { grid-template-columns: 1fr; } }

/* Colonna media (stage principale) */
.rm-col-media { min-width: 0; }
.rm-media { position: relative; border-radius: 12px; overflow: hidden; background: #000; }
.rm-media-main { aspect-ratio: 16 / 9; display: grid; place-items: center; }
.rm-media-main img.rm-photo,
.rm-media-main video.rm-video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Frecce galleria */
.rm-nav{ position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  background: rgba(0,0,0,.45); color:#fff; border:0; width:38px; height:38px;
  border-radius: 50%; cursor:pointer; font-size: 22px; line-height:38px; text-align:center; }
.rm-prev { left: 8px; } .rm-next { right: 8px; }
.rm-nav:hover { background: rgba(0,0,0,.65); }

/* Thumbs nuove */
.rm-thumbs { margin-top: 8px; display: flex; gap: 8px; overflow: auto; padding-bottom: 2px; }
.rm-thumb { border: 2px solid transparent; border-radius: 8px; padding:0; background:#fff; cursor:pointer; }
.rm-thumb img { display:block; width: 96px; height: 64px; object-fit: cover; border-radius: 6px; }
.rm-thumb-video { position: relative; background: #111; }
.rm-thumb-video img { opacity:.6; }
.rm-thumb-play { position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); color:#fff; font-size:18px; pointer-events:none;}
.rm-thumb.is-active { border-color: #0ea5e9; }

/* Colonna info */
.rm-col-info { font-size: 14px; line-height: 1.55; }
.rm-col-info .rm-desc { margin-bottom: 12px; }

/* Features nuove (lista <ul><li>…) */
.rm-features { list-style:none; padding:0; margin: 14px 0 0 0; display:grid; grid-template-columns: 1fr 1fr; gap:8px 14px; }
@media (max-width: 640px){ .rm-features { grid-template-columns: 1fr; } }
.rm-features li { display:flex; align-items:center; gap:8px; background:#f8fafc; padding:8px 10px; border-radius:10px; }
.rm-features i  { width:18px; text-align:center; opacity:.85; color:#334155; }
.rm-features span { font-weight:600; margin-right:4px; }

/* Fine V2 */
/* --- Thumbnails: wrap multi-riga senza deformazioni --- */
.rm-thumbs{
  display: flex;
  flex-wrap: wrap;         /* va su più righe */
  gap: 8px;                /* spazio tra thumb */
  padding: 8px 0;
  max-height: 140px;       /* se sono tante, compare lo scroll verticale */
  overflow-y: auto;
}

.rm-thumb{
  flex: 0 0 auto;          /* non allargare per riempire la riga */
  height: 64px;            /* altezza uniforme delle thumb */
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  position: relative;
  padding: 0;
}

.rm-thumb img{
  height: 100%;            /* riempi in altezza */
  width: auto;             /* mantieni proporzioni */
  display: block;
}

/* Stato attivo/hover più visibile */
.rm-thumb.is-active{ outline: 2px solid #111827; outline-offset: 0; }
.rm-thumb:hover{ border-color: #9ca3af; }

/* Thumb video: icona non copre l’immagine */
.rm-thumb-video .rm-thumb-play{
  position: absolute;
  inset: auto auto 6px 6px;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
}
