* { box-sizing: border-box; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; padding: 20px; background-color: #f4f7f6; color: #333; line-height: 1.4; }
nav { margin-bottom: 20px; background: #fff; padding: 10px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
a { color: #007bff; text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; }

h1, h2, h3, h4 { margin-top: 0; margin-bottom: 10px; }
h2 { font-size: 1.4em; }
h4 { font-size: 0.9em; text-transform: uppercase; color: #666; margin: 0; }

.facet-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
    gap: 5px;
    margin-bottom: 8px;
    margin-top: 15px;
}

.facet-sort { display: flex; gap: 4px; }
.facet-sort a { 
    font-size: 0.65em; 
    padding: 1px 4px; 
    background: #eee; 
    color: #888; 
    border-radius: 3px; 
    text-decoration: none; 
    font-weight: bold;
    line-height: 1.2;
}
.facet-sort a:hover { background: #ddd; color: #333; }
.facet-sort a.active { background: #007bff; color: #fff; }

/* Buttons & Inputs */
.btn-primary { background: #007bff; color: #fff; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; }
.btn-reset { color: #666; font-size: 0.9em; margin-left: 10px; }
.sort-select { padding: 4px 8px; border-radius: 4px; border: 1px solid #ccc; background: #fff; font-size: 0.9em; }

/* Toolbar & Toggles */
.view-toggle { margin-bottom: 15px; display: flex; gap: 10px; }
.btn-toggle { padding: 5px 15px; border: 1px solid #007bff; background: #fff; color: #007bff; border-radius: 4px; cursor: pointer; }
.btn-toggle.active { background: #007bff; color: #fff; }

/* General Layout */
.main-content-wrapper {
    display: flex;
    flex-direction: row; /* Force l'affichage côte à côte */
    align-items: flex-start;
    gap: 20px;
    width: 100%;
}

/* Facet Column */
.facet-column {
    flex: 0 0 250px;
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px); /* Limite la hauteur à la fenêtre moins marges */
    overflow-y: auto; /* Permet le défilement interne */
}

/* Style discret pour les barres de défilement des facettes */
.facet-column::-webkit-scrollbar,
.facet-list::-webkit-scrollbar {
    width: 4px;
}
.facet-column::-webkit-scrollbar-thumb,
.facet-list::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

.facet-list { list-style: none; padding: 0; margin-bottom: 20px; max-height: 180px; overflow-y: auto; font-size: 0.85em; }
.facet-list li { margin-bottom: 4px; display: flex; align-items: center; }
.facet-list input { margin-right: 6px; flex-shrink: 0; }
.facet-list label { flex: 1; display: flex; align-items: center; cursor: pointer; }

.facet-count {
    margin-left: auto;
    background: #e8e8e8;
    color: #666;
    font-size: 0.85em;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 500;
}

.date-range { display: flex; align-items: center; gap: 5px; margin-bottom: 10px; }
.date-range input { width: 60px; padding: 3px; border: 1px solid #ccc; border-radius: 3px; }

/* Results Column */
.results-column { flex: 1; min-width: 0; }
.results-header { 
    margin-bottom: 15px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

/* Result Item & Actions */
.result-item { position: relative; }
.result-selector { margin-right: 10px; align-self: center; }
.result-actions { margin-top: 10px; border-top: 1px solid #eee; padding-top: 10px; display: flex; gap: 10px; }

.merge-bar { 
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); 
    background: #333; color: #fff; padding: 15px 30px; border-radius: 50px; 
    display: none; box-shadow: 0 4px 15px rgba(0,0,0,0.3); z-index: 1000;
    align-items: center; gap: 20px;
}

/* Result Content */
.result-item {
    display: flex;
    background: #fff;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    gap: 15px;
}
.result-content { flex: 1; }
.result-content h3 { font-size: 1.1em; margin-bottom: 4px; }
.edit-icon { font-size: 0.8em; margin-left: 8px; vertical-align: middle; text-decoration: none !important; cursor: pointer; }

/* Accentuation sobre par bordure latérale et fond teinté */
.result-item.is-numeric-numérique { 
    border-left: 6px solid #a93226; 
    background-color: #fffafa;
}
.result-item.is-numeric-physique { 
    border-left: 6px solid #5d6d7e; 
    background-color: #f8f9fa;
}

.result-content h3 a { color: #2e5984; font-weight: 600; }

.result-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.75em; color: #777; margin-bottom: 6px; }
.result-meta span { background: rgba(0,0,0,0.04); padding: 2px 6px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.03); }
.result-description { font-size: 0.85em; color: #555; margin: 0; word-break: break-word; }
.result-image img { 
    display: block;
    max-width: 80px !important; 
    max-height: 120px !important; 
    width: auto; /* Ensure aspect ratio is maintained */
    height: auto; /* Ensure aspect ratio is maintained */
    border-radius: 4px; border: 1px solid #eee; }

/* Grille des notices liées (vue Œuvres) */
.linked-records-grid { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 15px; padding: 10px; background: rgba(0,0,0,0.03); border-radius: 6px; }
.linked-record-item { width: 85px; font-size: 0.7em; line-height: 1.2; text-align: center; }
.linked-record-item img { 
    display: block; 
    max-width: 80px !important; 
    max-height: 120px !important; 
    width: auto;
    height: auto;
    margin: 0 auto 5px; 
    border: 1px solid #ddd; 
    border-radius: 3px; 
    background: #fff;
}
.linked-record-item a { color: #555; display: block; text-decoration: none; }
.linked-record-item a span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Pagination Styles */
.pagination { margin-top: 20px; display: flex; justify-content: center; gap: 5px; }
.pagination-link { padding: 4px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 0.9em; }
.pagination-link.active { background: #007bff; color: #fff; border-color: #007bff; }

/* Contrôles is_numeric */
.is-numeric-control { margin-top: 8px; display: flex; gap: 5px; align-items: center; }
.is-numeric-display { 
    display: inline-flex; 
    align-items: center; 
    font-size: 0.75em; 
    font-weight: bold; 
    padding: 2px 8px; 
    border-radius: 4px; 
    text-transform: capitalize;
}
.is-numeric-display.is-numeric-numérique { background: #ffebee; color: #A60000; border: 1px solid #ffcdd2; }
.is-numeric-display.is-numeric-physique { background: #f5f5f5; color: #333; border: 1px solid #e0e0e0; }

.clear-is-numeric { 
    background: none; 
    border: none; 
    color: inherit; 
    cursor: pointer; 
    margin-left: 5px; 
    font-size: 1.2em; 
    line-height: 1; 
    opacity: 0.5;
}
.clear-is-numeric:hover { opacity: 1; }

.set-is-numeric { 
    font-size: 0.7em; 
    padding: 2px 6px; 
    border: 1px solid #ddd; 
    background: #fff; 
    color: #888; 
    border-radius: 4px; 
    cursor: pointer;
}
.set-is-numeric:hover { background: #f0f0f0; border-color: #bbb; color: #333; }
.btn-numeric:hover { color: #A60000; border-color: #A60000; }
.btn-physique:hover { color: #000; border-color: #000; }
