@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&family=EB+Garamond:ital,wght@0,400;0,500;1,400&family=Cinzel:wght@400;500;600&display=swap');

:root{
  --wall: #1f2b24;
  --wall-dark: #172018;
  --wood: #3a2c1e;
  --wood-dark: #241a11;
  --brass: #c9a876;
  --brass-bright: #e4c98f;
  --mat: #f4ecd8;
  --ink: #2a2118;
  --ink-soft: #5a4d3c;
  --burgundy: #7f2d34;
}

/* ==========================================================================
   1. STRUCTURE GLOBALE & THÈME MUSÉE
   ========================================================================== */
body {
    background:
      radial-gradient(ellipse at 50% -10%, rgba(255,240,210,0.07), transparent 60%),
      linear-gradient(180deg, var(--wall), var(--wall-dark)) !important;
    font-family: 'EB Garamond', Georgia, serif;
    color: var(--mat);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.container-echanges {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* En-tête — cohérence avec les autres pages du musée */
.hero {
    background: linear-gradient(160deg, var(--wood) 0%, var(--wood-dark) 100%) !important;
    border-bottom: 1px solid rgba(201,168,118,0.35);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.hero_content h1 {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--mat);
    text-shadow: 0 2px 18px rgba(0,0,0,0.45);
}

.hero_content p {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    color: var(--brass-bright);
    opacity: 0.85;
}

/* Sélection de langue */
.lang-switch {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 25px;
}

.lang-link {
    font-family: 'Cinzel', serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-decoration: none;
    color: var(--brass-bright);
    background-color: rgba(0,0,0,0.25);
    padding: 6px 14px;
    border: 1px solid var(--brass);
    border-radius: 20px;
    transition: all 0.2s ease;
}

.lang-link:hover,
.lang-link.active {
    background: linear-gradient(180deg, var(--brass-bright) 0%, var(--brass) 100%);
    color: var(--wood-dark) !important;
    border-color: #7c6743;
}

/* ==========================================================================
   2. BLOC D'EXPLICATIONS & CADRE D'ACTION (HAUT DE PAGE)
   ========================================================================== */
.zone-explications {
    background: linear-gradient(160deg, var(--wood) 0%, var(--wood-dark) 100%);
    border: 1px solid rgba(201,168,118,0.35);
    border-radius: 6px;
    padding: 25px 30px;
    margin-bottom: 25px;
    box-shadow: 0 14px 30px rgba(0,0,0,0.4);
}

.zone-explications h2 {
    font-family: 'Cinzel', serif;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--brass-bright);
    margin-top: 0;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(201,168,118,0.3);
    padding-bottom: 10px;
}

.regles-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.regles-list li {
    font-family: 'Cormorant Garamond', serif;
    font-size: 15px;
    color: var(--mat);
    opacity: 0.9;
    position: relative;
    padding-left: 5px;
}

.regles-list li strong {
    color: var(--brass-bright);
}

/* Zone d'action (Boutons de Connexion / Profil) */
.zone-action {
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(201,168,118,0.3);
    border-radius: 6px;
    padding: 25px;
    text-align: center;
    margin-bottom: 40px;
}

.zone-action h3 {
    margin-top: 0;
    margin-bottom: 18px;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 18px;
    color: var(--brass-bright);
    font-weight: normal;
}

.btn-echange {
    font-family: 'Cinzel', serif;
    letter-spacing: 0.05em;
    display: inline-block;
    background: linear-gradient(180deg, var(--brass-bright) 0%, var(--brass) 100%);
    color: var(--wood-dark) !important;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    padding: 12px 24px;
    border-radius: 4px;
    border: 1px solid #7c6743;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.35), inset 0 1px 1px rgba(255,255,255,0.5);
    transition: transform 0.15s ease;
}

.btn-echange:hover {
    transform: translateY(-2px);
}

.btn-echange.btn-secondaire {
    background: transparent;
    color: var(--brass-bright) !important;
    border: 1px solid var(--brass);
    margin-left: 5px;
    box-shadow: none;
}

.btn-echange.btn-secondaire:hover {
    background: rgba(228,201,143,0.1);
}

/* ==========================================================================
   3. STRUCTURE DISPOLISTE (RECHERCHE & SPLIT DEUX COLONNES)
   ========================================================================== */
.selection-collection-large {
    margin-top: 20px;
}

.titre-dispoliste {
    text-align: center !important;
    font-family: 'Cinzel', serif;
    font-size: 26px;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--mat);
    margin-bottom: 5px;
    text-shadow: 0 2px 14px rgba(0,0,0,0.4);
}

