/* =========================================================
   STZ Modal - Feuille de style
   Tout le look & feel se customise ici.
   ========================================================= */

/* ===== Overlay (fond) ===== */
.stz_modal_overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 9999;
}
.stz_modal_overlay.stz_modal_visible {
  opacity: 1;
}

/* Empêche le scroll de la page quand une modal est ouverte */
body.stz_modal_open {
  overflow: hidden;
}

/* ===== La modal (= point d'entrée de customisation) ===== */
.stz_modal {
  position: relative;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  max-width: 600px;          /* surchargé par l'option width */
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(15px);
  transition: transform 0.25s ease;
  font-family: system-ui, -apple-system, Arial, sans-serif;
}
.stz_modal_overlay.stz_modal_visible .stz_modal {
  transform: translateY(0);
}

/* Quand width/height sont fournis en option, on lève les bornes par défaut */
.stz_modal[style*="width"]  { max-width: none; }
.stz_modal[style*="height"] { max-height: none; }

/* ===== Bouton de fermeture (x) ===== */
.stz_modal_close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  color: #888;
  cursor: pointer;
  border-radius: 6px;
  z-index: 10;               /* toujours au-dessus du contenu */
  transition: background 0.15s, color 0.15s;
}
.stz_modal_close:hover {
  background: #f0f0f0;
  color: #222;
}

/* ===== Corps / contenu ===== */
.stz_modal_body {
  padding: 28px 24px 20px;
  color: #222;
  font-size: 15px;
  line-height: 1.5;
}

/* Customisation des éléments fréquents dans le contenu (mode normal) */
.stz_modal_body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 6px;
}
.stz_modal_body iframe {
  width: 100%;
  border: none;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
}

/* ===== Footer (zone des boutons) ===== */
.stz_modal_footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 24px 22px;
  border-top: 1px solid #eee;
}

/* ===== Boutons ===== */
.stz_btn {
  border: none;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  transition: filter 0.15s;
}
.stz_btn:hover {
  filter: brightness(0.92);
}

/* Couleurs par défaut (en ajouter d'autres ici facilement) */
.stz_btn_red    { background: #e74c3c; }
.stz_btn_orange { background: #e67e22; }
.stz_btn_green  { background: #27ae60; }
.stz_btn_blue   { background: #2980b9; }

/* Exemple d'ajout d'une couleur custom :
.stz_btn_purple { background: #8e44ad; } */


/* =========================================================
   MODE PLEIN CADRE : fill
   Le contenu (img / iframe) occupe toute la surface,
   sans marge, sans scroll, sans déformation.
   La croix passe par-dessus en z-index.
   ========================================================= */
.stz_modal_fill {
  padding: 0;
  overflow: hidden;          /* pas de scroll */
  background: #000;          /* fond neutre derrière l'image/vidéo */
  display: flex;
  flex-direction: column;
}

/* Le body prend toute la place disponible */
.stz_modal_fill .stz_modal_body {
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;             /* indispensable pour que le flex enfant se contraigne */
  display: flex;
  overflow: hidden;
}

/* Image : remplit la surface selon le type de fit demandé (option fill).
   Défaut 'contain' si la variable n'est pas définie. */
.stz_modal_fill .stz_modal_body img {
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  border-radius: 0;
  object-fit: var(--stz-fit, contain);
  display: block;
}

/* Iframe / vidéo : occupe toute la surface, sans scroll ni déformation */
.stz_modal_fill .stz_modal_body iframe {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;        /* on annule le ratio fixe du mode normal */
  border-radius: 0;
}

/* Croix plus visible quand elle flotte par-dessus une image/vidéo sombre */
.stz_modal_fill .stz_modal_close {
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
}
.stz_modal_fill .stz_modal_close:hover {
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
}

/* En mode fill, si des boutons sont présents, le footer reste collé en bas */
.stz_modal_fill .stz_modal_footer {
  flex: 0 0 auto;
  background: #fff;
}


/* ===== Responsive ===== */
@media (max-width: 480px) {
  .stz_modal_overlay { padding: 0; }
  .stz_modal {
    max-width: 100%;
    border-radius: 0;
    max-height: 100vh;
  }
  .stz_modal_footer {
    justify-content: stretch;
  }
  .stz_btn {
    flex: 1 1 auto;
  }
}
