/* ==========================================================================
 *  1. Variables
 *  ========================================================================== */
:root {
  /* Couleurs */
  --color-bg: #fff;
  --color-border: #000;
  --color-primary: #2196F3;
  --color-primary-light: #3d94f6;
  --color-highlight: #FECA40;
  --color-selected: #F39814;
  --color-item-bg: #ded;
  --color-item-hover: #73cdff;
  --color-title-bg: #eef;
  --color-text-inverse: #fff;

  /* Rayons */
  --radius-sm: 3px;
  --radius-md: 4px;
  --radius-lg: 5px;
  --radius-xl: 6px;

  /* Espacements */
  --gap-xs: max( 0.25vh, 0.25vw, 3px );
  --gap-sm: max( 0.33vh, 0.33vw, 5px );
  --gap-md: max( 0.67vh, 0.67vw, 10px );

  /* Typographie */
  --fs-base: max( 1.5vh, 1.5vw, 15px );
  --fs-lg: max( 2vh, 2vw, 15px );

  /* Aperçus : la vignette est carrée, l'image occupe 15 / 21 de la hauteur */
  --preview-total: max( 21vh, 21vw, 210px );
  --preview-total-w: var(--preview-total);
  --preview-total-h: var(--preview-total);
  --preview-w: var(--preview-total);
  --preview-h: max( 15vh, 15vw, 150px );
  --preview-label-h: calc( var(--preview-total-h) - var(--preview-h) );
}

/* ==========================================================================
 *  2. Reset / base
 *  ========================================================================== */
* {
  padding: 0;
  margin: 0;
  font-size: var(--fs-base);
}

h1 {
  width: 500px;
  padding: 30px;
  text-decoration: underline;
}

li,
ul {
  margin: var(--gap-md);
}

input[type="number"] {
  width: 50px;
}

.btn {
  height: fit-content;
  width: auto ;
  font-size: var(--fs-base);   /* nécessaire : surcharge le font-size de .btn du framework */
  line-height: max( 1.75vh, 1.75vw, 15px );
}

.invisible {
  display: none;
}

.warn {
  font-weight: bold;
}

.method {
  visibility: hidden;
  font-style: italic;
}

/* ==========================================================================
 *  3. Animation de la barre de progression
 *  ========================================================================== */
.percent.animating,
.percent.vidage {
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

.percent.animating { animation-name: remplir; }  /* 0% → 100% */
.percent.vidage    { animation-name: vider; }    /* 100% → 0% */

@keyframes remplir {
  from { width: 0%; }
  to   { width: 100%; }
}

@keyframes vider {
  from { width: 100%; }
  to   { width: 0%; }
}

/* ==========================================================================
 *  4. Diaporama plein écran
 *  ========================================================================== */
#slideshow,
#count-down {
  width: 100vw;
  text-align: center;
}

#slideshow div.slide {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.slide-content {
  flex-grow: 1;
  border: 0;
}

.slide-head {
  display: flex;
  align-items: start;
  gap: var(--gap-md);
  height: fit-content;
  padding: var(--gap-md);
  color: var(--color-text-inverse);
}

.slide-head .slide-no {
  height: fit-content;
  padding: var(--gap-sm);
  font-size: max( 3vh, 3vw, 12px );
  border-radius: 4px ;
}

.slide-head .slide-code {
  height: fit-content;
  padding: var(--gap-xs);
  font-size: max( 1vh, 1vw, 8px );
}

/* Écrans de début et de fin */
#slide-start {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-content: center;
  height: 100vh;
}

#slide-start h1 {
  width: 100%;
}

#slide-start .title {
  display: inline-block;
  height: fit-content;
  margin: 100px auto 20px;
  padding: 20px;
  font-size: 250%;
  line-height: max( 4vh, 4vw, 30px );
  border-radius: 4px;
}

#slide-0 ul li {
font-size: 200%;
}

#slide-end,#slide-ready {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#slide-end::before,#slide-ready::before{
  content:'';
  position:absolute;
  top:0;left:0;
  width:100% ;
  height:100% ;
  background-image: url(fond-math.jpg);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  opacity:0.5 ;
}

#slideshow-instructions {
font-size: var(--fs-lg);
}