.soustitre-dispoliste {
    text-align: center !important;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 14px;
    color: var(--brass-bright);
    opacity: 0.8;
    letter-spacing: 0.05em;
    margin-bottom: 35px;
}

/* Barre de recherche raffinée */
.barre-recherche-collection {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    width: 100%;
    max-width: 460px;
    display: block;
    margin: 0 auto 40px auto;
    padding: 12px 18px;
    border: 1px solid var(--brass);
    border-radius: 4px;
    font-size: 15px;
    box-sizing: border-box;
    background-color: var(--mat);
    color: var(--ink);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}

.barre-recherche-collection:focus {
    border-color: var(--brass-bright);
    box-shadow: 0 0 0 3px rgba(228,201,143,0.25);
    outline: none;
}

/* Layout Split : Navigation à gauche, Contenu à droite */
.layout-dispoliste {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 35px;
    align-items: start;
}

/* ==========================================================================
   4. COLONNE MENU VERTICAL (CONTINENTS & PAYS)
   ========================================================================== */
.colonne-continents {
    background: linear-gradient(160deg, var(--wood) 0%, var(--wood-dark) 100%);
    border: 1px solid rgba(201,168,118,0.35);
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 14px 30px rgba(0,0,0,0.4);
    position: sticky;
    top: 20px;
}

.instruction-continents {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    color: var(--brass-bright);
    opacity: 0.85;
    font-size: 14px;
    margin-bottom: 15px;
}

.menu-vertical-continents {
    display: flex;
    flex-direction: column;
}

/* Boutons de tête d'accordéon (Continents) */
.btn-header-continent {
    font-family: 'Cinzel', serif;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 12px 14px;
    font-size: 12.5px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 500;
    text-decoration: none;
    border-radius: 3px;
    box-sizing: border-box;
    margin-bottom: 6px;
    background: linear-gradient(180deg, var(--brass-bright) 0%, var(--brass) 100%);
    color: var(--wood-dark);
    border: 1px solid #7c6743;
    border-left: 6px solid transparent;
    box-shadow: 0 4px 10px rgba(0,0,0,0.35), inset 0 1px 1px rgba(255,255,255,0.5);
    transition: transform 0.15s ease;
}

.btn-header-continent:hover {
    transform: translateX(3px);
}

