/* ==========================================================================
   STYLE.CSS - VERSION FINALE (PRODUCTION 10.8 - OPTIMISATION HAUTEUR & HOVER)
   - Fix : Le fond au survol est désormais OPAQUE (#213232) pour éviter
     la transparence sous les colonnes sticky.
   - Fix : Augmentation de la max-height de .scroll-container (550px -> 75vh)
     pour utiliser tout l'espace vertical disponible sur la page objet.
   ========================================================================== */

/* --- 0. VARIABLES --- */
:root {
    --brand-dark: #2c3040;
    /* Sidebar & En-têtes */
    --brand-darker: #1f222e;
    /* Fond des Cartes & Tableaux */
    --bg-page: #15171e;
    /* Fond de Page */
    --brand-gradient: linear-gradient(160deg, #2c3040 0%, #1f222e 100%);
    --accent-blue: #3b82f6;
    --accent-green: #34c759;
    --accent-orange: #ff9500;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --border-subtle: rgba(255, 255, 255, 0.08);

    /* Stars Colors */
    --star-grey: #4b5563;
    --star-orange: #f97316;
    --star-green: #22c55e;
    --star-yellow: #eab308;
}

/* --- TRUST STARS SYSTEM --- */
.trust-stars {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.trust-stars.mini {
    gap: 2px;
}

.star {
    width: 20px;
    height: 20px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    cursor: help;
}

.trust-stars.mini .star {
    width: 16px;
    height: 16px;
}

/* SVG Shapes for Stars (using data URI for maximum portability) */
.star.grey-border {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%234b5563' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z' /%3E%3C/svg%3E");
}

.star.grey-full {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234b5563'%3E%3Cpath fill-rule='evenodd' d='M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.007 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006z' clip-rule='evenodd' /%3E%3C/svg%3E");
}

.star.orange-full {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23f97316'%3E%3Cpath fill-rule='evenodd' d='M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.007 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006z' clip-rule='evenodd' /%3E%3C/svg%3E");
}

.star.green-full {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2322c55e'%3E%3Cpath fill-rule='evenodd' d='M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.007 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006z' clip-rule='evenodd' /%3E%3C/svg%3E");
}

.star.yellow-full {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23eab308'%3E%3Cpath fill-rule='evenodd' d='M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.007 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006z' clip-rule='evenodd' /%3E%3C/svg%3E");
}

.star.yellow-half {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23eab308'%3E%3Cpath d='M12 14.593l-4.257 2.585 1.125-4.812-3.757-3.219 4.908-.393L12 4.269l2.106 4.406 4.908.393-3.757 3.219 1.125 4.812L12 14.593z'/%3E%3Cpath fill='%234b5563' d='M12 14.593V4.269l2.106 4.406 4.908.393-3.757 3.219 1.125 4.812L12 14.593z'/%3E%3C/svg%3E");
}

/* --- 1. GLOBAL --- */
html,
body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
}

* {
    box-sizing: border-box;
}

body {
    padding: 20px;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: 0.2s;
}

a:hover {
    color: #60a5fa;
    text-decoration: underline;
}

/* --- 2. NAVIGATION --- */
.main-nav {
    background: var(--brand-gradient);
    border-radius: 18px;
    padding: 15px 25px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-subtle);
    color: #fff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.main-nav .nav-links {
    display: flex;
    gap: 10px;
    align-items: center;
}

.main-nav a.nav-item {
    color: var(--text-muted);
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95em;
    transition: all 0.2s;
}

