/* =====================================================================
   Ma collection de pièces touristiques — thème "vitrine de collection"
   ===================================================================== */
:root {
  --fond:        #1b1d21;
  --fond-2:      #202329;
  --surface:     #262a31;
  --surface-2:   #2d323a;
  --bord:        #383d47;
  --encre:       #e9e6df;
  --encre-doux:  #a4a199;
  --laiton:      #c9a24b;
  --laiton-clair:#e0c179;
  --patine:      #86a08c;
  --danger:      #c96a5a;
  --rayon:       10px;
  --ombre:       0 8px 28px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, #23262d 0%, var(--fond) 60%) fixed;
  color: var(--encre);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

a { color: var(--laiton-clair); text-decoration: none; }
a:hover { text-decoration: underline; }

.contenu { max-width: 1180px; margin: 0 auto; padding: 0 22px 80px; }

/* ---------------- En-tête ---------------- */
.bandeau {
  border-bottom: 1px solid var(--bord);
  background: linear-gradient(180deg, rgba(201,162,75,.06), transparent);
}
.bandeau-inner {
  max-width: 1180px; margin: 0 auto; padding: 26px 22px 22px;
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
}
.titre-collec {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.6rem, 3.4vw, 2.35rem);
  letter-spacing: .01em;
  margin: 0;
  line-height: 1.1;
}
.titre-collec .filet {
  display: block; width: 74px; height: 3px; margin-top: 12px;
  background: linear-gradient(90deg, var(--laiton), transparent);
  border-radius: 3px;
}
.compteur { color: var(--encre-doux); font-size: .95rem; margin-top: 6px; }
.compteur b { color: var(--laiton-clair); font-variant-numeric: tabular-nums; }

.bouton {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); color: var(--encre);
  border: 1px solid var(--bord); border-radius: var(--rayon);
  padding: 10px 16px; font-size: .95rem; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.bouton:hover { border-color: var(--laiton); text-decoration: none; }
.bouton-or {
  background: linear-gradient(180deg, var(--laiton-clair), var(--laiton));
  color: #241c07; border-color: transparent; font-weight: 600;
}
.bouton-or:hover { filter: brightness(1.05); }
.bouton-danger { border-color: transparent; background: transparent; color: var(--danger); padding: 8px 10px; }
.bouton-danger:hover { text-decoration: underline; }

/* ---------------- Filtres ---------------- */
.filtres {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin: 26px 0 30px;
}
.filtres select, .filtres input[type=search] {
  background: var(--surface); color: var(--encre);
  border: 1px solid var(--bord); border-radius: var(--rayon);
  padding: 10px 12px; font-size: .95rem; min-width: 150px;
}
.filtres input[type=search] { min-width: 220px; flex: 1; }
.filtres .lien-reset { color: var(--encre-doux); font-size: .9rem; }

/* ---------------- Grille de médailles ---------------- */
.grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 30px 24px;
}

.medaille { text-align: center; }

/* Le disque : carte "retournable" recto / verso */
.disque {
  position: relative;
  width: 100%; aspect-ratio: 1 / 1;
  perspective: 1000px;
  cursor: pointer;
  background: none; border: 0; padding: 0;
}
.disque-face {
  position: absolute; inset: 0;
  border-radius: 50%;
  transition: transform .55s cubic-bezier(.4,.15,.25,1);
  transform-style: preserve-3d;
  backface-visibility: hidden;
  overflow: hidden;
  background: var(--surface);
  box-shadow:
    inset 0 0 0 4px rgba(0,0,0,.35),
    inset 0 0 0 6px var(--laiton),
    var(--ombre);
}
.disque-recto { transform: rotateY(0deg); }
.disque-verso { transform: rotateY(180deg); }
/* Survol : la médaille se retourne pour révéler le verso */
.disque.a-verso:hover .disque-recto { transform: rotateY(180deg); }
.disque.a-verso:hover .disque-verso { transform: rotateY(360deg); }

