/* === RESET ET BASE === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* === BOUTONS DANS NAV === */
button {
  padding: 10px 22px;
  background: rgba(43, 37, 32, 0.6);
  border: 1px solid rgba(201, 168, 124, 0.3);
  border-radius: 6px;
  color: #c9a87c;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Bouton actif */
button[data-active="true"] {
  background: rgba(201, 168, 124, 0.3);
  color: #f4e4d0;
  border-color: #c9a87c;
}

/* Bouton actif */
button[data-active="true"] {
  background: rgba(201, 168, 124, 0.3);
  color: #f4e4d0;
  border-color: #c9a87c;
}

/* === THÈME SOMBRE (par défaut) === */
body {
  font-family: 'Arial', sans-serif;
  background: linear-gradient(135deg, #2b2520 0%, #1a1714 100%);
  color: #d4c5b9;
  padding-top: 70px;
  transition: all 0.4s ease;
}

/* === THÈME CLAIR === */
body[data-theme="light"] {
  background: linear-gradient(135deg, #f5f1ed 0%, #e8dfd5 100%);
  color: #3d3329;
}

/* === EN-TÊTE === */
header {
  text-align: center;
}

h1 {
  font-size: 36px;
  color: #c9a87c;
  margin-bottom: 5px;
  letter-spacing: 2px;
  font-weight: 600;
}

body[data-theme="light"] h1 {
  color: #8b745f;
}

h2 {
  font-size: 16px;
  color: #a89584;
  font-weight: 300;
  letter-spacing: 1px;
  margin-bottom: 0;
}

body[data-theme="light"] h2 {
  color: #6b5d52;
}

/* === NAV STICKY === */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: rgba(43, 37, 32, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid rgba(201, 168, 124, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

body[data-theme="light"] nav {
  background: rgba(245, 241, 237, 0.95);
  border-bottom-color: rgba(139, 116, 95, 0.3);
  box-shadow: 0 4px 20px rgba(61, 51, 41, 0.1);
}



/* === BARRE DE RECHERCHE DANS NAV === */
#search[type="text"] {
  flex: 1;
  max-width: 400px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(201, 168, 124, 0.3);
  border-radius: 6px;
  color: #d4c5b9;
  font-size: 16px;
  transition: all 0.3s;
  text-align: left;
  margin-bottom: auto;
}

body[data-theme="light"] #search[type="text"] {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(139, 116, 95, 0.3);
  color: #3d3329;
}

#search[type="text"]::placeholder {
  color: rgba(212, 197, 185, 0.4);
}

body[data-theme="light"] #search[type="text"]::placeholder {
  color: rgba(61, 51, 41, 0.4);
}

#search[type="text"]:focus {
  outline: none;
  border-color: #c9a87c;
  background: rgba(0, 0, 0, 0.4);
}

body[data-theme="light"] #search[type="text"]:focus {
  background: rgba(255, 255, 255, 1);
  border-color: #8b745f;
}



body[data-theme="light"] button {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(139, 116, 95, 0.4);
  color: #6b5d52;
}

button:hover {
  background: rgba(43, 37, 32, 0.8);
  border-color: #c9a87c;
  transform: translateY(-2px);
}

body[data-theme="light"] button:hover {
  background: rgba(255, 255, 255, 1);
  border-color: #8b745f;
}

button:active {
  transform: translateY(0);
}

/* Bouton actif */
button[data-active="true"] {
  background: rgba(201, 168, 124, 0.3);
  color: #f4e4d0;
  border-color: #c9a87c;
}

body[data-theme="light"] button[data-active="true"] {
  background: rgba(139, 116, 95, 0.3);
  color: #3d3329;
  border-color: #8b745f;
}

/* === SECTION RECHERCHE === */
section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* === MAIN POUR LA GRILLE === */
main {
  display: grid;
  grid-template-columns: repeat(auto-fill, 220px);
  gap: 25px;
  padding: 20px 0;
  justify-content: center;
  grid-auto-rows: auto;
}

