/* ===========================
   VARIABLES CSS
=========================== */
:root {
    /* Couleurs */
    --primary-color: #004080;
    --secondary-color: #1976d2;
    --success-color: #2e7d32;
    --warning-color: #fbc02d;
    --danger-color: #d32f2f;
    --light-danger: #c62828;
    --orange-color: #ef6c00;
    --light-color: #f4f4f4;
    --white: #ffffff;
    --black: #000000;
    --gray: #ddd;
    --light-gray: #f1f6fb;
    --text-color: #333;
    --text-light: #777;
    --text-red: #C00000;

    /* Tailles */
    --border-radius: 12px;
    --border-radius-small: 8px;
    --border-radius-circle: 50%;
    --box-shadow: 0 3px 8px rgba(0, 0, 0, 0.10);
    --box-shadow-hover: 0 8px 18px rgba(0, 0, 0, 0.18);
    --box-shadow-popup: 0 15px 40px rgba(0, 0, 0, 0.30);
    --box-shadow-tooltip: 0 6px 20px rgba(0, 0, 0, 0.25);

    /* Espacements */
    --padding: 20px;
    --padding-small: 10px;
    --margin-small: 5px;
    --margin-medium: 12px;

    /* Polices */
    --font-family: Arial, "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
    --font-size-small: 11px;
    --font-size-medium: 13px;
    --font-size-large: 14px;
    --font-size-title: 16px;

    /* Transitions */
    --transition: 0.25s;
    --transition-slow: 0.4s;
}

/* ===========================
   RESET ET BASE
=========================== */
body {
    margin: 0;
    font-family: var(--font-family);
    background: var(--light-color);
    color: var(--text-color);
}

main {
    width: 100%;
}

header {
    background: var(--white);
    padding: 5px 10px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--box-shadow);
}

h1 {
    color: var(--primary-color);
}

/* ===========================
   OUTILS DE RECHERCHE
=========================== */
.outils {
    margin-top: var(--padding);
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 5px;
}

.outils input,
.outils select {
    padding: var(--padding-small) var(--padding);
    border: 1px solid var(--gray);
    border-radius: 25px;
    font-size: var(--font-size-large);
    margin: 0;
    outline: none;
    flex-shrink: 1;
}

.outils input {
    width: 160px;
}

.outils select {
    max-width: 220px;
}

.outils button {
    margin: 0;
    flex-shrink: 0;
}

.custom-select {
    flex-shrink: 0;
}
/* ===========================
   GALERIE
=========================== */
.galerie {
    display: grid;
    grid-template-columns: repeat(auto-fill, 140px);
    justify-content: center;
    gap: 40px;
    padding: 35px;
}

.signature {
    margin-top: 10px;
    font-size: 12px;
    color: var(--primary-color);
    text-align: center;
}

/* ===========================
   CARTE BILLET (PIN)
=========================== */
.pin {
    width: 150px;
    background: var(--white);
    border-radius: var(--border-radius);
    padding: var(--padding-small);
    text-align: center;
    cursor: pointer;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    position: relative;
}

.pin:hover {
    transform: translateY(-4px);
    box-shadow: var(--box-shadow-hover);
}

.pin img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    background: var(--white);
    border-radius: var(--border-radius-small);
    margin-top: 15px;
}

.nom, .codecourt, .cote, .infos-mini {
    margin-top: var(--margin-small);
    font-size: var(--font-size-medium);
    color: var(--primary-color);
}

.codecourt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.codecourt img.drapeau {
    width: 20px !important;
    height: 13px !important;
    object-fit: cover;
    display: inline-block;
    flex-shrink: 0;
}

.note {
    color: var(--text-red);
    font-size: 10px;
}

/* ===========================
   BILLET MANQUANT
=========================== */
.pin.manquant, .billet-manquant img {
    opacity: 0.55;
}

.pin.manquant img {
    filter: grayscale(80%);
}

