/**
 * Reset
 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/**
 * Eléments génériques
 */

body {
  --color-primary: #f76c5e;
  --color-secondary: #f68e5f;
  --elements-text-color: var(--color-secondary);
  --overbrillant-bg: var(--color-secondary);
  --color-tertiary: #ffeee6;
  --elements-bg-color: white;
  --bg-color: white;

  --footer-bg: var(--color-secondary);
  --footer-text-color: white;
  --switcher-bg: #666666;
  --popup-input-color: #666666;
}
body.dark {
  --color-primary: #ff7043;
  --color-secondary: #e0e0e0;
  --text-color: #e0e0e0;
  --overbrillant-bg: #1f1f1f;
  --elements-bg-color: #ff7043;
  --elements-text-color: #ffffff;
  --bg-color: #121212;

  --footer-bg: #282828;
  --footer-text-color: #9e9e9e;
  --switcher-bg: #03a9f4;
}

/* Mise en forme des titres */
h1 {
  margin: 10px;
  font-size: 60px;
  font-weight: 900;
  color: var(--color-primary);
}

h2 {
  margin: 10px;
  font-size: 30px;
  font-weight: 600;
  color: var(--color-secondary);
}

h3 {
  margin: 10px;
  font-size: 17px;
  font-weight: 500;
  color: var(--color-secondary);
}

/* Mise en forme des formulaires */
input[type="radio"] {
  filter: grayscale(1); /* Grayscale passe le bouton en niveau de gris */
}

input[type="text"],
input[type="email"] {
  width: 100%;
  margin-right: 10px;
  padding: 5px;
  border: none;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 600;
  font-size: 17px;
  color: var(--color-primary);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder {
  color: var(--color-secondary);
  opacity: 50%;
}

button {
  padding: 5px;
  border: none;
  border-radius: 8px;
  font-family: "Roboto", sans-serif;
  font-weight: 600;
  font-size: 17px;
  color: var(--elements-text-color);
  background-color: var(--elements-bg-color);
  /* margin: 0.5rem 0; */
}

button:hover {
  color: var(--color-primary);
  background-color: var(--color-tertiary);
  cursor: pointer;
}

button:focus {
  background-color: var(--color-tertiary);
  border: 3px solid var(--color-primary);
  padding: 2px;
}
button:disabled {
  background-color: var(--color-tertiary);
  color: var(--color-primary);
}

/**
 * Eléments principaux
 */
body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  min-height: 100vh;
  font-family: "Roboto", sans-serif;
  background-color: var(--bg-color);
}

header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
header h1 {
  margin-top: 1.5rem;
}

main {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  width: 50%;
  min-width: 200px;
  margin-bottom: 50px;
  padding: 50px;
  text-align: center;
  color: white;
  font-size: 17px;
  font-weight: 500;
  border-radius: 30px;
  background-color: var(--overbrillant-bg);
}

footer {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 30px;
  font-weight: 600;
  font-size: 17px;
  color: var(--footer-text-color);
  background-color: var(--footer-bg);
}
/* footer top span-border */
footer span {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 3px;
  background-color: var(--switcher-bg);
  animation: extend 1s ease-in-out;
}

/* dark-light button */
header > .themeSwitcher {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  top: 5%;
  right: 5%;
  background-color: var(--overbrillant-bg);
  padding: 0.3rem 0.7rem;
  border-radius: 15px;
  text-align: center;
  color: white;
}
header > .themeSwitcher > div {
  position: relative;
  display: inline-block;
  width: 2rem;
  height: 1.1rem;
  background-color: var(--switcher-bg);
  border-radius: 10px;
}
header > .themeSwitcher > div > span {
  position: absolute;
  left: 0;
  top: 0.05rem;
  display: inline-block;
  width: 1rem;
  height: 1rem;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s;
  box-shadow: 2px 0 2px black;
}
header > .themeSwitcher > div.active > span {
  transform: translateX(1rem);
}

/**
 * Mise en forme des éléments de la zone principale
 */

/* Zone d'options */
.optionsSource {
  margin: 20px;
}

.optionsSource input[type="radio"]:not(:first-child) {
  margin-left: 20px;
}

/* Zone ou sera affiché le texte (mot ou phrase) à afficher */
.propositionZone {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 10px 0 10px 0;
  padding: 20px;
  border-radius: 20px;
  background-color: white;
  font-size: 30px;
  font-weight: 600;
  color: var(--color-primary);
}

.propositionZone span {
  perspective: 100%;
  transition: transform 0.15s ease-in;
}
.propositionZone span.transition {
  transform: rotateX(360deg);
}

/* Zone de saisie */
.typeZone {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 30px;
}

/* Eléments du formulaire de saisie */
.typeZone input[type="text"] {
  width: 80%;
}
.typeZone input[type="text"]::placeholder {
  color: var(--footer-text-color);
  text-align: center;
}

.typeZone button {
  width: 20%;
}

.scoreZone {
  font-size: 20px;
}

.shareZone {
  padding-top: 20px;
}

/**
  * Gestion des popups
  */

.popupBackground {
  position: fixed;
  height: 100vh;
  width: 100vw;
  background-color: rgba(255, 255, 255, 0.5);
  perspective: 50%;
  transform-origin: top left 1vw;
  transform: rotateX(90deg);
  transition: transform 0.5s ease-in-out;
}
.popupBackground.display {
  transform: rotateX(0deg);
}

.popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  width: 300px;
  padding: 20px;
  text-align: center;
  color: var(--footer-text-color);
  font-size: 17px;
  font-weight: 500;
  background-color: var(--overbrillant-bg);
  border-radius: 30px;
  box-shadow: 0 0 10px 1px rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.active {
  display: flex !important;
}

.popup p {
  width: 100%;
  margin-bottom: 20px;
}

.popup div {
  font-size: 25px;
  padding: 5px;
  padding-bottom: 15px;
  color: white;
}

/* Eléments de formulaire */
.popup input {
  margin-bottom: 10px;
}
.popup input::placeholder {
  color: var(--popup-input-color);
}
.popup input.error {
  animation: headShake 0.3s;
}

.popup button {
  margin: 5px;
}

/* Bouton de fermeture */
#closePopup {
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 20px;
  color: var(--color-primary);
  background-color: white;
  padding: 2px 7px;
  border-radius: 30px;
  text-align: center;
}

/**
 * Animation
 */
@keyframes extend {
  0% {
    transform: scaleX(0);
  }
  100% {
    transform: scaleX(1);
  }
}
@keyframes headShake {
  0% {
    transform: rotate(0deg);
  }
  20% {
    transform: rotate(10deg);
  }
  40% {
    transform: rotate(-10deg);
  }
  60% {
    transform: rotate(10deg);
  }
  80% {
    transform: rotate(-10deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

/** 
 * Responsive
 */

/* En dessous de 1200 px */
@media screen and (max-width: 1200px) {
  main {
    width: 60%;
    padding: 30px;
  }
}

/* En dessous de 800 px */
@media screen and (max-width: 800px) {
  main {
    width: 90%;
    padding: 10px;
  }
}

/* En dessous de 500 px */
@media screen and (max-width: 565px) {
  main {
    width: 90%;
    padding: 10px;
  }
  header h2,
  header h3 {
    padding: 0 1rem;
  }
  .typeZone {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }
  .typeZone button {
    width: 50%;
  }
}