.disque-face img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.disque-vide {
  position: absolute; inset: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--encre-doux); font-size: .85rem; text-align: center; padding: 20px;
  box-shadow: inset 0 0 0 4px rgba(0,0,0,.3), inset 0 0 0 6px var(--bord);
}

/* Indice "agrandir" (loupe) */
.badge-face {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.62); color: var(--laiton-clair);
  font-size: .72rem; padding: 3px 10px; border-radius: 20px;
  pointer-events: none; opacity: 0; transition: opacity .2s; z-index: 2;
}
.disque:hover .badge-face { opacity: 1; }

.medaille-nom { font-weight: 600; margin: 14px 0 2px; }
.medaille-meta { color: var(--encre-doux); font-size: .85rem; }
.puce {
  display: inline-block; background: var(--surface-2); color: var(--patine);
  border: 1px solid var(--bord); border-radius: 20px;
  padding: 1px 10px; font-size: .74rem; margin-top: 6px;
}
.medaille-actions { margin-top: 8px; font-size: .85rem; }

/* ---------------- État vide ---------------- */
.vide {
  text-align: center; padding: 80px 20px; color: var(--encre-doux);
  border: 1px dashed var(--bord); border-radius: 16px;
}
.vide h2 { color: var(--encre); font-family: Georgia, serif; }

/* ---------------- Bandeaux messages ---------------- */
.message { padding: 12px 16px; border-radius: var(--rayon); margin: 18px 0; }
.message-ok    { background: rgba(134,160,140,.15); border: 1px solid var(--patine); }
.message-err   { background: rgba(201,106,90,.15);  border: 1px solid var(--danger); }

/* ---------------- Formulaire d'administration ---------------- */
.carte {
  background: var(--surface); border: 1px solid var(--bord);
  border-radius: 16px; padding: 24px; box-shadow: var(--ombre);
}
.carte h2 { margin-top: 0; font-family: Georgia, serif; }
.champ { margin-bottom: 16px; }
.champ label { display: block; margin-bottom: 6px; font-size: .9rem; color: var(--encre-doux); }
.champ input[type=text], .champ input[type=number], .champ input[type=password],
.champ textarea, .champ select {
  width: 100%; background: var(--fond-2); color: var(--encre);
  border: 1px solid var(--bord); border-radius: var(--rayon);
  padding: 11px 13px; font-size: 1rem; font-family: inherit;
}
.champ textarea { min-height: 80px; resize: vertical; }
.champ input[type=file] {
  width: 100%; background: var(--fond-2); color: var(--encre-doux);
  border: 1px dashed var(--bord); border-radius: var(--rayon); padding: 14px;
  font-size: .9rem;
}
.ligne { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.aide { font-size: .8rem; color: var(--encre-doux); margin-top: 4px; }
.apercu-actuel { margin-top: 8px; display: flex; gap: 10px; }
.apercu-actuel img { width: 64px; height: 64px; object-fit: cover; border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--laiton); }

/* Tableau des pièces (admin) */
.liste-admin { margin-top: 34px; }
.ligne-piece {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--bord);
  border-radius: 14px; padding: 12px 16px; margin-bottom: 12px;
}
.ligne-piece .vignettes { display:flex; gap:8px; flex:0 0 auto; }
.ligne-piece .vignette { width: 100px; height: 100px; border-radius: 50%;
  object-fit: cover; box-shadow: inset 0 0 0 3px var(--laiton); flex: 0 0 auto; }
.ligne-piece .vignette-vide { width:100px;height:100px;border-radius:50%;
  box-shadow: inset 0 0 0 3px var(--bord); flex:0 0 auto; }
.ligne-piece .infos { flex: 1; min-width: 0; }
.ligne-piece .infos .nom { font-weight: 600; }
.ligne-piece .infos .meta { color: var(--encre-doux); font-size: .85rem; }

/* Connexion */
.login-wrap { max-width: 380px; margin: 12vh auto 0; }
.login-wrap .marque { text-align: center; font-family: Georgia, serif;
  font-size: 1.5rem; margin-bottom: 6px; }