.main-nav a.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.main-nav a.nav-item.active {
    background: linear-gradient(90deg, #007aff 0%, #0056b3 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.4);
}

.main-nav .nav-user {
    padding-left: 20px;
    border-left: 1px solid var(--border-subtle);
    display: flex;
    gap: 15px;
    align-items: center;
    font-size: 0.95em;
    color: var(--text-muted);
}

.nav-avatar-mini {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: var(--brand-dark);
    object-fit: cover;
}

/* --- 3. LAYOUT --- */
.page-wrapper {
    display: grid;
    /* On force la colonne de gauche à exister même si la sidebar sort du flux */
    grid-template-columns: 280px 1fr;
    grid-template-rows: 1fr;
    gap: 25px;
    align-items: stretch;
    flex: 1;
    min-height: 0;
    height: calc(100vh - 140px);
    position: relative;
    /* Référence pour le fixed */
}

/* Si la sidebar est étendue (fixed), elle sort du flux grid. 
   Le main-content risquerait de glisser à gauche (col 1).
   On force le main-content à rester en col 2 */
.page-wrapper:has(.sidebar.expanded) .main-content {
    grid-column: 2;
}

.main-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.info-column {
    min-width: 0;
    /* CRITICAL: Prevents wide content (matrix/logs) from stretching the column */
}

/* --- 4. SIDEBAR --- */
.sidebar {
    background: var(--brand-gradient);
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    border: 1px solid var(--border-subtle);
    transition: width 1.5s cubic-bezier(0.4, 0.0, 0.2, 1), box-shadow 1.0s ease;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 20px 0;
    overflow: hidden;
    position: relative;
    z-index: 1000;
    width: 280px;
    /* Fixe pour éviter le saut 100%->Viewport en mode fixed */
}

.sidebar.expanded {
    width: 60vw !important;
    position: fixed;
    top: 145px;
    left: 20px;
    height: calc(100vh - 165px);
    /* Hauteur calculée pour rester dans le viewport */
    z-index: 9999;
    /* Toujours au dessus */
    background: rgba(26, 29, 39, 0.98);
    box-shadow: 30px 0 80px rgba(0, 0, 0, 0.8);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 18px;
    /* On garde les bords arrondis */
}

/* Bouton d'extension de la sidebar */
.sidebar-expand-trigger {
    position: absolute;
    right: 45px;
    /* Décalé à gauche pour ne pas chevaucher la flèche toggle */
    top: 18px;
    cursor: pointer;
    font-size: 1.1em;
    opacity: 0.5;
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 20;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-expand-trigger:hover {
    opacity: 1;
    color: var(--accent-blue);
    transform: scale(1.1);
}

.sidebar.expanded .sidebar-expand-trigger {
    transform: rotate(180deg);
    opacity: 1;
    color: var(--accent-blue);
}

.sidebar.collapsible .sidebar-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 15px 20px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    z-index: 10;
    background: transparent;
}

.sidebar h2 {
    font-size: 1.2em;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.sidebar-toggle-icon {
    font-size: 0.8em;
    color: var(--text-muted);
    transition: transform 0.3s;
}

.sidebar.collapsible.open .sidebar-toggle-icon {
    transform: rotate(180deg);
    color: #fff;
}

.sidebar.collapsible .sidebar-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.sidebar.collapsible.open .sidebar-content {
    opacity: 1;
    flex: 1;
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding: 5px 20px 20px 20px;
    /* Réduit le padding haut */
}

/* --- COLLAPSIBLE FILTER GROUPS (Natures, etc.) --- */
.collapsible-filter-group {
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
    transition: all 0.3s ease;
}

.collapsible-filter-group.active {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.collapsible-filter-header {
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.collapsible-filter-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.collapsible-filter-header label {
    margin: 0;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.collapsible-filter-group.active .collapsible-filter-header label {
    color: #fff;
}

.collapsible-filter-header .chevron {
    font-size: 0.7em;
    opacity: 0.4;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.collapsible-filter-group.active .collapsible-filter-header .chevron {
    transform: rotate(180deg);
    opacity: 0.8;
}

.collapsible-filter-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.collapsible-filter-group.active .collapsible-filter-content {
    max-height: 1200px;
    /* Assez grand pour les natures */
    opacity: 1;
    padding: 5px 15px 15px 15px;
}

/* Adaptation du layout des natures dans la sidebar */
.sidebar .nature-quick-filters {
    display: flex !important;
    flex-wrap: wrap !important;
    grid-template-rows: none !important;
    grid-template-columns: none !important;
    grid-auto-flow: row !important;
    gap: 10px !important;
    padding: 0 !important;
    overflow-x: hidden !important;
}

.sidebar .nature-chip {
    flex: 1 1 calc(50% - 10px);
    min-width: 140px;
    max-width: 100%;
}

.sidebar.expanded .nature-chip {
    flex: 0 1 auto;
    min-width: 200px;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.filter-active-label {
    color: var(--accent-orange) !important;
}

input[type="text"],
input[type="number"],
textarea,
select {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    font-size: 0.95em;
    padding: 10px 12px;
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-subtle);
    width: 100%;
    box-sizing: border-box;
    color: #fff;
    height: 45px;
    transition: color 0.3s ease, border-color 0.3s ease;
}

input.has-value, 
textarea.has-value, 
select.has-value {
    color: #34c759 !important;
    font-weight: 700;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent-blue);
    outline: none;
    background-color: rgba(0, 0, 0, 0.3);
}

/* FIX: Ensure text is readable (white) even with Browser Autofill or Datalist */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-text-fill-color: #ffffff !important;
    -webkit-box-shadow: 0 0 0 30px rgba(44, 48, 64, 0.95) inset !important;
    /* Matches brand-dark */
    transition: background-color 5000s ease-in-out 0s;
    caret-color: #fff;
}

input[list]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    /* Make datalist arrow white */
}

textarea {
    height: auto;
    min-height: 80px;
    resize: vertical;
}

.btn-filter {
    background: linear-gradient(90deg, #007aff 0%, #0056b3 100%);
    color: #fff;
    padding: 12px;
    border-radius: 10px;
    border: none;
    width: 100%;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s;
}

.btn-filter:hover {
    transform: translateY(-1px);
}

.btn-reset {
    display: block;
    text-align: center;
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.9em;
}

/* Slider */
.range-slider-container {
    position: relative;
    height: 45px;
    padding-top: 10px;
}

.sidebar .range-values {
    display: flex;
    justify-content: space-between;
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.slider-track {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    position: absolute;
    top: 35px;
    border-radius: 5px;
}

.slider-track-active {
    position: absolute;
    height: 5px;
    background: var(--accent-blue);
    top: 35px;
    z-index: 2;
    border-radius: 5px;
}

.range-input {
    position: absolute;
    width: 100%;
    top: 33px;
    pointer-events: none;
    appearance: none;
    background: none;
    z-index: 3;
    border: none;
    height: auto;
    padding: 0;
}

.range-input::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    pointer-events: auto;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* --- 5. HEADER CONTENU --- */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 25px;
    background: var(--brand-gradient);
    border-radius: 18px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.results-count {
    font-weight: 600;
    font-size: 1.1em;
    color: #fff;
}

/* Boutons Action */
.add-button,
.bulk-edit-button {
    height: 45px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 25px;
    font-family: inherit;
    font-size: 0.95em;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

.add-button {
    background-color: var(--accent-green);
}

.bulk-edit-button {
    background-color: #5856d6;
}

.add-button:hover,
.bulk-edit-button:hover {
    transform: translateY(-2px);
}

.bulk-actions-bar {
    display: none;
    background: #fff;
    padding: 15px 20px;
    margin-bottom: 25px;
    border-radius: 12px;
    color: #333;
    justify-content: space-between;
    align-items: center;
    animation: slideDown 0.3s ease-out;
    flex-shrink: 0;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- 6. TABLEAUX & EFFETS HOVER "LIQUID GLASS" --- */
.table-card {
    background: var(--brand-darker);
    border-radius: 18px;
    border: 1px solid var(--border-subtle);
    width: 100%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.table-wrapper {
    flex: 1;
    overflow: auto;
    width: 100%;
    position: relative;
}

table {
    width: 100%;
    border-spacing: 0;
    table-layout: fixed;
    min-width: 1000px;
}

th {
    font-weight: 600;
    position: sticky;
    top: 0;
    background-color: var(--brand-dark);
    z-index: 100;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.9em;
    text-align: left !important;
    padding: 15px 10px;
    text-transform: uppercase;
    white-space: normal;
    vertical-align: bottom;
    line-height: 1.2;
}

td {
    padding: 13px 10px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.95em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
    vertical-align: middle;
    height: 50px;
    background-color: var(--brand-darker);
}

tbody tr:nth-child(even) td {
    background-color: var(--brand-darker);
}

tbody tr:nth-child(even) {
    background-color: transparent;
}

.resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    cursor: col-resize;
    user-select: none;
    height: 100%;
    z-index: 150;
    opacity: 0;
    transition: opacity 0.2s;
}

th:hover .resizer {
    opacity: 1;
    background-color: var(--accent-blue);
}

/* --- NOUVEAU STYLE DE SURVOL CORRIGÉ (V10.7) --- */
tr.main-row {
    cursor: pointer;
    transition: background-color 0.15s;
}

tr.main-row:hover td,
tr.main-row:hover .sticky-col {
    /* FIX : Fond OPAQUE (#213232) pour empêcher la transparence du texte qui défile dessous */
    background-color: #213232 !important;

    /* Bordures Haut et Bas uniquement */
    border-top: 1px solid rgba(52, 199, 89, 0.3) !important;
    border-bottom: 1px solid rgba(52, 199, 89, 0.3) !important;

    box-shadow: none !important;
    color: #fff !important;
}

/* La barre verte verticale sur la première cellule uniquement */
tr.main-row:hover td:first-child {
    box-shadow: inset 4px 0 0 #34c759 !important;
}

/* --- IMPORTANT : FORCE L'OPACITÉ DU DERNIER ÉLÉMENT STICKY --- */
#mancolisteTable td:last-child,
#catalogueTable td:last-child,
#collectionTable td:last-child {
    background-color: var(--brand-darker) !important;
    /* Force l'opacité */
    z-index: 150;
    /* Au-dessus du reste */
}

/* Au survol, on garde le fond opaque mais on change la couleur */
tr.main-row:hover #mancolisteTable td:last-child,
tr.main-row:hover #catalogueTable td:last-child,
tr.main-row:hover #collectionTable td:last-child {
    background-color: #213232 !important;
    /* RESTE OPAQUE */
    border-top: 1px solid rgba(52, 199, 89, 0.3) !important;
    border-bottom: 1px solid rgba(52, 199, 89, 0.3) !important;
}

/* On conserve l'ombre portée pour la dernière colonne figée de gauche */
tr.main-row:hover .sticky-col-last {
    box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.5) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- 7. COLONNES CATALOGUE --- */
.col-checkbox,
#catalogueTable th:nth-child(1),
#catalogueTable td:nth-child(1) {
    width: 40px;
    display: none;
}

/* Largeurs fixes pour les colonnes figées */
#catalogueTable th:nth-child(2),
#catalogueTable td:nth-child(2) {
    width: 50px;
    text-align: center !important;
}

/* Image */
#catalogueTable th:nth-child(3),
#catalogueTable td:nth-child(3) {
    width: 90px;
}

/* Pays */
#catalogueTable th:nth-child(4),
#catalogueTable td:nth-child(4) {
    width: 60px;
}

/* N° Y&T */
#catalogueTable th:nth-child(5),
#catalogueTable td:nth-child(5) {
    width: 50px;
    text-align: center;
}

