/****** Lecteur audio ******/

#spk-bar {
  position: fixed;
  left: auto;
  bottom: 15px;
  z-index: 99999;
  transform: translateY(125%);
  transition: all 0.25s ease;
  font-size: 27px;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.35);
  padding: 20px;
  border-radius: 10px;
  color: var(--gris-attenue);
  background-color: var(--violet-clair);
  width: 1250px;
  max-width: 90%;
  transform-origin: bottom right; /* Important à garder */
  border: 1px solid grey !important;
}

#spk-bar.active {
  transform: translateY(0);
}

#spk-bar * {
  box-sizing: border-box;
}

.spk-row {
  display: grid;
  grid-template-columns: calc(50% - 112px) 200px calc(50% - 112px);
  gap: 12px;
  align-items: center;
}

/* Mode multi-langues : on élargit uniquement la colonne centrale */
#spk-bar.is-multilang .spk-row {
  grid-template-columns: calc(50% - 197px) 370px calc(50% - 197px);
}

.spk-media {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 40vw;
}

/* Mode multi-langues : on réduit la place du média pour laisser de l'espace au select */
#spk-bar.is-multilang .spk-media.with-btn-lang {
  max-width: 28vw;
}

.spk-cover {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  flex: 0 0 auto;
}

.spk-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.spk-title {
  text-align: left;
  font: 600 12px/16px "Montserrat", sans-serif;
  color: var(--blanc);
  white-space: normal;
  overflow-y: auto;
  overflow-x: hidden;
  text-overflow: ellipsis;
  width: 100%;
  max-height: 55px;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--rouge-clair) transparent;
}

.spk-title::-webkit-scrollbar {
  width: 4px;
}

.spk-title::-webkit-scrollbar-thumb {
  background: var(--rouge-clair);
  border-radius: 10px;
}

.spk-title::-webkit-scrollbar-track {
  background: transparent;
}

.spk-ctrls {
  display: flex;
  justify-content: center;
  gap: 8px;
  width: auto;
  align-items: center;
}

/* Sélecteur de langue dans le lecteur global */

.spk-lang-select-wrap {
  display: none;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  min-width: 145px;
  max-width: 160px;
}

.spk-lang-select-wrap.is-visible {
  display: flex;
}

.spk-lang-select-label {
  color: var(--blanc);
  font-family: "Montserrat", sans-serif;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.spk-lang-select {
  width: 100%;
  min-height: 30px;
  padding: 5px 28px 5px 10px;
  border: none;
  border-radius: 16px;
  background-color: var(--blanc);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--violet-clair) 50%),
    linear-gradient(135deg, var(--violet-clair) 50%, transparent 50%);
  background-position:
    calc(100% - 15px) 50%,
    calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--violet-clair);
  font-family: "Montserrat", sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.spk-lang-select:focus {
  outline: 2px solid var(--rouge-clair);
  outline-offset: 2px;
}

.spk-btn,
.spk-btn-return {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0;
  cursor: pointer;
  transition: filter 0.2s ease;
  flex-shrink: 0;
}

.spk-btn--play {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  color: var(--violet-clair);
  border: none;
  cursor: pointer;
}

.spk-btn--play.play {
  background-image: url("../../icons/play-rose.svg");
}

.spk-btn--play.pause {
  background-image: url("../../icons/pause-rose.svg");
}

.spk-btn:hover {
  filter: brightness(0.8);
}

.spk-btn-return {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 10px;
  font-size: 32px;
  color: var(--gris-attenue);
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 50%;
  transition: all ease 0.3s;
}

.spk-btn--back {
  background-image: url("../../icons/reculer.svg");
}

.spk-btn--back:hover {
  transform: rotate(-30deg);
}

.spk-btn--fwd {
  background-image: url("../../icons/avancer.svg");
}

.spk-btn--fwd:hover {
  transform: rotate(30deg);
}

.spk-btn-return:hover {
  filter: brightness(1.5);
}

.spk-progress-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.spk-progress {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  width: calc(100% - 120px);
}

.spk-time {
  font-size: 15px;
  color: var(--gris-attenue);
}

.spk-range {
  appearance: none;
  height: 6px;
  background: #3a394a;
  border-radius: 999px;
  outline: none;
}

.spk-range::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--rouge-clair);
  cursor: pointer;
}

.spk-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--rouge-clair);
  border: none;
  cursor: pointer;
}