/* Boutons de début / de correction et affichage du temps */
#slideshow-start,
#correction-start,
.time {
  width: auto;
  height: auto;
  padding: max( 0.5vh, 0.5vw, 3.5px );
}

#slideshow-start,
#correction-start {
  font-size: var(--fs-lg);
  border-radius: 4px;
}

.time {
  font-size: var(--fs-lg);
  border-radius: 4px;
}

/* Compte à rebours */
#count-down {
  box-sizing: border-box;
  position: fixed;
  bottom: 0;
  height: 90px;
}

.total {
  position: absolute;
  bottom: 0px;
  width: 100%;
  height: 10px;
  background-color: var(--color-primary-light);
  border-radius: 4px;
}

.percent {
  position: absolute;
  top: 0;
  width: 0;
  height: 100%;
  background-color: var(--color-bg);
}

/* ==========================================================================
 *  5. Boutons d'interface (index, menu)
 *  ========================================================================== */
.index,
.menu {
  position: fixed;
}

.index {
  top: 20px;
  left: 20px;
  padding: 15px;
  border: none;
  border-radius: var(--radius-sm);
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
  font-family: Arial, sans-serif;
  font-size: var(--fs-lg);
  font-weight: 700;
  box-shadow:
  0 2px 2px 0 rgba(0, 0, 0, 0.14),
  0 3px 1px -2px rgba(0, 0, 0, 0.12),
  0 1px 5px 0 rgba(0, 0, 0, 0.2);
}

.menu {
  top: 17px;
  right: 14px;
  z-index: 2;
}

.menu button:hover {
  background-color: var(--color-primary-light);
}

.menu .btn-floating {
  width: 80px;
  height: 80px;
}

.menu .btn-floating i {
  font-size: 4rem;
  line-height: 80px;
}

/* ==========================================================================
 *  6. Menu global et listes en "collection"
 *  ========================================================================== */
#global-menu,
.collection {
  width: fit-content;
}

.collection .collection-item {
  width: 100%;
}

.collection .collection-item a {
  width: 100%;
  padding: max( 0.333vh, 0.333vw, 3px );
}

#slideshows-menu h1,
#slideshows-list h1 {
  margin-left:var(--gap-xs) ;
  padding: max( 0.333vh, 0.333vw, 3px );
  border-radius: 4px ;
}

/* Bandeau latéral */
ul.slideshow.collection li.slide.collection-item {
  height: 22.5px;
  max-height: 22.5px;
  padding: 0;
  overflow: visible;
}

ul.slideshow.collection li.slide.collection-item:hover {
  background-color: var(--color-item-hover);
}

ul.slideshow.collection li.slide.collection-item.active {
  background-color: var(--color-primary);
}

/* ==========================================================================
 *  7. Dialogue de configuration
 *  ========================================================================== */
#slide-dialog {
  box-sizing: border-box;
  position: fixed;
  top: 10vh;
  left: 10vw;
  z-index: 2;
  width: 80vw;
  height: 80vh;
  padding: 20px;
  overflow: auto;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

#modal-background {
  position: fixed;
  inset: 0;
  background-color: var(--color-border);
  opacity: 0.2;
}

.edit-toolbar {
  box-sizing: border-box;
  position: absolute;
  right: 20px;
  display: inline-block;
  width: 200px;
  text-align: right;
}

#slideshow-cancel,
#slideshow-name,
#slideshow-ok {
  box-sizing: border-box;
  width: 180px;
}

/* ==========================================================================
 *  8. Liste des diaporamas (accueil)
 *  ========================================================================== */
#slideshows-list .slideshow-delete {
  position: absolute ;
  bottom : 5px ;
  right : 5px ;

}
#slideshows-list .slideshow-delete i.material-icons {
  font-size: 2rem ;
}
#slideshows-list .collection-item a {
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
  height: 100%;
  padding: 0;
  font-size: 14px;
}

.slideshows h3 {
  margin: var(--gap-sm);
}

/* Liste des diapositives (numérotées) */
#slides-list {
  counter-reset: diapos;
  list-style-type: none;
  width: calc( 80vw - 220px );
  margin: 0;
}