/* === ARTICLES POUR LES MANGAS === */
article {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(201, 168, 124, 0.2);
  width: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

body[data-theme="light"] article {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(139, 116, 95, 0.25);
}

article:hover {
  border-color: #c9a87c;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

body[data-theme="light"] article:hover {
  border-color: #8b745f;
  box-shadow: 0 8px 20px rgba(61, 51, 41, 0.15);
}

/* === IMAGES DES MANGAS === */
img {
  width: 220px;
  height: auto;
  max-height: 60vh;
  object-fit: contain;
  display: block;
  opacity: 0.95;
}

body[data-theme="light"] img {
  background: #e8dfd5;
  opacity: 1;
}

article:hover img {
  opacity: 1;
}

/* === TITRES DES MANGAS === */
h3 {
  font-size: 18px;
  color: #c9a87c;
  margin-bottom: 8px;
  font-weight: 600;
}

body[data-theme="light"] h3 {
  color: #8b745f;
}

/* === PARAGRAPHES === */
p {
  color: rgba(212, 197, 185, 0.7);
  line-height: 1.6;
}

body[data-theme="light"] p {
  color: rgba(61, 51, 41, 0.7);
}

/* Premier paragraphe (auteur) */
p:first-of-type {
  color: #a89584;
  font-weight: 500;
  font-size: 16px;
}

body[data-theme="light"] p:first-of-type {
  color: #6b5d52;
}

/* === SPAN POUR BADGES === */
span {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(201, 168, 124, 0.2);
  border: 1px solid rgba(201, 168, 124, 0.3);
  border-radius: 4px;
  font-size: 16px;
  font-weight: 500;
  margin-top: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #c9a87c;
}

body[data-theme="light"] span {
  background: rgba(139, 116, 95, 0.15);
  border-color: rgba(139, 116, 95, 0.3);
  color: #6b5d52;
}

/* === FOOTER POUR MESSAGE VIDE === */
footer {
  text-align: center;
  padding: 60px 20px;
  color: rgba(212, 197, 185, 0.4);
  font-size: 18px;
  display: none;
}

body[data-theme="light"] footer {
  color: rgba(61, 51, 41, 0.4);
}

footer[data-visible="true"] {
  display: block;
}

article div {
  width: 100%;
  display: flex;
  padding: 10px;
  flex-direction: column;
  justify-content: space-between;
}

article div div {
  display: flex;
  width: 100%;
  padding: 0px;
  flex-direction: row;
  align-items: center;
  margin-top: 10px;
}

.infos {
  margin-top: auto;
}

.titre {
  font-size: 16px;
  line-height: 1.2em;
  max-height: 2.4em;
  margin: 0px;
  line-height: 1.2em;
  max-height: 2.4em;
  overflow: hidden;
}


.tome {
  font-size: 16px;
  line-height: 1.2em;
  margin: 0px;
  margin-left: 10px;
  margin-right: 10px;
  
  color: #c9a87c;
  font-weight: 600;

  background: none;
  border: none;
  padding: 0;
  outline: none;
  width: 3ch;
}

/* Thème clair */
body[data-theme="light"] .tome {
  color: #8b745f;
}

p {
  margin: 0px;
  margin-bottom: auto;
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
  font-size: 16px !important;
  max-width: 90%;
}

.mod {
  font-size: 16px;
  padding: 3px 8px;
  margin-top: auto;
  margin-bottom: auto;
  margin-left: auto;
}

article div div button {
  padding: 5px 5px;
  margin: 0px;
  font-size: 16px;
  max-width: 33%;
}

/* === RESPONSIVE === */
@media (max-width: 530px) {
  body {
    padding-top: 110px;
  }

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 16px;
  }

  /* NAV EN MOBILE */
  nav {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 10px;
    padding: 10px;
  }

  /* RECHERCHE PLEINE LARGEUR SUR LA PREMIÈRE LIGNE */
  #search[type="text"] {
    grid-row: 1;
    grid-column: 2 / 5;
    width: 100%;
    font-size: 16px;
    padding: 10px 15px;
  }

  /* GRILLE EN LISTE VERTICALE */
  main {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* CARTES EN HORIZONTAL */
  article {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    height: 120px;
    border-radius: 8px;
    width: 100%;
  }

  /* IMAGE À GAUCHE - S'ADAPTE AU RATIO */
  img {
    width: auto;
    max-width: 25%;
  }


  article div {
    width: 75%;
  }

  article div div {
    width: 100%;
    margin-top: auto;
  }

  p {
    margin-bottom: auto;
  }

}

.add {
  grid-column: 4 / 6;
  grid-row: 2;
  margin-bottom: auto;
}

nav div {
  grid-column: 1 / 3;
  grid-row: 2;
  display: grid;
  grid-template-rows: auto auto auto auto auto auto;
}

nav div button {
  display: none;
}
.hidden {
  display: none;
}