/* ═══════════════════════════════════════════════════════════
   CARROUSEL D'IMAGES / VIDÉOS  (annonces)
   Rendu par static/js/scribo-carousel.js à partir de la balise
   <scribo-carousel data-slides="…"> stockée dans le contenu.
   ═══════════════════════════════════════════════════════════ */

scribo-carousel {
  display: block;
  position: relative;
  margin: 26px 0;
}

/* Tant que le JS n'a rien construit, rien ne doit « sauter » à l'écran. */
scribo-carousel:not([data-ready]) { min-height: 0; }

.carousel-viewport {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #12100e;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
}
.carousel-viewport:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform .35s ease;
  will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
  .carousel-track { transition: none; }
}

.carousel-slide {
  flex: 0 0 100%;
  min-width: 100%;
  height: 100%;
  margin: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-media {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.carousel-slide img.carousel-media { cursor: zoom-in; }

.carousel-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 22px 16px 10px;
  font-family: var(--font-ui);
  font-size: .8rem;
  line-height: 1.4;
  color: #f4efe7;
  background: linear-gradient(to top, rgba(0, 0, 0, .78), rgba(0, 0, 0, 0));
  text-align: center;
  pointer-events: none;
}

/* ─ Flèches ─ */
.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(20, 18, 16, .55);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, opacity .15s;
  opacity: .75;
}
.carousel-nav:hover,
.carousel-nav:focus-visible { background: rgba(20, 18, 16, .85); opacity: 1; }
.carousel-nav--prev { left: 10px; }
.carousel-nav--next { right: 10px; }

/* ─ Pastilles + compteur ─ */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 10px;
}
.carousel-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.carousel-dot:hover { background: var(--text-muted); }
.carousel-dot.is-active { background: var(--accent); transform: scale(1.3); }

.carousel-counter {
  text-align: center;
  margin-top: 6px;
  font-family: var(--font-ui);
  font-size: .72rem;
  color: var(--text-muted);
}

/* ─ Bandeau d'édition (console de modération uniquement) ─ */
.carousel-editbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  margin-bottom: 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: rgba(139, 100, 60, .06);
  font-family: var(--font-ui);
  font-size: .78rem;
  color: var(--text-muted);
}
.carousel-edit-btn {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-mid);
  font-family: var(--font-ui);
  font-size: .75rem;
  padding: 4px 10px;
  cursor: pointer;
}
.carousel-edit-btn:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 640px) {
  .carousel-nav { width: 32px; height: 32px; font-size: 1.25rem; }
  .carousel-caption { font-size: .75rem; }
}

/* ═══════════════════════════════════════════════════════════
   FENÊTRE DE GESTION DES MÉDIAS  (éditeur d'annonces)
   ═══════════════════════════════════════════════════════════ */

.cslmodal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(12, 10, 9, .62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cslmodal {
  width: min(680px, 100%);
  max-height: min(86vh, 780px);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
  overflow: hidden;
}

.cslmodal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.cslmodal-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}
.cslmodal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 6px;
}
.cslmodal-close:hover { color: var(--text); }

.cslmodal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}

.cslmodal-drop {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 18px;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  text-align: center;
  font-family: var(--font-ui);
  transition: border-color .15s, background .15s;
}
.cslmodal-drop:hover,
.cslmodal-drop.is-over {
  border-color: var(--accent);
  background: rgba(139, 100, 60, .07);
}
.cslmodal-drop:disabled { opacity: .55; cursor: progress; }
.cslmodal-drop-main { font-size: .9rem; font-weight: 600; color: var(--accent); }
.cslmodal-drop-hint { font-size: .74rem; color: var(--text-muted); line-height: 1.4; }

.cslmodal-status {
  margin: 10px 0 0;
  min-height: 1.1em;
  font-family: var(--font-ui);
  font-size: .78rem;
  color: var(--text-muted);
}
.cslmodal-status.is-error { color: var(--danger, #c0392b); }

.cslmodal-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cslmodal-empty {
  margin: 14px 0 0;
  font-family: var(--font-ui);
  font-size: .8rem;
  font-style: italic;
  color: var(--text-muted);
  text-align: center;
}

.cslmodal-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.cslmodal-thumb {
  flex: 0 0 auto;
  width: 76px;
  height: 52px;
  border-radius: 6px;
  overflow: hidden;
  background: #17140f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
.cslmodal-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cslmodal-fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cslmodal-kind {
  font-family: var(--font-ui);
  font-size: .7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cslmodal-caption {
  width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: .82rem;
  box-sizing: border-box;
}
.cslmodal-caption:focus { outline: none; border-color: var(--accent); }

.cslmodal-actions { display: flex; gap: 4px; }
.cslmodal-action {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-mid);
  cursor: pointer;
  font-size: .85rem;
  line-height: 1;
}
.cslmodal-action:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.cslmodal-action:disabled { opacity: .3; cursor: default; }
.cslmodal-remove:hover:not(:disabled) {
  border-color: var(--danger, #c0392b);
  color: var(--danger, #c0392b);
}

.cslmodal-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-family: var(--font-ui);
  font-size: .82rem;
  color: var(--text-mid);
  cursor: pointer;
}
.cslmodal-option input { width: 16px; height: 16px; accent-color: var(--accent); }

.cslmodal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

@media (max-width: 560px) {
  .cslmodal-item { flex-wrap: wrap; }
  .cslmodal-fields { flex: 1 1 100%; order: 3; }
}
