html {
  font-size: 16px;
  font-weight: 400;
  font-family: "Roboto", sans-serif;
  line-height: 1.5;
  color: #333;
  background-color: #f1f1f1;
}

body {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  justify-content: center;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
  padding: 0;
  align-self: center;
}

.container {
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-grow: 1;
  align-items: center;
  gap: 20px;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

footer {
  margin-top: auto;
  padding: 1rem;
  text-align: center;
  align-self: flex-end;
}

li {
  margin: 0;
  padding: 0;
}

a {
  text-decoration: wavy grey underline;
  color: #333;
}

a > img {
  width: 5rem;
  border-radius: 3rem;
}

.laughing-man {
  width: 10rem;
}

#anime-list {
  display: flex;
  flex-direction: column;
  align-items: center;
}

hr {
  border: none;
  height: 2px;
  background: #ccc;
  margin: 20px 0;
}

.container-anime {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  width: 90%;
  max-width: 1200px;
  margin-bottom: 50px;
}

.card {
  background: linear-gradient(to bottom, #ffffff, #f8f8ff);
  border: 1px solid #ddd;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin: 10px;
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s;
}
.card:hover {
  transform: translateY(-10px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.card img {
  width: 100%;
  height: auto;
  display: block;
}

.card-title {
  font-size: 18px;
  font-weight: bold;
  padding: 10px 15px;
}

.card-rating {
  font-size: 16px;
  color: #ffa500;
  padding-bottom: 15px;
}

h2 {
  font-size: 24px;
  color: #4b0082; /* Violet foncé */
  margin-top: 40px;
  text-align: center;
  position: relative;
}
h2::before,
h2::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 50px;
  height: 2px;
  background: #4b0082;
}
h2::before {
  left: -60px;
}
h2::after {
  right: -60px;
}

.year-select-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem auto;
}

#year-select {
  width: auto;
  max-width: 200px;
  padding: 0.4rem 0.6rem;
  font-size: 1rem;
  font-family: inherit;
  border-radius: 8px;
  border: 1px solid #ccc;
  background-color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: border-color 0.3s;
}

#year-select:focus {
  border-color: #4b0082;
  outline: none;
}

.year-select-container label {
  font-weight: bold;
  color: #4b0082;
}

.switch-container {
  display: flex;
  gap: 0.5em;
  justify-content: center;
  align-items: center;
  margin: 1.2em 0 1em 0;
}

.switch-container button {
  padding: 0.25em 0.9em;
  border: 2px solid #4b0082;
  background: #fff;
  color: #4b0082;
  font-weight: bold;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  box-shadow: 0 2px 6px rgba(75, 0, 130, 0.05);
}

.switch-container button:hover,
.switch-container button.active {
  background: #4b0082;
  color: #fff;
  border-color: #4b0082;
}

/* Bouton retour en haut */
#back-to-top {
  display: none;
  position: fixed;
  right: 2vw;
  bottom: 2vh;
  z-index: 100;
  background: #4b0082; /* Fond violet par défaut */
  color: #fff; /* Texte blanc par défaut */
  border: 2px solid #4b0082;
  border-radius: 50%;
  width: 2.5em;
  height: 2.5em;
  font-size: 1.5em;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(75, 0, 130, 0.1);
  transition: background 0.2s, color 0.2s;
}
#back-to-top:hover {
  background: #fff; /* Fond blanc au hover */
  color: #4b0082; /* Texte violet au hover */
}

#sort-asc,
#sort-desc {
  padding: 0.2em 0.7em;
  border: 2px solid #4b0082;
  background: #fff;
  color: #4b0082;
  font-weight: bold;
  border-radius: 6px;
  font-size: 1.1em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

#sort-asc.active,
#sort-desc.active {
  background: #4b0082;
  color: #fff;
  border-color: #4b0082;
}

#sort-asc:hover:not(.active),
#sort-desc:hover:not(.active) {
  background: #eee;
}

@media (max-width: 768px) {
  .container-anime {
    grid-template-columns: 1fr; /* 1 carte par ligne */
  }

  .card {
    margin: 0 auto;
    width: 90%;
  }
}

@media (max-width: 1024px) {
  .container-anime {
    grid-template-columns: repeat(3, 1fr); /* Tablette : 3 colonnes */
  }
}

@media (max-width: 600px) {
  .container-anime {
    grid-template-columns: 1fr; /* Smartphone : 1 colonne */
  }

  #back-to-top {
    right: 1vw;
    bottom: 1vh;
    width: 2em;
    height: 2em;
    font-size: 1.1em;
  }
}