/* Rappel de continent : liseré de couleur à gauche */
.continent-europe { border-left-color: #7da2c7; }
.continent-afrique { border-left-color: #caa67a; }
.continent-ameriques { border-left-color: #c97a7a; }
.continent-asie { border-left-color: #c9c07a; }
.continent-oceanie { border-left-color: #7ac9a3; }

/* Tiroir sous-menu (Pays) */
.liste-sous-pays {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 0 10px 8px;
    border-left: 2px solid var(--brass);
    margin-left: 8px;
    margin-bottom: 6px;
}

.btn-sous-pays {
    font-family: 'EB Garamond', serif;
    display: block;
    padding: 8px 12px;
    font-size: 13.5px;
    color: var(--brass-bright);
    text-decoration: none;
    border-radius: 3px;
    background: rgba(0,0,0,0.18);
    transition: all 0.2s ease;
}

.btn-sous-pays:hover {
    background: rgba(228,201,143,0.12);
    color: var(--mat);
}

.btn-sous-pays.active {
    background: linear-gradient(180deg, var(--brass-bright) 0%, var(--brass) 100%);
    color: var(--wood-dark) !important;
    font-weight: 600;
}

.aucun-double {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    padding: 8px;
    color: var(--brass-bright);
    opacity: 0.6;
    display: block;
}

/* ==========================================================================
   5. FIL D'ARIANE, TIROIRS ALPHABÉTIQUES, ÉTAGÈRE DE SÉRIES
   ========================================================================== */
.colonne-contenu {
    background: transparent;
}

.zone-message-echanges {
    text-align: center;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 17px;
    color: var(--brass-bright);
    opacity: 0.85;
    padding-top: 60px;
}

.fil-ariane-echanges {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    color: var(--brass-bright);
    opacity: 0.9;
    font-size: 15px;
    margin-bottom: 20px;
}

.fil-ariane-echanges a {
    color: var(--brass-bright);
    text-decoration: underline;
    text-decoration-color: rgba(228,201,143,0.4);
}

.fil-ariane-echanges a:hover {
    color: var(--mat);
}

.fil-ariane-echanges strong {
    color: var(--mat);
    font-style: normal;
}

.btn-retour {
    font-family: 'Cinzel', serif;
    font-size: 11px;
    letter-spacing: 0.05em;
    display: inline-block;
    background: rgba(0,0,0,0.2);
    color: var(--brass-bright) !important;
    text-decoration: none !important;
    border: 1px solid var(--brass);
    padding: 6px 14px;
    border-radius: 4px;
    font-weight: 500;
    margin-left: auto;
    transition: all 0.2s ease;
}

.btn-retour:hover {
    background: linear-gradient(180deg, var(--brass-bright) 0%, var(--brass) 100%);
    color: var(--wood-dark) !important;
}

.sous-titre-echanges {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    color: var(--brass-bright);
    opacity: 0.85;
    font-size: 15px;
    margin: 0 0 16px;
}

.titre-liste-echanges {
    font-family: 'Cinzel', serif;
    font-size: 16px;
    font-weight: 500;
    color: var(--brass-bright);
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(201,168,118,0.3);
    padding-bottom: 10px;
}

/* ---------- Tiroirs A-Z ---------- */
.alphabet-drawers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.drawer-handle {
    background: linear-gradient(180deg, #2a2016 0%, #1a130c 100%);
    border: 1px solid rgba(201,168,118,0.4);
    border-radius: 3px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-family: 'Cinzel', serif;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--brass-bright);
    box-shadow: 0 4px 0 rgba(0,0,0,0.5), 0 8px 14px rgba(0,0,0,0.4);
    transition: all 0.18s ease;
}

.drawer-handle:hover {
    border-color: var(--brass-bright);
    box-shadow: 0 4px 0 rgba(0,0,0,0.5), 0 0 16px rgba(201,168,118,0.35);
}

.drawer-handle.vide {
    opacity: 0.28;
    box-shadow: none;
}

/* ---------- Étagère des séries ---------- */
.series-shelf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 22px;
}

.serie-card {
    display: block;
    text-decoration: none;
    background: linear-gradient(160deg, var(--wood) 0%, var(--wood-dark) 100%);
    border-radius: 3px;
    padding: 14px;
    box-shadow: 0 14px 30px rgba(0,0,0,0.4);
    border: 1px solid rgba(201,168,118,0.3);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.serie-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.serie-vignette {
    background: #0d0d0d;
    border: 1px solid var(--brass);
    border-radius: 2px;
    height: 128px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 10px;
}

.serie-vignette img {
    max-width: 88%;
    max-height: 88%;
    object-fit: contain;
}

.serie-nom {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 600;
    font-size: 15px;
    text-align: center;
    color: var(--brass-bright);
    margin: 0 0 4px;
    line-height: 1.25;
}

.serie-count {
    font-family: 'Cinzel', serif;
    font-size: 9.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    color: var(--mat);
    opacity: 0.65;
}

/* ==========================================================================
   6. GRILLE DE TIMBRES (FICHES)
   ========================================================================== */
.grille-timbres-echange {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 25px;
    margin-top: 15px;
}

.carte-timbre-echange {
    background: var(--mat);
    border: 1px solid var(--brass);
    border-radius: 4px;
    padding: 18px;
    box-shadow: 0 16px 34px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.carte-timbre-echange:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 44px rgba(0,0,0,0.45);
}

/* En-tête de carte (Année & Numéro YT) */
.annee-yt-badge {
    display: flex;
    justify-content: space-between;
    font-family: 'Cinzel', serif;
    font-size: 10.5px;
    letter-spacing: 0.04em;
    font-weight: 500;
    color: var(--ink-soft);
    border-bottom: 1px solid rgba(148,122,76,0.25);
    padding-bottom: 8px;
    margin-bottom: 14px;
}

/* Zone Image */
.zone-img-echange {
    width: 100%;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #0d0d0d;
    border: 1px solid var(--brass);
    margin-bottom: 14px;
    overflow: hidden;
}

.zone-img-echange img {
    max-width: 88%;
    max-height: 88%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.zone-img-echange img.loaded {
    opacity: 1;
}

/* Bloc des textes de la carte (description SOUS l'image) */
.infos-timbre-echange {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex-grow: 1;
}

.infos-timbre-echange h4 {
    margin: 4px 0 10px 0;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 600;
    font-size: 17px;
    color: var(--ink);
    line-height: 1.3;
}

.description-echange {
    font-family: 'Cormorant Garamond', serif;
    font-size: 13.5px;
    color: var(--ink-soft);
    line-height: 1.5;
    margin-bottom: 14px;
    text-align: left;
    width: 100%;
    word-break: break-word;
    padding-top: 8px;
    border-top: 1px dashed rgba(148,122,76,0.4);
}

/* Zone États et Badges (Admin) */
.etats-doubles-admin {
    width: 100%;
    text-align: center;
    margin-bottom: 12px;
}

.etats-doubles-admin small {
    font-family: 'Cinzel', serif;
    font-size: 9.5px;
    letter-spacing: 0.06em;
    color: var(--ink-soft);
    text-transform: uppercase;
    display: block;
    margin-bottom: 5px;
}

.wrapper-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

.badge-etat {
    font-family: 'EB Garamond', serif;
    font-size: 11px;
    font-weight: bold;
    color: #2e6a32;
    background-color: #eef7ee;
    border: 1px solid #c8e6c9;
    padding: 3px 8px;
    border-radius: 4px;
}

/* Champ quantité (gestion admin) : on masque les flèches natives qui
   ajoutent du poids visuel à droite et donnent une fausse impression de
   décalage du cadre. */
input[name="quantite"]::-webkit-inner-spin-button,
input[name="quantite"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[name="quantite"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Auteur de la fiche */
.auteur-echange {
    font-family: 'EB Garamond', serif;
    font-size: 12.5px;
    color: var(--ink-soft);
    margin-top: auto;
    margin-bottom: 14px;
}

/* Bouton Contacter de la carte */
.btn-card-contact {
    font-family: 'Cinzel', serif;
    letter-spacing: 0.04em;
    width: 100%;
    background: linear-gradient(180deg, var(--brass-bright) 0%, var(--brass) 100%);
    color: var(--wood-dark) !important;
    border: 1px solid #7c6743;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.15s ease;
}

.btn-card-contact:hover {
    transform: translateY(-2px);
}

/* ==========================================================================
   7. PAGINATION & INTERFACE DE DISCUSSIONS (CHAT BOX)
   ========================================================================== */
.pagination-echanges {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    padding: 20px 0;
    flex-wrap: wrap;
}

.pagination-link {
    font-family: 'Cinzel', serif;
    font-size: 12px;
    letter-spacing: 0.04em;
    font-weight: 500;
    text-decoration: none;
    background: linear-gradient(180deg, var(--brass-bright) 0%, var(--brass) 100%);
    color: var(--wood-dark) !important;
    border: 1px solid #7c6743;
    padding: 8px 13px;
    border-radius: 3px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    transition: transform 0.12s ease;
}

.pagination-link:hover {
    transform: translateY(-1px);
}

.pagination-link.active {
    background: linear-gradient(180deg, #191309 0%, #100c07 100%);
    color: var(--brass-bright) !important;
}

.pagination-disabled {
    font-family: 'Cinzel', serif;
    font-size: 12px;
    color: var(--brass-bright);
    opacity: 0.3;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(201,168,118,0.2);
    padding: 8px 13px;
    border-radius: 3px;
}

/* Fenêtre de Chat (thème bois/laiton) */
.chat-container {
    border: 1px solid var(--brass) !important;
    font-family: 'EB Garamond', serif;
}

.chat-header {
    font-family: 'Cinzel', serif !important;
    letter-spacing: 0.03em;
}

.chat-input {
    font-family: 'EB Garamond', serif;
    font-size: 13.5px;
}

/* ==========================================================================
   8. ADAPTATION RESPONSIVE (MOBILES ET TABLETTES)
   ========================================================================== */
@media (max-width: 992px) {
    .layout-dispoliste {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

@media (max-width: 576px) {
    .grille-timbres-echange {
        grid-template-columns: 1fr;
    }
    .zone-action-buttons {
        flex-direction: column;
    }
    .btn-echange.btn-secondaire {
        margin-left: 0;
        margin-top: 8px;
    }
}