/* Année */
#catalogueTable th:nth-child(6),
#catalogueTable td:nth-child(6) {
    width: 80px;
}

/* Nature */
#catalogueTable th:nth-child(7),
#catalogueTable td:nth-child(7) {
    width: 100px;
    text-align: right !important;
    padding-right: 15px;
}

/* Val. Faciale */

/* CONFIGURATION STICKY */
#catalogueTable th:nth-child(-n+7),
#catalogueTable td:nth-child(-n+7) {
    position: sticky;
}

/* Z-INDEX */
#catalogueTable th:nth-child(-n+7) {
    z-index: 200;
    background-color: var(--brand-dark);
}

#catalogueTable td:nth-child(-n+7) {
    z-index: 100;
    background-color: var(--brand-darker);
}

#catalogueTable th:nth-child(-n+7),
#catalogueTable td:nth-child(-n+7) {
    box-shadow: none;
}

/* COLONNES SCROLLABLES */
#catalogueTable th:nth-child(8) {
    width: 100px;
}

/* Variété */
#catalogueTable th:nth-child(9) {
    width: 100px;
}

/* Série */
#catalogueTable th:nth-child(10) {
    width: 300px;
    min-width: 200px;
}

/* Sujet */

#catalogueTable th:nth-child(11),
#catalogueTable td:nth-child(11),
#catalogueTable th:nth-child(12),
#catalogueTable td:nth-child(12),
#catalogueTable th:nth-child(13),
#catalogueTable td:nth-child(13),
#catalogueTable th:nth-child(14),
#catalogueTable td:nth-child(14) {
    width: 70px;
    text-align: right !important;
    padding-right: 15px;
}