/* ===========================
   BANDEAU VALEUR
=========================== */
.bandeau-valeur {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 5px;
    font-size: var(--font-size-small);
    font-weight: bold;
    color: var(--white);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

/* Couleurs des bandeaux par valeur */
.valeur-5-2002 .bandeau-valeur { background: #9AAFC4; }
.valeur-5-2013 .bandeau-valeur { background: #A0B6A9; }
.valeur-10-2002 .bandeau-valeur { background: #E8899D; }
.valeur-10-2013 .bandeau-valeur { background: #FFA99A; }
.valeur-20-2002 .bandeau-valeur { background: #8EA9DB; }
.valeur-20-2013 .bandeau-valeur { background: var(--secondary-color); }
.valeur-50-2002 .bandeau-valeur { background: #ff9800; }
.valeur-50-2013 .bandeau-valeur { background: #ffc107; }
.valeur-100-2002 .bandeau-valeur { background: #795548; }
.valeur-200-2002 .bandeau-valeur { background: #607d8b; }
.valeur-500-2002 .bandeau-valeur { background: var(--black); }

/* ===========================
   BADGES ÉTAT
=========================== */
.badge-etat, .badge-manquant {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 20;
}

.badge-etat {
    padding: 4px 8px;
    border-radius: 15px;
    font-size: var(--font-size-small);
    font-weight: bold;
    color: var(--white);
}

.badge-manquant {
    width: 18px;
    height: 18px;
    background: var(--danger-color);
    border-radius: var(--border-radius-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Couleurs des badges */
.badge-NEUF { background: var(--success-color); }
.badge-SPL { background: var(--secondary-color); }
.badge-SUP { background: var(--warning-color); color: var(--black); }
.badge-TTB { background: var(--orange-color); }
.badge-TB { background: var(--light-danger); }

/* ===========================
   POPUP DÉTAIL
=========================== */
.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.fiche {
    background: var(--white);
    border-radius: 15px;
    padding: 30px;
    width: 1000px;
    max-width: 90%;
    box-shadow: var(--box-shadow-popup);
    position: relative;
    animation: zoom var(--transition);
    max-height: 90vh;
    overflow: auto;
}

.images-fiche {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.images-fiche img, .fiche img {
    width: 400px;
    height: 200px;
    object-fit: contain;
    max-width: 400px;
    max-height: 200px;
}

#fermer {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 25px;
    border: 0;
    background: none;
    cursor: pointer;
}

.navigation button {
    padding: var(--padding-small) 25px;
    margin: 15px;
}

/* ===========================
   INFORMATIONS FICHE
=========================== */
.infos-fiche {
    margin-top: var(--padding);
    text-align: left;
}

.infos-fiche div {
    border-top: 1px solid var(--gray);
    padding: var(--padding-small) 0;
}

.infos-fiche span {
    display: block;
    font-size: var(--font-size-small);
    color: var(--text-light);
    text-transform: uppercase;
}

.infos-fiche strong {
    display: block;
    font-size: 14px;
    color: var(--primary-color);
    margin-top: 3px;
}

/* ===========================
   ANIMATION
=========================== */
@keyframes zoom {
    from {
        transform: scale(0.90);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===========================
   TOOLTIP
=========================== */
.tooltip {
    position: fixed;
    display: none;
    background: var(--white);
    padding: 12px 16px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-tooltip);
    pointer-events: none;
    z-index: 2000;
    min-width: 180px;
    font-size: var(--font-size-large);
    line-height: 1.5;
}

.tooltip strong {
    display: block;
    font-size: var(--font-size-title);
    color: var(--primary-color);
    margin-bottom: 8px;
}

/* ===========================
   BOUTONS
=========================== */
#reset, #modeAffichage {
    padding: var(--padding-small) 18px;
    border: 1px solid var(--gray);
    border-radius: 25px;
    background: var(--white);
    cursor: pointer;
    font-size: var(--font-size-large);
    margin: var(--margin-small);
    color: var(--primary-color);
    transition: var(--transition);
}

#reset:hover, #modeAffichage:hover {
    background: var(--primary-color);
    color: var(--white);
}

/* ===========================
   PROGRESSION COLLECTION
=========================== */
/* Styles pour la progression */
.progression {
    width: 350px;
    height: 16px;
    background: var(--gray);
    border-radius: 20px;
    margin: 12px auto 20px auto;
    overflow: hidden;
}

#barreProgression {
    height: 100%;
    width: 0;
    background: var(--secondary-color);
    border-radius: 20px;
    transition: width var(--transition-slow);
}

#texteProgression {
    margin-top: 8px;
    font-size: var(--font-size-medium);
    color: var(--primary-color);
    font-weight: bold;
    text-align: center;
    width: 100%;
}

#messageProgression {
    margin-top: 5px;
    font-size: var(--font-size-title);
    font-weight: bold;
    color: var(--primary-color);
    text-align: center;
    width: 100%;
}
/* ===========================
   MODE TABLEAU
=========================== */
.galerie.mode-tableau {
    display: block;
    width: 100%;
    padding: var(--padding);
    box-sizing: border-box;
    overflow-x: auto;
}

/* Tableau */
.tableau-billets {
    width: 100%;
    min-width: 1200px;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

/* Entêtes */
.tableau-billets th {
    background: var(--primary-color);
    color: var(--white);
    padding: 12px;
    font-size: var(--font-size-large);
    text-align: center;
    white-space: nowrap;
}

/* Cellules */
.tableau-billets td {
    padding: var(--padding-small);
    border-bottom: 1px solid var(--gray);
    text-align: center;
    font-size: var(--font-size-large);
}

/* Lignes */
.tableau-billets tr {
    cursor: pointer;
}

.tableau-billets tr:hover {
    background: var(--light-gray);
}

/* Images */
.tableau-billets img {
    width: 50px;
    height: 30px;
    object-fit: contain;
}

/* Largeur des colonnes */
.tableau-billets th:nth-child(1),
.tableau-billets td:nth-child(1) {
    width: 90px;
}    
    
/* 1 - Etat */
.tableau-billets th:nth-child(1),
.tableau-billets td:nth-child(1) {
    width: 80px;
}

/* 2 - Image */
.tableau-billets th:nth-child(2),
.tableau-billets td:nth-child(2) {
    width: 70px;
}

/* 3 - ID */
.tableau-billets th:nth-child(3),
.tableau-billets td:nth-child(3) {
    width: 55px;
}

/* 4 - Billet */
.tableau-billets th:nth-child(4),
.tableau-billets td:nth-child(4) {
    width: 140px;
}

/* 5 - Code court */
.tableau-billets th:nth-child(5),
.tableau-billets td:nth-child(5) {
    width: 80px;
}

/* 6 - Position */
.tableau-billets th:nth-child(6),
.tableau-billets td:nth-child(6) {
    width: 60px;
}

/* 7 - Pays */
.tableau-billets th:nth-child(7),
.tableau-billets td:nth-child(7) {
    width: 260px;
    min-width: 260px;
}

/* 8 - Signature */
.tableau-billets th:nth-child(8),
.tableau-billets td:nth-child(8) {
    width: 120px;
}

/* 9 - Charge */
.tableau-billets th:nth-child(9),
.tableau-billets td:nth-child(9) {
    width: 70px;
}

/* 10 - Hologramme */
.tableau-billets th:nth-child(10),
.tableau-billets td:nth-child(10) {
    width: 90px;
}

/* 11 - Cote */
.tableau-billets th:nth-child(11),
.tableau-billets td:nth-child(11) {
    width: 70px;
}

/* 12 - Note */
.tableau-billets th:nth-child(12),
.tableau-billets td:nth-child(12) {
    min-width: 350px;
}
/* ===========================
   COULEURS ÉTAT TABLEAU
=========================== */
.etat-tableau {
    font-weight: bold;
}

.etat-NEUF { color: var(--success-color); }
.etat-SPL { color: var(--secondary-color); }
.etat-SUP { color: #c49000; }
.etat-TTB { color: var(--orange-color); }
.etat-TB { color: var(--light-danger); }
.etat-vide { color: var(--danger-color); }

/* ===========================
   ZOOM IMAGES POPUP
=========================== */
.image-zoom {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.image-zoom.zoom-active {
    transform: scale(1.8);
    position: relative;
    z-index: 2000;
}

/* ===========================
   VISIONNEUSE IMAGE
=========================== */
.visionneuse {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.90);
    align-items: center;
    justify-content: center;
    z-index: 3000;
    cursor: pointer;
}

.visionneuse img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;

}

#fermerVisionneuse {
    position: absolute;
    top: 20px;
    right: 30px;
    color: var(--white);
    font-size: 45px;
    font-weight: bold;
    cursor: pointer;
}

/* ===========================
   DRAPEAUX
=========================== */
.drapeau {
    width: 24px !important;
    height: 16px !important;
    object-fit: cover;
    vertical-align: middle;
    display: inline-block;
    margin-right: var(--margin-small);
}

.pin .codecourt .drapeau {
    width: 20px !important;
    height: 13px !important;
}

/* =====================================================
   SELECT PERSONNALISÉ - PAYS
===================================================== */

.custom-select {
    position: relative;
    display: inline-block;
    width: 400px;
    margin: 5px;
    font-size: 14px;
    user-select: none;
}

.custom-select .selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: 1px solid var(--gray);
    border-radius: 25px;
    padding: 10px 15px;
    cursor: pointer;
    transition: 0.25s;
}

.custom-select .selected:hover {
    border-color: var(--secondary-color);
    box-shadow: 0 2px 8px rgba(25,118,210,.25);
}

.custom-select .selected .gauche {
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-select .selected img {
    width: 24px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
}

.custom-select .fleche {
    transition: transform .25s;
    font-size: 12px;
    color: #666;
}

.custom-select.ouvert .fleche {
    transform: rotate(180deg);
}

.custom-select .options {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 5px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,.18);
    overflow: hidden;
    display: none;
    z-index: 500;
    max-height: 320px;
    overflow-y: auto;
}

.custom-select.ouvert .options {
    display: block;
}

.custom-select .option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    cursor: pointer;
    transition: .20s;
}

.custom-select .option:hover {
    background: #eaf3ff;
}

.custom-select .option img {
    width: 24px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
}

.custom-select .option.active {
    background: #1976d2;
    color: white;
    font-weight: bold;
}

.custom-select .option.active::after {
    content: "✔";
    margin-left: auto;
}

.outils {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 5px;
    width: 100%;
}

.outils > * {
    margin: 0 !important;
    flex-shrink: 0;
}

.custom-select {
    display: block !important;
    width: auto !important;
}
/* Réduction hauteur bandeau supérieur */
header {
    padding: 2px 10px;
}

header h1 {
    margin: 2px 0;
    font-size: 18px;
}

.outils {
    margin-top: 3px;
}

.outils input,
.outils select {
    padding: 5px 10px;
    font-size: 13px;
}

.custom-select .selected {
    padding: 5px 10px;
}
.outils {
    margin-top: 3px !important;
}
#imagePrecedente,
#imageSuivante {
    background: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 25px;
    cursor: pointer;
    margin: 20px;
}

#imagePrecedente {
    left:30px;
}

#imageSuivante {
    right:30px;
}

.resultat-filtre {
    text-align: center;
    margin: 8px 20px 0 0;
    font-size: 15px;
    font-weight: bold;
    color: var(--text-red);
}

#rechercheAnnee {
    min-width: 150px;
}

.custom-select {
    width: 200px !important;
}








