/* ══════════════════════════════════════════════
   style_livres.css — Bibliothèque SMNV
   ══════════════════════════════════════════════ */

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

body {
  font-family: Calibri, Garamond, Arial, sans-serif;
  background-color: white;
  color: #222;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

/* ── Logo ───────────────────────────────────── */
#logo {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 16px;
}

/* ── Titre principal ────────────────────────── */
h1 {
  text-align: center;
  font-size: 1.6rem;
  margin: 24px 0 32px;
  color: #222;
}

/* ── Fiche livre ────────────────────────────── */
article.fiche {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgb(142, 160, 61);
}

article.fiche:last-child {
  border-bottom: none;
}

/* Couverture */
article.fiche img {
  width: 110px;
  min-width: 110px;
  height: 165px;
  object-fit: cover;
  border: 1px solid #ddd;
}

/* Zone d'informations */
.fiche-info {
  flex: 1;
  min-width: 0;
}

.fiche-info h2 {
  font-size: 1rem;
  font-weight: 600;
  color: rgb(80, 100, 30);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgb(200, 210, 170);
}

/* Tableau d'informations */
.fiche-info table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.fiche-info table th {
  width: 90px;
  text-align: left;
  vertical-align: top;
  font-weight: 500;
  font-size: 0.82rem;
  color: #666;
  padding: 2px 10px 2px 0;
  white-space: nowrap;
}

.fiche-info table td {
  font-size: 0.88rem;
  vertical-align: top;
  padding: 2px 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ── Liens ──────────────────────────────────── */
a {
  color: rgb(80, 100, 30);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ── Barre de sélection des livres (v2.0) ─────────────────────────────────── */
#barre-selection {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  position: sticky;
  top: 0;
  background: white;
  border-bottom: 2px solid rgb(142, 160, 61);
  padding: 10px 0;
  margin-bottom: 24px;
  z-index: 100;
}

#barre-gauche {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#barre-selection button {
  padding: 7px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.88rem;
  font-family: inherit;
}

#btn-tout-cocher,
#btn-tout-decocher {
  background: rgb(230, 237, 207);
  color: #333;
}

#btn-tout-cocher:hover,
#btn-tout-decocher:hover {
  background: rgb(200, 215, 160);
}

#btn-afficher {
  background: rgb(80, 100, 30);
  color: white;
  font-weight: 600;
  padding: 8px 20px;
}

#btn-afficher:hover {
  background: rgb(60, 80, 20);
}

#compteur {
  font-size: 0.85rem;
  color: #666;
}

/* Case à cocher sur chaque fiche */
.fiche-select {
  display: flex;
  align-items: flex-start;
  padding-top: 4px;
  cursor: pointer;
}

.fiche-select input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: rgb(80, 100, 30);
  flex-shrink: 0;
}

/* Fiche cochée — légère mise en évidence */
article.fiche:has(.livre-check:checked) {
  background: rgb(245, 250, 235);
  border-radius: 6px;
}

/* ── Boutons de sélection par langue ──────────────────────────────────────── */
#separateur-langue {
  color: #ccc;
  font-size: 1.2em;
}

.btn-langue {
  padding: 5px 12px;
  border: 1px solid rgb(142, 160, 61);
  border-radius: 4px;
  background: white;
  color: rgb(80, 100, 30);
  cursor: pointer;
  font-size: 0.82rem;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-langue:hover {
  background: rgb(230, 237, 207);
}

/* Bouton de langue actif (langue sélectionnée) */
.btn-langue-actif {
  background: rgb(80, 100, 30) !important;
  color: white !important;
  border-color: rgb(80, 100, 30) !important;
}

/* ── Sélecteur de langue ───────────────────────────────────────────────────── */
.selecteur-langue {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding: 6px 0;
  margin-bottom: 8px;
}

.lang-btn {
  padding: 3px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: white;
  color: #555;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s;
}

.lang-btn:hover {
  border-color: rgb(80, 100, 30);
  color: rgb(80, 100, 30);
}

.lang-btn-actif {
  background: rgb(80, 100, 30) !important;
  color: white !important;
  border-color: rgb(80, 100, 30) !important;
}

/* ── Pied de page inscription ──────────────────────────────────────────────── */
#pied-page {
  text-align: center;
  margin-top: 40px;
  padding: 16px;
  border-top: 1px solid rgb(200, 210, 170);
  font-size: 0.85rem;
}