/* Colonne Actions */
#catalogueTable th:last-child,
#catalogueTable td:last-child {
    position: sticky;
    right: 0;
    width: 160px;
    min-width: 160px;
    z-index: 120;
    box-shadow: -5px 0 10px -5px rgba(0, 0, 0, 0.5);
}

#catalogueTable th:last-child {
    background-color: var(--brand-dark);
    z-index: 130;
    text-align: center !important;
}

#catalogueTable td:last-child {
    background-color: var(--brand-darker);
    text-align: center;
    text-overflow: clip !important;
}

tbody tr:nth-child(even) #catalogueTable td:last-child {
    background-color: var(--brand-darker);
}

/* --- 8. COLONNES COLLECTION --- */
.col-checkbox,
#collectionTable th:nth-child(1),
#collectionTable td:nth-child(1) {
    width: 40px;
    display: none;
}

/* Largeurs fixes */
#collectionTable th:nth-child(2),
#collectionTable td:nth-child(2) {
    width: 60px;
    text-align: center !important;
}

#collectionTable th:nth-child(3),
#collectionTable td:nth-child(3) {
    width: 110px;
}

#collectionTable th:nth-child(4),
#collectionTable td:nth-child(4) {
    width: 70px;
}

#collectionTable th:nth-child(5),
#collectionTable td:nth-child(5) {
    width: 70px;
    text-align: center;
}

#collectionTable th:nth-child(6),
#collectionTable td:nth-child(6) {
    width: 100px;
}

#collectionTable th:nth-child(7),
#collectionTable td:nth-child(7) {
    width: 100px;
    text-align: right !important;
    padding-right: 10px;
}

/* Sticky */
#collectionTable th:nth-child(-n+7),
#collectionTable td:nth-child(-n+7) {
    position: sticky;
}

#collectionTable th:nth-child(-n+7) {
    z-index: 200;
    background-color: var(--brand-dark);
}

#collectionTable td:nth-child(-n+7) {
    z-index: 100;
    background-color: var(--brand-darker);
}

.sticky-col-last {
    box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.5) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

#collectionTable th:nth-child(-n+7),
#collectionTable td:nth-child(-n+7) {
    box-shadow: none;
}

tbody tr:nth-child(even) #collectionTable td:nth-child(-n+7) {
    background-color: var(--brand-darker);
}

/* Colonnes Scrollables */
#collectionTable th:nth-child(8) {
    width: 120px;
}

#collectionTable th:nth-child(9) {
    width: 120px;
}

#collectionTable th:nth-child(10) {
    width: 250px;
    min-width: 200px;
    text-align: left !important;
}

#collectionTable th:nth-child(n+11) {
    width: 110px;
}

#collectionTable th:nth-child(12) {
    width: 60px;
    text-align: center;
}

#collectionTable th:nth-child(15),
#collectionTable td:nth-child(15),
#collectionTable th:nth-child(17),
#collectionTable td:nth-child(17),
#collectionTable th:nth-child(18),
#collectionTable td:nth-child(18) {
    text-align: right !important;
    padding-right: 10px;
}

/* Colonne Actions */
#collectionTable th:last-child,
#collectionTable td:last-child {
    position: sticky;
    right: 0;
    width: 160px;
    min-width: 160px;
    z-index: 120;
    box-shadow: -5px 0 10px -5px rgba(0, 0, 0, 0.5);
}

#collectionTable th:last-child {
    background-color: var(--brand-dark);
    z-index: 130;
    text-align: center !important;
}

#collectionTable td:last-child {
    background-color: var(--brand-darker);
    text-align: center;
    text-overflow: clip !important;
}

tbody tr:nth-child(even) #collectionTable td:last-child {
    background-color: var(--brand-darker);
}

/* --- 9. COLONNES MANCOLISTE --- */
#mancolisteTable th:nth-child(1) {
    width: 40px;
    display: none;
}

#mancolisteTable th:nth-child(2),
#mancolisteTable td:nth-child(2) {
    width: 50px;
    text-align: center !important;
}

#mancolisteTable th:nth-child(3),
#mancolisteTable td:nth-child(3) {
    width: 90px;
}