#slides-list li {
  counter-increment: diapos;
  float: left;
  width: 220px;
  height: 220px;
  margin: var(--gap-xs);
  padding: 0.4em;
  font-size: 1.4em;
  border-radius: var(--radius-lg);
}

#slides-list li span {
  float: left;
  margin-top: -8px;
}

#slides-list span.counter {
  margin-top: -10px;
}

#slides-list span.counter::before {
  content: counter(diapos);
}

#slides-list img {
  width: var(--preview-w);
  max-width: 180px;
  max-height: 125px;
  text-align: center;
  overflow: hidden;
}

.delete {
  float: right;
  margin-top: -3px;
  color: var(--color-text-inverse);
}

/* ==========================================================================
 *  9. Composant "diaporama"
 *  ========================================================================== */
div.slideshow {
  display: inline-block;
  width: 418px;
  height: 196px;
  margin: var(--gap-xs);
  padding: var(--gap-xs);
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-xl);
}

div.slideshow h3 {
  box-sizing: border-box;
  padding: 4px;
  overflow: hidden;
  background-color: var(--color-title-bg);
  font-size: 14px;
}

div.slideshow img {
  max-width: 200px;
}

/* Liste interne d'un diaporama */
ul.slideshow {
  list-style-type: none;
  width: 200px;
  margin: 0;
}

ul.slideshow li {
  margin: var(--gap-xs);
  padding: var(--gap-xs);
  background-color: var(--color-item-bg);
  font-size: 11px;
  border-radius: var(--radius-md);
}

ul.slideshow .ui-selecting {
  background: var(--color-highlight);
}

ul.slideshow .ui-selected {
  background: var(--color-selected);
  color: var(--color-text-inverse);
}

li.slide {
  cursor: pointer;
}

li.slide img {
  display: none;
  position: relative;
  right: -195px;
  z-index: 5;
  padding: var(--gap-sm);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

li.slide:hover img {
  display: inline-block;
}

/* ==========================================================================
 *  10. Aperçus (vignettes)
 *  ========================================================================== */
.overview {
  display: inline-block;
  width: var(--preview-total-w);
  height: var(--preview-total-h);
  margin: var(--gap-sm);
  padding: var(--gap-sm);
  text-align: center;
  line-height: max( 1.5vh, 1.5vw, 16px );
  position: relative ;
  border-radius: 4px;
}

.overview .image,
.overview .label {
  text-align: center;
  overflow: hidden;
}

.overview .image {
  display: flex;
  justify-content: center;
  background-color: var(--color-bg);
}

.overview .image img {
  align-self: center;
  width: calc( var(--preview-w) - 2 * var(--gap-sm) );
  max-width: calc( var(--preview-w) - 2 * var(--gap-sm) );
  height: var(--preview-h);
  max-height: var(--preview-h);
  object-fit: contain;
}

.overview .label {
  flex-grow: 1;
}

.overview a {
  color: var(--color-text-inverse);
}

/* ==========================================================================
 *  11. Divers : info, durée
 *  ========================================================================== */
.info {
  display: inline-block;
  text-align: left;
  width: fit-content ;
  max-width: 60vw ;
}

.duree {
  position: absolute;
  bottom: 0.4em;
  width: 100%;
  text-align: left;
}

.duree label {
  display: block;
  float: left;
  width: 60px;
  line-height: 20px;
  color: var(--color-text-inverse);
}

.duree input[type="number"] {
  display: block;
  width: 120px;
  height: 20px;
  margin: 0;
  color: var(--color-text-inverse);
}

ul:is(.check-list, .arrow-list) {
  list-style: none; /* Supprime les puces par défaut */
  padding-left: 0;  /* Optionnel : enlève le retrait par défaut */
}

ul:is(.check-list, .arrow-list) li {
  padding-left: 1.75em;   /* retrait pour toutes les lignes */
  text-indent: -1.75em;   /* annule le retrait sur la 1ʳᵉ ligne */
}

ul:is(.check-list, .arrow-list) li::before {
  font-family: 'Material Icons';
  margin-right: 8px;       /* Espace entre l'icône et le texte */
  vertical-align: middle;  /* Aligne l'icône avec le texte */
  font-size:1.25em ;
}

ul.check-list li::before {
  content: 'check';
}
ul.arrow-list li::before {
  content: 'label_important';
}