.login-wrap .sous { text-align: center; color: var(--encre-doux);
  margin-bottom: 26px; font-size: .92rem; }

/* ---------------- Lightbox (grand format) ---------------- */
.lightbox {
  position: fixed; inset: 0; background: rgba(10,11,13,.9);
  display: none; align-items: flex-start; justify-content: center;
  padding: 30px; z-index: 50; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.lightbox.ouverte { display: flex; }
.lightbox-inner { text-align: center; max-width: 100%; margin: auto; padding-bottom: 12px; }
.lightbox-faces { display: flex; gap: 26px; flex-wrap: wrap; justify-content: center; }
.lightbox-faces figure { margin: 0; }
.lightbox-faces img {
  max-width: min(44vw, 460px); max-height: 70vh;
  border-radius: 50%; box-shadow: inset 0 0 0 6px var(--laiton), var(--ombre);
  background: var(--surface);
}
.lightbox-faces figcaption { color: var(--encre-doux); font-size: .8rem; margin-top: 10px; }
.lightbox-titre { font-family: Georgia, serif; font-size: 1.4rem; margin: 22px 0 4px; }
.lightbox-meta { color: var(--encre-doux); }
.lightbox-fermer {
  position: absolute; top: 18px; right: 22px; font-size: 2rem; line-height: 1;
  color: var(--encre); background: none; border: 0; cursor: pointer;
}

@media (max-width: 620px) {
  .ligne { grid-template-columns: 1fr; }
  .lightbox-faces img { max-width: 78vw; max-height: 46vh; }
}

@media (prefers-reduced-motion: reduce) {
  .disque-face { transition: none; }
}

/* ---------------- Fiche détaillée (lightbox) ---------------- */
.lb-details {
  display: grid; grid-template-columns: auto auto; gap: 7px 14px;
  justify-content: center; width: fit-content; max-width: 92%;
  margin: 22px auto 0;
  border-top: 1px solid var(--bord); padding-top: 18px;
}
.lb-details dt { color: var(--laiton-clair); font-size: .82rem; white-space: nowrap; text-align: right; }
.lb-details dd { margin: 0; color: var(--encre); font-size: .92rem; text-align: left; }
@media (max-width: 620px) {
  .lb-details { max-width: 96%; gap: 5px 12px; }
}

/* Champ avec bouton accolé (ex. N# Numista) */
.champ-inline { display: flex; gap: 8px; align-items: stretch; }
.champ-inline input { flex: 1; }
.champ-inline .bouton { white-space: nowrap; }
@media (max-width: 620px) {
  .champ-inline { flex-direction: column; }
}

/* ---------------- Détourage manuel ---------------- */
.cropper { margin-top: 10px; }
.cropper-zone { position: relative; display: inline-block; max-width: 100%; line-height: 0; touch-action: none; }
.cropper-zone img { max-width: 100%; max-height: 50vh; display: block; border-radius: 6px; }
.cropper-cercle {
  position: absolute; border: 2px solid var(--laiton); border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.55); cursor: move; touch-action: none;
}
.cropper input[type=range] { width: 100%; vertical-align: middle; }

/* ---------------- Recherche + pagination (admin) ---------------- */
.admin-recherche { display:flex; gap:8px; flex-wrap:wrap; margin:14px 0; }
.admin-recherche input[type=search] { flex:1; min-width:180px; }
.pagination { display:flex; gap:14px; align-items:center; justify-content:center; margin-top:20px; color:var(--encre-doux); }

/* ---------------- Pièces ovales (écrasées) ---------------- */
.ligne-piece .vignette.ovale { border-radius: 0; box-shadow: none; object-fit: contain; }
.disque.ovale .disque-face { border-radius: 14px; box-shadow: inset 0 0 0 3px rgba(0,0,0,.25), var(--ombre); }
.disque.ovale .disque-face img { object-fit: contain; }
.lightbox-faces img.ovale { border-radius: 0 !important; box-shadow: none !important; }