#mancolisteTable th:nth-child(4),
#mancolisteTable td:nth-child(4) {
    width: 60px;
}

#mancolisteTable th:nth-child(5),
#mancolisteTable td:nth-child(5) {
    width: 50px;
    text-align: center;
}

#mancolisteTable th:nth-child(6),
#mancolisteTable td:nth-child(6) {
    width: 80px;
}

#mancolisteTable th:nth-child(7),
#mancolisteTable td:nth-child(7) {
    width: 100px;
    text-align: right !important;
    padding-right: 15px;
}

#mancolisteTable th:nth-child(-n+7),
#mancolisteTable td:nth-child(-n+7) {
    position: sticky;
}

#mancolisteTable th:nth-child(-n+7) {
    z-index: 200;
    background-color: var(--brand-dark);
}

#mancolisteTable td:nth-child(-n+7) {
    z-index: 100;
    background-color: var(--brand-darker);
}

#mancolisteTable th:nth-child(-n+7),
#mancolisteTable td:nth-child(-n+7) {
    box-shadow: none;
}

#mancolisteTable th:nth-child(8) {
    width: 100px;
}

#mancolisteTable th:nth-child(9) {
    width: 100px;
}

#mancolisteTable th:nth-child(10) {
    width: 300px;
    min-width: 200px;
}

#mancolisteTable th:nth-child(11),
#mancolisteTable td:nth-child(11),
#mancolisteTable th:nth-child(12),
#mancolisteTable td:nth-child(12) {
    width: 70px;
    text-align: right !important;
    padding-right: 15px;
}

#mancolisteTable th:last-child,
#mancolisteTable td:last-child {
    position: sticky;
    right: 0;
    width: 100px;
    min-width: 100px;
    z-index: 120;
    box-shadow: -5px 0 10px -5px rgba(0, 0, 0, 0.5);
}

#mancolisteTable th:last-child {
    background-color: var(--brand-dark);
    z-index: 130;
    text-align: center !important;
}

#mancolisteTable td:last-child {
    background-color: var(--brand-darker);
    text-align: center;
    text-overflow: clip !important;
}

tbody tr:nth-child(even) #mancolisteTable td:last-child {
    background-color: var(--brand-darker);
}

/* --- 10. ACCORDÉON & INTERACTIONS --- */
tbody tr.main-row {
    cursor: pointer;
    transition: background-color 0.15s;
}

/* Le hover est géré plus haut pour l'effet Liquid Glass */

/* --- 11. PAGINATION --- */
.pagination-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 10px 20px;
    border-top: 1px solid var(--border-subtle);
    background-color: var(--brand-darker);
    backdrop-filter: blur(10px);
    position: sticky;
    bottom: 0;
    z-index: 100;
    flex-shrink: 0;
}

.pagination-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.per-page-container,
.goto-page-form {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.per-page-container label,
.goto-page-form label {
    font-size: 0.9rem;
    font-weight: 400;
    color: #a0aec0;
}

.pagination-container select,
.pagination-container input[type="number"] {
    background: #2d3748;
    border: 1px solid #4a5568;
    color: #fff;
    height: 30px;
    border-radius: 6px;
    padding: 0 8px;
    font-size: 0.9rem;
    outline: none;
    box-sizing: border-box;
}

.goto-page-form button {
    height: 30px;
    padding: 0 12px;
    background: #4a5568;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    margin-left: 2px;
    display: inline-flex;
    align-items: center;
}

.pagination-links {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 5px;
}

.pagination-links a,
.pagination-links span.current-page {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 30px;
    height: 30px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    box-sizing: border-box;
}

.pagination-links a {
    border: 1px solid #2d3748;
    color: #a0aec0;
    background: transparent;
}

.pagination-links a:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: #4a5568;
    color: #fff;
}

.pagination-links span.current-page {
    background-color: #4299e1;
    color: white;
    border: 1px solid #4299e1;
}

.pagination-links span.dots {
    color: #a0aec0;
    padding: 0 2px;
    font-size: 1rem;
}

/* --- 12. DIVERS --- */
.message-box {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 15px 30px;
    border-radius: 12px;
    font-weight: 600;
    text-align: center;
    animation: slideDown 0.5s ease-out;
    background-color: rgba(34, 197, 94, 0.95);
    color: #ffffff;
    border: 1px solid #22c55e;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    min-width: 300px;
}

/* --- 13. UNIFIED GALLERY & IMAGE UPLOAD --- */
.unified-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.unified-gallery-grid.active {
    display: grid !important;
}

.gallery-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

