/* css/cartouches.css */

.cartouches-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 0;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
    width: 100%;
    position: relative;
    transition: all 0.3s ease;
}

#filterSidebar {
    z-index: 1000 !important;
}

.cartouche {
    background: var(--brand-darker, #1f222e);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 20px;
    display: grid;
    /* Generic fallback, will be overridden by classes */
    grid-template-columns: 40px 100px 300px 1fr 200px 200px 100px;
    align-items: center;
    gap: 20px;
    transition: all 0.2s ease;
    width: 100%;
    cursor: pointer;
}

/* Specific Grid Layouts for harmonization */
.cartouche.grid-catalogue {
    grid-template-columns: 50px 100px 470px 1fr 400px 170px !important;
}

.cartouche.grid-collection {
    grid-template-columns: 40px 100px 400px 1.5fr 250px 120px !important;
}

/* Specific Grid Layouts */
.cartouche.grid-9 {
    grid-template-columns: 40px 90px 1.2fr 0.6fr 0.6fr 0.6fr 0.6fr 0.6fr 60px;
    gap: 8px;
    padding: 10px 12px;
    /* v1.7 drastic reduction */
}

.cartouche.grid-9>div {
    min-width: 0;
    overflow: hidden;
}

.cartouche.grid-9 .zone-neuf,
.cartouche.grid-9 .zone-oblitere,
.cartouche.grid-9 .zone-technical {
    padding-left: 10px;
}

.cartouche.grid-8 {
    /* v1.9 optimized for Dispoliste */
    grid-template-columns: 40px 90px 1.2fr 4fr 60px 0.7fr 1fr 110px;
}

.cartouche.grid-7 {
    /* v1.8 optimized */
    grid-template-columns: 40px 90px 1.2fr 4fr 0.7fr 0.7fr 110px;
}

.cartouche.grid-3 {
    grid-template-columns: 1.2fr 2fr 2.5fr;
}

.cartouche:hover {
    border-color: var(--accent-blue, #007aff);
    background: rgba(255, 255, 255, 0.03);
    transform: translateX(4px);
}

.cartouche.cartouche-header {
    position: sticky;
    top: -10px;
    /* Aligné avec le padding du container */
    z-index: 500;
    /* Augmenté pour passer devant tout */
    background: #11131a;
    /* Couleur opaque (hérité de --bg-page) */
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 0;
    /* Supprimé pour éviter les fuites de texte dans les coins */
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    user-select: none;
    transform: none;
    box-shadow: 0 10px 15px -5px rgba(0, 0, 0, 0.5);
    /* Ombre pour marquer le passage dessous */
}

.cartouche.cartouche-header div {
    color: rgba(255, 255, 255, 0.5) !important;
}

.cartouche.cartouche-header:hover {
    border-color: rgba(255, 255, 255, 0.1) !important;
    transform: none !important;
    background: rgba(255, 255, 255, 0.03) !important;
    cursor: default;
}

.cartouche-header input[type="checkbox"] {
    cursor: pointer;
}

/* Zone Definitions */
.zone-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.zone-identity {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.zone-technical {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    padding-left: 15px;
    font-size: 1.05rem;
    color: #fff;
}

.cartouche-header .zone-technical {
    font-size: 0.85rem !important;
    color: rgba(255, 255, 255, 0.5) !important;
    font-weight: 700;
    text-transform: uppercase;
}

.zone-neuf {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    padding-left: 15px;
    color: var(--accent-blue, #007aff);
}

.zone-oblitere {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    padding-left: 15px;
    color: #2ecc71;
}

.zone-stock-cote {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    padding-left: 15px;
    /* Suppression Courier New pour cohérence avec en-tête */
    font-size: 0.95rem;
    align-items: flex-start;
    justify-content: center;
}

.stock-line {
    display: grid;
    /* Colonnes : Label(85px), Separateur(:)(10px), Qty(25px), X(15px), Cote(80px) */
    grid-template-columns: 85px 10px 25px 15px 80px;
    align-items: center;
    gap: 0;
    white-space: nowrap;
    width: 100%;
    font-weight: 400;
}

/* État actif : gras si stock possédé */
.stock-line.active-stock {
    font-weight: 700;
}

.stock-line span.label-cote {
    opacity: 0.8;
}

.stock-line span.qty {
    text-align: right;
    font-weight: inherit;
    padding-right: 6px;
}

.stock-line.active-stock span.qty {
    font-weight: 800;
    /* Plus gras pour la quantité possédée */
}

.stock-line span.sep {
    text-align: center;
    opacity: 0.6;
}

.stock-line span.cote {
    color: #888;
    text-align: right;
    padding-left: 5px;
}

.zone-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

/* Elements */
.thumbnail-cartouche {
    width: 69px;
    height: 69px;
    object-fit: contain;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.2);
}

.thumbnail-cartouche.no-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #232731;
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.2);
}

.yt-link:hover {
    text-decoration: underline !important;
}

.action-icon-svg {
    width: 18px;
    height: 18px;
    color: #888;
    transition: color 0.2s, transform 0.2s;
    cursor: pointer;
    background: transparent !important;
    border: none !important;
    padding: 0;
}

.action-icon-svg:hover {
    color: #fff;
    transform: scale(1.1);
}

.action-icon-svg.delete:hover {
    color: #ff3b30;
}

.cartouche.album-page-row .zone-values,
.cartouche.album-page-row .zone-technical {
    text-align: center;
    border: none;
    padding-left: 0;
}

/* Typography unification */
.cartouche .data-text {
    font-weight: 500 !important;
    font-size: 1rem !important;
}

/* Colonne DESCRIPTION : police normale (pas de gras) */
.cartouche .zone-technical.data-text,
.cartouche .zone-technical .data-text {
    font-weight: 400 !important;
}

/* Shared Header Layout (Catalogue & Collection) */
.header-cartouches-wrapper {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.header-cartouche {
    background: var(--brand-darker, #1f222e);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.header-cartouche.filters-bloc {
    flex: 3;
    align-items: flex-start;
}

.header-cartouche.actions-bloc {
    flex: 1;
    min-width: 320px;
    justify-content: center;
}

/* Glass Badges Styles */
.glass-badge {
    display: inline-block;
    padding: 6px 20px;
    border-radius: 50px;
    font-size: 0.95rem;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
    width: fit-content;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.glass-badge-success {
    background: rgba(46, 204, 113, 0.12);
    color: #2ecc71;
    border-color: rgba(46, 204, 113, 0.3);
}

.glass-badge-danger {
    background: rgba(231, 76, 60, 0.12);
    color: #e74c3c;
    border-color: rgba(231, 76, 60, 0.3);
}

.glass-badge-blue {
    background: rgba(0, 122, 255, 0.12);
    color: var(--accent-blue, #007aff);
    border-color: rgba(0, 122, 255, 0.3);
}

.glass-badge-green {
    background: rgba(46, 204, 113, 0.12);
    color: #2ecc71;
    border-color: rgba(46, 204, 113, 0.3);
}

.glass-badge-orange {
    background: rgba(255, 149, 0, 0.12);
    color: #ff9500;
    border-color: rgba(255, 149, 0, 0.3);
}

/* Nature Quick Filters */
.nature-quick-filters {
    display: grid;
    grid-template-rows: repeat(7, auto);
    grid-template-columns: repeat(auto-fill, minmax(max-content, 1fr));
    grid-auto-flow: column;
    gap: 8px 12px;
    padding: 10px 0;
    overflow-x: auto;
    width: 100%;
}

.nature-quick-filters::-webkit-scrollbar {
    display: none;
}

/* Bulk Toolbar & Selection */
.bulk-toolbar {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(31, 34, 46, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 30px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
}

.bulk-toolbar.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.bulk-info {
    color: #fff;
    font-weight: 700;
    padding-right: 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.bulk-btn {
    background: none;
    border: none;
    color: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.bulk-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.bulk-btn.delete:hover {
    color: #ff3b30;
    background: rgba(255, 59, 48, 0.1);
}

.bulk-btn.mancoliste:hover {
    color: #ff9500;
    background: rgba(255, 149, 0, 0.1);
}

.bulk-btn.collection:hover {
    color: #34c759;
    background: rgba(52, 199, 89, 0.1);
}

.cartouche-checkbox-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
}

.manco-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    z-index: 100;
    display: block;
    margin: 0;
    padding: 0;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
}

.manco-checkbox:checked {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.manco-checkbox:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 14px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#globalSelectBanner {
    display: none;
    background: rgba(0, 122, 255, 0.1);
    border: 1px dashed var(--accent-blue);
    padding: 12px;
    text-align: center;
    border-radius: 12px;
    margin-bottom: 20px;
    color: #fff;
    font-size: 0.95rem;
    animation: fadeIn 0.3s ease;
}

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

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

.nature-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    width: 100%;
    justify-content: space-between;
    user-select: none;
}

.nature-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.nature-chip.active {
    background: rgba(52, 199, 89, 0.15);
    border-color: rgba(52, 199, 89, 0.3);
    color: #2ecc71;
    font-weight: 600;
}

.nature-chip input {
    display: none;
}

.nature-count {
    opacity: 0.6;
    font-size: 0.85em;
    margin-left: 5px;
    font-weight: 400;
}