.spk-close {
  width: 27px;
  height: 27px;
  border: none;
  border-radius: 10px;
  font-size: 32px;
  color: var(--gris-attenue);
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-image: url("../../icons/fermer.svg");
  background-size: cover;
  transition: all ease 0.3s;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.spk-close:hover,
.spk-view:hover {
  opacity: 0.8;
}

.spk-view {
  position: relative;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: var(--violet-clair);
  cursor: pointer;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.spk-view::before,
.spk-view::after{
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  background: url("../../icons/angle.svg") center/contain no-repeat;
}

/* Angle haut-gauche */

.spk-view::before {
  top: 8px;
  left: 8px;
  transform: rotate(270deg);
  transition: transform 0.3s ease;
}

/* Angle bas-droit */

.spk-view::after {
  bottom: 8px;
  right: 8px;
  transform: rotate(90deg);
  transition: transform 0.3s ease;
}

/* État hover : angles qui se referment */

.spk-view::before{
  transform: rotate(90deg);
  top: 5px;
  left: 7px;
}

.spk-view::after{
  transform: rotate(-90deg);
  bottom: 7px;
  right: 5px;
}

.small .spk-view::before {
  transform: rotate(-90deg);
  top: 8px;
  left: 8px;
}

.small .spk-view::after {
  transform: rotate(90deg);
  bottom: 10px;
  right: 9px;
}

.spk-iframe {
  display: none; /* Visible seulement si on charge le widget Spreaker */
}

/* Télécharger */

.spk-download {
  width: 27px;
  height: 27px;
  border: none;
  border-radius: 10px;
  font-size: 32px;
  color: var(--gris-attenue);
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-image: url("../../icons/telecharger.svg");
  background-size: cover;
  transition: all ease 0.3s;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.spk-download:hover {
  opacity: 0.8;
}

/* Boutons : précédent et suivant (avec texte) */

.spk-btn-prev,
.spk-btn-next {
  display: none;
  width: 14px;
  height: 20px;
  border: none;
  font-size: 32px;
  color: var(--gris-attenue);
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  opacity: 1;
  transition: opacity 0.2s ease;
  position: relative;
  overflow: visible;
  cursor: pointer;
}

.spk-btn-prev {
  background-image: url("../../icons/precedent-blanc.svg");
}

.spk-btn-next {
  background-image: url("../../icons/suivant-blanc.svg");
}

.spk-btn-prev:hover,
.spk-btn-next:hover {
  opacity: 0.8;
}

.spk-btn-prev:hover {
  background-image: url("../../icons/precedent-rose.svg");
}

.spk-btn-next:hover {
  background-image: url("../../icons/suivant-rose.svg");
}

.spk-btn-prev.active,
.spk-btn-next.active {
  display: inline-flex;
}

.spk-btn-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  font-size: 10px;
  line-height: 1;
  color: var(--rose-clair);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  text-transform: uppercase;
  transition: opacity 0.2s ease;
}

.spk-btn-prev .spk-btn-tooltip {
  right: 0;
  left: auto;
  transform: none;
  text-align: right;
}

.spk-btn-next .spk-btn-tooltip {
  left: 0;
  right: auto;
  transform: none;
  text-align: left;
}

.spk-btn-prev:hover .spk-btn-tooltip,
.spk-btn-next:hover .spk-btn-tooltip {
  opacity: 1;
}

/* Lecteur réduit */

#spk-bar.small{
  width: 295px;
}

#spk-bar .spk-progress,
#spk-bar .spk-title,
#spk-bar .spk-btn-return{
  transform: opacity ease 1s;
}

#spk-bar.small .spk-progress,
#spk-bar.small .spk-title,
#spk-bar.small .spk-btn-return{
  display: none!important;
  opacity: 0;
}

#spk-bar.small .spk-lang-select-wrap {
  display: none !important;
}

#spk-bar.small .spk-row{
  grid-template-columns: calc(50% - 65px) 85px calc(50% - 45px);
}

#spk-bar.small .spk-ctrls {
  gap: 0px;
}

#spk-bar.small .spk-nav-unique {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.spk-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-direction: column;
}

.spk-btn-lang {
  background: var(--blanc);
}

.spk-btn-lang svg g path{
  fill: var(--violet-clair);
}

.spk-btn-lang.active svg g path{
  fill: var(--blanc);
}

.spk-btn-lang:hover {
  background: var(--blanc);
  color: var(--violet-clair);
}

.spk-btn-lang.active {
  background: var(--rouge-clair);
  border-color: var(--rouge-clair);
}

.spk-btn-lang.active .lang-text{
  color: var(--blanc);
}

.spk-btn-lang.active .icone-svg-play,
.icone-svg-pause{
  display: none!important;
}