.gallery-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.gallery-card .img-box {
    height: 140px;
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gallery-card .img-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.gallery-card .card-details {
    padding: 10px;
}

.gallery-card .file-name {
    font-size: 0.85em;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.gallery-card .comment-field {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8em;
    color: #fff;
    margin-bottom: 5px;
}

.gallery-card .card-actions {
    padding: 0 10px 10px;
    display: flex;
    justify-content: flex-end;
}

.gallery-card .delete-toggle {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.gallery-card .delete-toggle:hover {
    opacity: 1;
}

.gallery-card .delete-toggle input {
    display: none;
}

/* Feedback visuel suppression */
.gallery-card.marked-for-delete {
    opacity: 0.7;
    filter: grayscale(100%);
    border: 1px solid var(--danger-color, #ef4444);
}

.gallery-card.marked-for-delete .img-box {
    position: relative;
}

.gallery-card.marked-for-delete .img-box::after {
    content: "SUPPRIMER";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    background: rgba(239, 68, 68, 0.9);
    color: white;
    padding: 5px 10px;
    font-weight: bold;
    font-size: 0.9em;
    border-radius: 4px;
    border: 2px solid white;
    z-index: 10;
}

.gallery-card.marked-for-delete .card-details {
    opacity: 0.3;
}

.modal-overlay {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    justify-content: center;
    align-items: center;
}

.modal-content {
    max-width: 90vw;
    max-height: 90vh;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
}

/* ==========================================================================
   LIQUID GLASS MODALS
   ========================================================================== */
.confirm-modal,
.modal-bulk-edit {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.confirm-box,
.modal-bulk-content {
    background: linear-gradient(135deg, rgba(31, 34, 46, 0.95), rgba(31, 34, 46, 0.75));
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 28px;
    width: 650px;
    max-width: 95vw;
    padding: 35px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    color: var(--text-main);
    animation: popInGlass 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
}

@keyframes popInGlass {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Glass Variants */
.confirm-box.danger,
.modal-bulk-content.danger {
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.15), 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.confirm-box.success,
.modal-bulk-content.success {
    border-color: rgba(52, 199, 89, 0.5);
    box-shadow: 0 0 30px rgba(52, 199, 89, 0.15), 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.confirm-box.warning,
.modal-bulk-content.warning {
    border-color: rgba(255, 149, 0, 0.5);
    box-shadow: 0 0 30px rgba(255, 149, 0, 0.15), 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.confirm-box.primary,
.modal-bulk-content.primary {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.15), 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.confirm-title,
.modal-bulk-header h2 {
    font-size: 1.5em;
    font-weight: 800;
    margin-bottom: 15px;
    color: #fff;
    letter-spacing: -0.02em;
}

.confirm-text,
.modal-bulk-body p {
    font-size: 1.05em;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin-bottom: 30px;
}

.confirm-buttons,
.modal-bulk-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-btn,
.modal-bulk-footer button {
    padding: 12px 24px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-confirm-cancel,
.cancel-button {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.btn-confirm-cancel:hover,
.cancel-button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-confirm-danger,
.apply-button.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-confirm-primary,
.apply-button.primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-confirm-success,
.apply-button.success {
    background: linear-gradient(135deg, #34c759 0%, #28a745 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3);
}

.btn-confirm-warning,
.apply-button.warning {
    background: linear-gradient(135deg, #ff9500 0%, #ea580c 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
}

.modal-btn:hover,
.modal-bulk-footer button:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* --- 13. PAGE OBJET (LAYOUT ROBUSTE & FIXE) --- */
.center-wrapper {
    width: 95%;
    margin: 0 auto;
    padding-bottom: 40px;
}

.objet-card {
    background-color: var(--brand-darker);
    border-radius: 18px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    color: var(--text-main);
    width: 100%;
    box-sizing: border-box;
}

.objet-header {
    background: var(--brand-gradient);
    padding: 30px 40px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    color: #ffffff;
}

.title-block h1 {
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -0.5px;
    color: #ffffff;
    line-height: 1.3;
}

.title-block h2 {
    margin: 6px 0 0 0;
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    line-height: 1.4;
}

.title-block h3 {
    margin: 8px 0 0 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #fbbf24;
    line-height: 1.2;
}

.grid-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 40px;
    padding: 40px;
    align-items: start;
    min-height: 600px;
}

.details-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.image-column {
    width: 350px;
    position: sticky;
    top: 20px;
    text-align: center;
}

.stamp-frame {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 350px;
    height: auto;
    min-height: 450px;
    box-sizing: border-box;
}

.stamp-image {
    max-width: 100%;
    max-height: 500px;
    height: auto;
    display: block;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    cursor: zoom-in;
}

.no-visual-text {
    color: var(--text-muted);
    font-size: 0.9em;
    text-align: center;
    border: 2px dashed var(--border-subtle);
    border-radius: 8px;
    padding: 40px 20px;
    width: 80%;
}

.tab-nav {
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 30px;
    display: flex;
    gap: 30px;
}

.tab-link {
    background: none;
    border: none;
    padding: 15px 0;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.tab-link:hover {
    color: #fff;
}

.tab-link.active {
    color: var(--accent-blue);
}

.tab-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--accent-blue);
    border-radius: 3px 3px 0 0;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

.icon-folder-green {
    filter: hue-rotate(70deg) saturate(1.5) brightness(1.2);
    display: inline-block;
}

.message-box-objet {
    background-color: rgba(52, 199, 89, 0.2);
    border: 1px solid #34c759;
    color: #ffffff;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
    animation: slideDown 0.5s ease-out;
}

/* CONTENEUR SCROLLABLE ONGLET (FIX SCROLL) */
.scroll-container {
    overflow-y: auto;
    overflow-x: auto;
    /* Allow horizontal scroll if content (like wide tables) exceeds column width */
    max-width: 100%;
    /* CRITICAL: Ensures container respects parent width */
    /* MODIF V10.8 : Utilisation de vh pour maximiser l'espace sur l'écran */
    max-height: 75vh;
    padding-right: 5px;
    scrollbar-width: thin;
    border-bottom: 1px solid var(--border-subtle);
}

.scroll-container::-webkit-scrollbar {
    width: 6px;
}

.scroll-container::-webkit-scrollbar-thumb {
    background-color: var(--border-subtle);
    border-radius: 3px;
}

.scroll-container::-webkit-scrollbar-track {
    background: transparent;
}


.family-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

.family-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
}

.family-item:hover {
    transform: translateY(-3px);
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.05);
}

.family-item.current {
    border: 2px solid var(--accent-green);
    background: rgba(52, 199, 89, 0.1);
}

.family-item-image {
    height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
}

.family-item-image img {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.family-no-visual {
    width: 80%;
    height: 60%;
    border: 1px dashed var(--border-subtle);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.8em;
    text-align: center;
}

.family-item-details {
    padding: 12px;
    text-align: center;
    border-top: 1px solid var(--border-subtle);
}

/* --- 14. SELECT2 DARK THEME --- */
.select2-container--default .select2-selection--multiple,
.select2-container--default .select2-selection--single {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: 8px !important;
    min-height: 45px !important;
    display: flex !important;
    align-items: center;
}

.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    padding: 0 6px;
    display: block;
    width: 100%;
}

/* Dashboard Loading State */
.dashboard-container {
    transition: opacity 0.3s ease;
}

.dashboard-container.loading-fade {
    opacity: 0.5;
    pointer-events: none;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--accent-blue) !important;
    border: none !important;
    color: white !important;
    border-radius: 4px !important;
    padding: 5px 8px !important;
    margin-top: 6px !important;
    margin-right: 5px !important;
    font-size: 0.9em;
    display: inline-flex !important;
    flex-direction: row-reverse !important;
    align-items: center !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    position: static !important;
    color: #ff6b6b !important;
    font-weight: bold !important;
    margin-right: 0 !important;
    margin-left: 8px !important;
    border: none !important;
    border-left: 1px solid rgba(255, 255, 255, 0.3) !important;
    padding-left: 6px !important;
    background-color: transparent !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #ff0000 !important;
    background-color: rgba(0, 0, 0, 0.1) !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__clear {
    display: none !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #ffffff !important;
    line-height: 45px !important;
    padding-left: 12px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 43px !important;
    top: 1px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #aaa transparent transparent transparent !important;
}

.select2-container--default .select2-selection--single .select2-selection__clear {
    color: #ffffff !important;
    margin-right: 25px;
    line-height: 45px;
}

.select2-dropdown {
    background-color: var(--brand-dark) !important;
    border: 1px solid var(--border-subtle) !important;
    color: white !important;
    z-index: 9999;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--accent-blue) !important;
    color: white !important;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: rgba(59, 130, 246, 0.3) !important;
}

.select2-search__field {
    color: white !important;
    margin-top: 5px !important;
}

/* --- ZOOM & MODALS --- */
.modal-content.zoomable {
    transition: transform 0.1s ease-out;
    cursor: zoom-in;
}

.modal-content.zoomable:hover {
    cursor: crosshair;
}

.modal-bulk-edit {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
    justify-content: center;
    align-items: center;
}

.modal-bulk-content {
    background: var(--brand-darker);
    border-radius: 28px;
    width: 900px;
    max-width: 95vw;
    color: var(--text-main);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
}

.modal-bulk-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--brand-dark);
}

.modal-bulk-header h2 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 700;
    color: #fff;
}

.modal-bulk-body {
    padding: 30px;
}

.modal-bulk-footer {
    padding: 20px;
    background: var(--brand-dark);
    text-align: right;
    border-top: 1px solid var(--border-subtle);
}

.modal-bulk-footer button {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    margin-left: 10px;
    font-size: 0.95em;
    transition: 0.2s;
}

.cancel-button {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid transparent;
}

.cancel-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.apply-button {
    background: var(--accent-blue);
    color: #fff;
}

.apply-button:hover {
    background: #0056b3;
}

.modal-bulk-body .form-group {
    margin-bottom: 25px;
}

.modal-bulk-body label {
    margin-bottom: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
}

.modal-bulk-body select,
.modal-bulk-body input:not([type="checkbox"]) {
    background-color: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid var(--border-subtle) !important;
    color: #fff !important;
    width: 100% !important;
    padding: 14px 18px !important;
    border-radius: 12px !important;
    font-size: 1.1rem !important;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-bulk-body select:focus,
.modal-bulk-body input:focus {
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2) !important;
}

.modal-bulk-body select option {
    background-color: #1f222e !important;
    color: #fff !important;
    padding: 10px;
}

.thumbnail {
    max-height: 30px;
    width: auto;
    max-width: 40px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: block;
    margin: 0 auto;
    cursor: zoom-in;
}

.action-icon {
    font-size: 1.1em;
    margin: 0 3px;
    display: inline-block;
    transition: transform 0.2s;
}

.action-icon:hover {
    transform: scale(1.2);
}

.action-icon.add {
    color: var(--accent-green);
}

.action-icon.mancoliste {
    color: var(--accent-orange);
}

.action-icon.propose {
    color: var(--accent-blue);
}

.action-icon.delete {
    color: #ef4444;
}

.statut-text {
    font-size: 0.8em;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
}

.statut-public {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.statut-prive {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
}

.statut-attente {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
}

.statut-banni {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Responsive */
@media (max-width: 1024px) {
    .page-wrapper {
        grid-template-columns: 1fr;
        height: auto !important;
    }

    .sidebar {
        position: static;
        max-height: none;
        margin-bottom: 20px;
    }

    .content-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .details-wrapper {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .main-nav {
        flex-direction: column;
        gap: 15px;
        padding: 20px;
    }

    .main-nav .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .main-nav .nav-user {
        border-left: none;
        border-top: 1px solid var(--border-subtle);
        padding-top: 15px;
        padding-left: 0;
        width: 100%;
        justify-content: center;
    }
}

/* --- TOAST NOTIFICATIONS (LIQUID GLASS style) --- */
.toast-container {
    position: fixed;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    pointer-events: none;
}

.toast {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.75));
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.6),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 18px 36px;
    border-radius: 20px;
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 15px;
    animation: slideDownToast 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    pointer-events: auto;
    letter-spacing: -0.2px;
}

.toast.is-leaving {
    opacity: 0;
    transform: translateY(-20px) scale(0.92);
    filter: blur(10px);
}

@keyframes slideDownToast {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.toast.success {
    border-left: 6px solid #34c759;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(52, 199, 89, 0.2);
}

.toast.error {
    border-left: 6px solid #ff3b30;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 59, 48, 0.2);
}

.toast.info {
    border-left: 6px solid #007aff;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 122, 255, 0.2);
}

.toast.fade-out {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
}

/* --- 20. SELECT2 DARK THEME OVERRIDES --- */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: 8px !important;
    height: 45px !important;
    display: flex !important;
    align-items: center !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #fff !important;
    padding-left: 12px !important;
    padding-right: 20px !important;
    line-height: normal !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 43px !important;
    right: 5px !important;
}

.select2-dropdown {
    background-color: var(--brand-darker) !important;
    border: 1px solid var(--border-subtle) !important;
    color: #fff !important;
    z-index: 9999 !important;
}

.select2-container--default .select2-results__option {
    color: #fff !important;
    padding: 10px 12px !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--accent-blue) !important;
    color: #fff !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

.select2-search--dropdown .select2-search__field {
    background-color: rgba(0, 0, 0, 0.4) !important;
    border: 1px solid var(--border-subtle) !important;
    color: #fff !important;
    border-radius: 6px !important;
    padding: 8px !important;
    outline: none !important;
    margin: 5px !important;
    width: calc(100% - 10px) !important;
}

/* Fix placeholder color */
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--text-muted) !important;
}

/* --- 21. GENERIC SELECT OPTION FIX --- */
select option {
    background-color: var(--brand-dark) !important;
    color: #fff !important;
}

/* --- TABLE SCROLL CONTAINER (FIX FOR WIDE MATRICES) --- */
.table-scroll-container {
    overflow-x: auto;
    width: 100%;
    display: block;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    /* Ensure it doesn't overflow parent */
}

/* Ensure stock table wrapper also respects this */
.stock-table-wrapper {
    overflow-x: auto;
    max-width: 100%;
}

/* --- SPINNER GLASS --- */
.spinner-glass {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* --- DIRECTIVE 47: STANDARD BOUTONS PREMIUM --- */
.btn-premium {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    height: 42px;
    padding: 0 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    text-decoration: none !important;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    filter: brightness(1.1);
}

/* Vert (success): Ajout, Validation, Création */
.btn-premium.success {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.2) 0%, rgba(46, 204, 113, 0.05) 100%);
    color: #2ecc71;
    border-color: rgba(46, 204, 113, 0.3);
}
.btn-premium.success:hover {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.4) 0%, rgba(46, 204, 113, 0.15) 100%);
    color: #fff;
    box-shadow: 0 8px 25px rgba(46, 204, 113, 0.4);
}