#pied-page a {
  color: rgb(80, 100, 30);
  text-decoration: underline;
}

/* ── Espace en haut lors du scroll vers une ancre ─────────────────────────── */
html {
  scroll-padding-top: 80px;
}

/* ── Surbrillance d'une fiche visée par un lien (depuis la TDM) ───────────── */
.highlight {
  background-color: #fff3cd;
  padding: 8px;
  border-radius: 6px;
  transition: background-color 0.5s ease;
  box-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
}

.highlight-fade {
  background-color: transparent;
  box-shadow: none;
}

/* ── Surbrillance des fiches dont la langue est sélectionnée ──────────────── */
article.fiche.fiche-langue-active {
  border-left: 4px solid rgb(80, 100, 30);
  padding-left: 12px;
}

article.fiche:not(.fiche-langue-active) {
  opacity: 0.55;
}

/* ── État de chargement de la liste des livres ─────────────────────────────── */
.chargement-livres {
  padding: 20px 0;
  color: #777;
}

/* ── Barre de sélection ────────────────────────────────────────────────────── */
#barre-selection {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  position: sticky;
  top: 0;
  background: white;
  border-bottom: 2px solid rgb(142, 160, 61);
  padding: 10px 0;
  margin-bottom: 24px;
  z-index: 100;
}

#barre-gauche {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#barre-selection button {
  padding: 7px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.88rem;
  font-family: inherit;
}

#btn-tout-cocher,
#btn-tout-decocher {
  background: rgb(230, 237, 207);
  color: #333;
}

#btn-tout-cocher:hover,
#btn-tout-decocher:hover {
  background: rgb(200, 215, 160);
}

#btn-afficher {
  background: rgb(80, 100, 30);
  color: white;
  font-weight: 600;
  padding: 8px 20px;
}

#btn-afficher:hover {
  background: rgb(60, 80, 20);
}

#compteur {
  font-size: 0.85rem;
  color: #666;
}

/* ── Case à cocher sur chaque fiche ───────────────────────────────────────── */
.fiche-select {
  display: flex;
  align-items: flex-start;
  padding-top: 4px;
  cursor: pointer;
}

.fiche-select input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: rgb(80, 100, 30);
  flex-shrink: 0;
}

article.fiche:has(.livre-check:checked) {
  background: rgb(245, 250, 235);
  border-radius: 6px;
}

/* ── Boutons langue de livres ──────────────────────────────────────────────── */
#separateur-langue {
  color: #ccc;
  font-size: 1.2em;
}

.btn-langue {
  padding: 5px 12px;
  border: 1px solid rgb(142, 160, 61);
  border-radius: 4px;
  background: white;
  color: rgb(80, 100, 30);
  cursor: pointer;
  font-size: 0.82rem;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-langue:hover { background: rgb(230, 237, 207); }

.btn-langue-actif {
  background: rgb(80, 100, 30) !important;
  color: white !important;
  border-color: rgb(80, 100, 30) !important;
}

/* ── Sélecteur de langue (FR/DE/EN) ───────────────────────────────────────── */
.selecteur-langue {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding: 6px 0;
  margin-bottom: 8px;
}

.lang-btn {
  padding: 3px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: white;
  color: #555;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s;
}

.lang-btn:hover {
  border-color: rgb(80, 100, 30);
  color: rgb(80, 100, 30);
}

.lang-btn-actif {
  background: rgb(80, 100, 30) !important;
  color: white !important;
  border-color: rgb(80, 100, 30) !important;
}

/* ── Pied de page ──────────────────────────────────────────────────────────── */
#pied-page {
  text-align: center;
  margin-top: 40px;
  padding: 16px;
  border-top: 1px solid rgb(200, 210, 170);
  font-size: 0.85rem;
  color: #666;
}

#pied-page a {
  color: rgb(80, 100, 30);
  text-decoration: underline;
}

.pied-separateur {
  margin: 0 8px;
  color: #ccc;
}

/* ── Scroll padding pour ancres ────────────────────────────────────────────── */
html {
  scroll-padding-top: 80px;
}