.spk-btn-lang.active .icone-svg-pause{
  display: flex!important;
}

@media (min-width: 1400px) {
  #spk-bar {
    right: calc((100vw - 1260px) / 2);
  }
}

@media (max-width: 1399px) {

  #spk-bar.active {
    /*left: 50%;
    transform: translate(-50%,0);*/
    left:inherit;
    right: 0;
    transform: translate(-30px, 0);
    max-width: calc(100% - 60px);
  }
}

@media (max-width: 1024px) {

  /* Lecteur audio */

  .spk-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-direction: row-reverse;
  }

  #spk-bar.is-multilang .spk-row {
    align-items: stretch;
  }

  /* Les deux blocs principaux restent sur la même ligne */
  .spk-media {
    flex: 1 1 auto;
    min-width: calc(100% - 100px);
    flex-direction: row-reverse;
  }

  .spk-media.with-btn-lang {
    min-width: calc(100% - 180px);
  }

  #spk-bar.is-multilang .spk-media.with-btn-lang {
    flex: 0 0 calc(50% - 4px);
    min-width: 0;
    max-width: calc(50% - 4px);
    min-height: 86px;
    align-self: stretch;
    align-items: center;
    overflow: hidden;
  }

  #spk-bar.is-multilang .spk-media.with-btn-lang .spk-title {
    max-height: 86px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
  }

  .spk-ctrls {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  #spk-bar.is-multilang .spk-ctrls {
    flex: 0 0 calc(50% - 4px);
    max-width: calc(50% - 4px);
    min-height: 86px;
    gap: 8px;
  }

  #spk-bar.is-multilang .spk-lang-select-wrap {
    min-width: 130px;
    max-width: 145px;
  }

  #spk-bar.is-multilang .spk-lang-select-label {
    font-size: 10px;
  }

  #spk-bar.is-multilang .spk-lang-select {
    min-height: 28px;
    padding: 4px 24px 4px 8px;
    font-size: 11px;
  }

  .spk-btn-return{
    display:none!important;
  }

  .spk-title{
    max-height: 55px;
  }

  .spk-btn-prev,
  .spk-btn-next {
    display:none!important;
  }

  /* La barre de progression passe dessous */
  .spk-progress-container {
    flex: 0 0 100%;
    order: 3; /* Forcer en dessous */
    margin-top: 10px;
  }

  .spk-title {
    max-width: unset;
  }
}

@media (max-width: 767px) {

  /* Lecteur audio */

  .spk-progress {
    max-width: 100vw;
  }

  .spk-title {
    max-height: 48px;
  }

  #spk-bar.is-multilang .spk-media.with-btn-lang,
  #spk-bar.is-multilang .spk-ctrls {
    min-height: 125px;
  }

  #spk-bar.is-multilang .spk-ctrls {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  #spk-bar.is-multilang .spk-media.with-btn-lang .spk-title {
    max-height: 125px;
  }
}

@media (max-width: 500px) {

  .spk-row .bouton-audio:hover {
    width: 100px;
  }

  .spk-row .bouton-audio:hover .line::after {
    opacity: 0;
  }

  .spk-cover {
    width: 100%;
    height: 100%;
    display: none;
  }

  #spk-bar.is-multilang .spk-media.with-btn-lang {
    flex: 0 0 calc(50% - 4px);
    min-width: 0;
    max-width: calc(50% - 4px);
  }

  #spk-bar.is-multilang .spk-ctrls {
    flex: 0 0 calc(50% - 4px);
    max-width: calc(50% - 4px);
  }

  #spk-bar.is-multilang .spk-lang-select-wrap {
    min-width: 110px;
    max-width: 120px;
  }

  #spk-bar.is-multilang .spk-lang-select-label {
    display: none;
  }

  #spk-bar.is-multilang .spk-lang-select {
    min-height: 27px;
    padding: 4px 20px 4px 8px;
    font-size: 11px;
  }

  #spk-bar.small {
    width: 190px;
  }

  #spk-bar.small .spk-media{
    display: none!important;
  }

  #spk-bar.small .spk-ctrls{
    width: 100%;
    gap: 0;
  }
}

/* Mini-bouton (optionnel) */

.spk-mini {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10000;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: var(--violet-clair);
  color: var(--blanc);
  font-weight: 900;
  font-size: 1rem;
  cursor: pointer;
  display: none;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
}

.spk-mini--pulse {
  animation: spkPulse 1.2s infinite;
}

.spk-mini img {
  width: 35px;
  height: 35px;
}

@keyframes spkPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}