/* Orange (warning): Modification, Edition */
.btn-premium.warning {
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.2) 0%, rgba(243, 156, 18, 0.05) 100%);
    color: #f39c12;
    border-color: rgba(243, 156, 18, 0.3);
}
.btn-premium.warning:hover {
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.4) 0%, rgba(243, 156, 18, 0.15) 100%);
    color: #fff;
    box-shadow: 0 8px 25px rgba(243, 156, 18, 0.4);
}

/* Mauve (special): Actions IA, Duplication, Dossiers */
.btn-premium.special {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2) 0%, rgba(107, 33, 168, 0.05) 100%);
    color: #d8b4fe;
    border-color: rgba(168, 85, 247, 0.3);
}
.btn-premium.special:hover {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.4) 0%, rgba(107, 33, 168, 0.15) 100%);
    color: #fff;
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.4);
}

/* Bleu (info): Information, Navigation, Filtres */
.btn-premium.info {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.2) 0%, rgba(52, 152, 219, 0.05) 100%);
    color: #3498db;
    border-color: rgba(52, 152, 219, 0.3);
}
.btn-premium.info:hover {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.4) 0%, rgba(52, 152, 219, 0.15) 100%);
    color: #fff;
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
}

/* Secondaire (neutre): Transparence, Contacter le vendeur, etc. */
.btn-premium.secondary {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
    color: #fff;
}
.btn-premium.secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.1);
}