:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --cyan: #0DE5D6;
    --cyan-hover: #0bc4b8;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --bg-cyan-gradient: linear-gradient(135deg, #0a1120 0%, #063e42 100%);
    --card-bg: rgba(255, 255, 255, 0.05);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary-rgb: 99, 102, 241;
    --error: #ef4444;
    --success: #22c55e;
    --glass-border: rgba(255, 255, 255, 0.1);
}

.hidden {
    display: none !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
    z-index: 1;
}

.registration-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.header {
    text-align: center;
    margin-bottom: 32px;
}

.header h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 8px;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.top-header {
    margin-bottom: 25px;
}

.top-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 5px;
}

/* --- PRODUCT SORT BAR --- */
.main-sort-row {
    margin-bottom: 20px;
    display: flex;
    justify-content: flex-end;
}

.main-sort-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.main-sort-bar:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
}

.main-sort-bar select {
    background: #2a344a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    color-scheme: dark;
}

.main-sort-bar select:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: #323d5a;
}

.input-group {
    margin-bottom: 12px;
    position: relative;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input:focus,
.input-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.input-group textarea {
    width: 100%;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
    resize: none;
    font-family: inherit;
}

.input-group input::placeholder {
    color: #475569;
}

.error-message {
    color: var(--error);
    font-size: 0.75rem;
    margin-top: 4px;
    display: block;
}

button,
.btn-base {
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-family: inherit;
}

.btn-primary,
.btn-new,
.btn-card-base,
.btn-submit,
.btn-secondary {
    width: auto;
    padding: 14px 28px;
    background: var(--primary);
    color: white;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 15px;
}

.btn-submit {
    width: 100% !important;
    margin-top: 10px !important;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}

button:active {
    transform: translateY(0);
}

.hidden {
    display: none;
}

.result-area {
    margin-top: 24px;
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--glass-border);
}

.result-area h3 {
    color: var(--success);
    margin-bottom: 16px;
}

.user-info {
    background: rgba(0, 0, 0, 0.2);
    padding: 16px;
    border-radius: 12px;
    text-align: left;
    margin-bottom: 20px;
}

.user-info p {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.uuid-text {
    font-family: monospace;
    color: #818cf8;
    word-break: break-all;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.2);
}

.footer-link {
    margin-top: 24px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.footer-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.footer-link a:hover {
    text-decoration: underline;
}

/* Backoffice Topbar - style inspiré de la nav-bar d'accueil */
.bo-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(10, 15, 30, 0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(13, 229, 214, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 3000;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    user-select: none;
}

.bo-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s;
}

.bo-brand:hover {
    opacity: 0.85;
}

.bo-brand-logo {
    height: 32px;
    width: auto;
    display: block;
}

.bo-topbar-auth {
    display: flex;
    align-items: center;
    gap: 20px;
}

.bo-topbar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bo-btn-ghost {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    background: transparent;
    border: none;
    padding: 6px 10px;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    font-family: 'Outfit', sans-serif;
}

.bo-btn-ghost:hover {
    color: var(--cyan, #0DE5D6);
    background: rgba(13, 229, 214, 0.07);
}

.bo-topbar-username {
    font-size: 0.9rem;
    color: var(--text-muted, rgba(255,255,255,0.5));
    white-space: nowrap;
}

.bo-role-badge {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted, rgba(255,255,255,0.5));
    font-weight: 600;
    white-space: nowrap;
}

.bo-role-badge.admin {
    background: rgba(13, 229, 214, 0.1);
    color: var(--cyan, #0DE5D6);
    border-color: rgba(13, 229, 214, 0.3);
}

.bo-role-badge.super_admin {
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    border-color: rgba(99, 102, 241, 0.3);
}

.bo-btn-outline {
    background: transparent;
    color: var(--cyan, #0DE5D6);
    border: 1px solid var(--cyan, #0DE5D6);
    padding: 8px 18px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    font-size: 0.85rem;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
}

.bo-btn-outline:hover {
    background: rgba(13, 229, 214, 0.1);
    transform: translateY(-1px);
}

/* App Layout & Header */
.app-layout {
    display: flex;
    width: 100vw;
    height: calc(100vh - 64px);
    margin-top: 64px;
    background: var(--bg-gradient);
    overflow: hidden;
}

.top-header {
    width: 100%;
    padding: 40px 60px 20px 60px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--glass-border);
    flex: 0 0 auto;
}

.top-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.top-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.3;
    max-width: 600px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0;
    margin-right: 20px;
    line-height: 1;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2000;
    overflow: hidden;
}

.sidebar-footer {
    padding-top: 20px;
    margin-top: auto;
    border-top: 1px solid var(--glass-border);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
}

/* Custom Scrollbar for Sidebar Nav */
.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.sidebar-nav:hover::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-rgb), 0.3);
}

.nav-item {
    display: block;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 14px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    border-left: 3px solid var(--primary);
    padding-left: 13px;
}

.nav-group {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-group:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.nav-group-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 15px 10px;
    letter-spacing: 1px;
    font-weight: 600;
}

.sidebar-action {
    display: block;
    width: 100%;
    margin-top: 20px;
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sidebar-action:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}

.logout-btn {
    width: 100%;
    padding: 12px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-muted) !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    margin-top: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    background: rgba(99, 102, 241, 0.05) !important;
}

/* Main Content Structure */
.main-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.content-body {
    flex: 1;
    display: flex;
    gap: 40px;
    overflow: hidden;
    /* Désactive le scroll global de droite */
    padding: 0;
}

.action-column {
    flex: 0 0 160px;
}

.list-column {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    /* Scroll interne à chaque vue */
    padding: 40px 60px;
}

/* Product Grid Layout */
.product-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 40px;
}

/* Boutons de base pour les cartes */
.btn-card-base {
    display: inline-block;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-explore-style {
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-explore-style:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
}

.btn-modifier-style {
    background: var(--primary);
    color: white;
}

.btn-modifier-style:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
}

.btn-delete-style {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.btn-delete-style:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-qr-style {
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid #7c3aed;
    color: #7c3aed;
}

.btn-qr-style:hover {
    background: #7c3aed;
    color: white;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.product-card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 10px 20px;
    display: grid;
    grid-template-columns: 80px 0.8fr 140px 2.5fr;
    align-items: center;
    gap: 25px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.product-card:hover {
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}


.card-thumb-side {
    width: 70px;
    height: 70px;
    border-radius: 12px;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.card-text-side {
    min-width: 0;
}

.card-text-side h3 {
    margin: 0;
    color: var(--primary);
    font-size: 1rem;
    font-weight: 600;
}

.card-text-side p {
    margin: 4px 0 0 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    /* On passe à 3 lignes pour utiliser la hauteur */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-gallery {
    padding: 10px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.card-gallery:empty::after {
    content: "Pas d'images";
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.3;
    font-style: italic;
}



.card-gallery img {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.card-actions {
    padding: 0;
    background: transparent;
    border: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    justify-content: flex-start;
    /* Pousse tout à droite sur grand écran */
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    padding-left: 20px;
}

.action-row-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.action-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.action-add-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* 2 lignes de 3 colonnes */
    gap: 5px;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    padding-left: 15px;
}

.btn-card-mini {
    padding: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
}

.btn-card-mini:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

/* Correction spécifique pour le bouton Suppr empilé */
.action-stack .btn-delete-style {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.action-stack .btn-delete-style:hover {
    background: #ef4444;
    color: white;
}

.section-label {
    display: block;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.6;
    margin-bottom: 3px;
    color: white;
}

.card-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

/* Step columns and stacks */
.step-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.step-column:not(:first-child) {
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    padding-left: 20px;
}

.step-1-stack {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 80px;
}

.step-1-stack .btn-card-mini {
    width: 100%;
}

.step-2-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

/* --- RESPONSIVE / FLUIDITÉ --- */

@media (max-width: 1400px) {
    .product-card {
        gap: 15px;
        grid-template-columns: 60px 1fr auto auto;
    }

    .action-add-grid {
        padding-left: 10px;
    }
}

@media (max-width: 1150px) {
    .product-card {
        grid-template-columns: 60px 1fr auto;
        grid-template-rows: auto auto;
        gap: 15px 20px;
        padding: 15px;
    }

    .card-actions {
        grid-column: 1 / -1;
        border-left: none;
        padding-left: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        padding-top: 10px;
        justify-content: space-between;
    }

    .card-gallery {
        border-left: none;
        padding-left: 0;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .menu-toggle {
        display: block;
    }

    .top-header {
        padding: 20px 40px 15px 40px;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .top-header h1 {
        font-size: 1.4rem;
    }

    .list-column {
        padding: 20px 30px;
    }

    .product-card {
        grid-template-columns: 70px 1fr;
        gap: 15px;
        padding: 15px;
    }

    .card-actions {
        grid-column: 1 / -1;
        flex-direction: column;
        align-items: stretch;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        padding-left: 0;
        padding-top: 15px;
        gap: 15px;
    }

    .step-column:not(:first-child) {
        border-left: none;
        padding-left: 0;
    }

    .action-add-grid,
    .step-2-grid {
        border-left: none;
        padding-left: 0;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
}

@media (max-width: 850px) {
    .top-header {
        padding: 15px 25px 10px 25px;
    }

    .top-header h1 {
        font-size: 1.2rem;
    }

    .top-header p {
        font-size: 0.75rem;
    }

    .list-column {
        padding: 10px 15px;
    }

    .product-card {
        grid-template-columns: 50px 1fr;
        gap: 12px;
    }

    .action-add-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .btn-card-mini {
        font-size: 0.6rem;
        padding: 5px;
    }
}

@media (max-width: 500px) {
    .product-card {
        display: grid;
        grid-template-columns: 80px 1fr;
        gap: 12px;
        padding: 12px;
    }

    .card-thumb-side {
        grid-row: 1 / 3;
        width: 80px;
        height: 80px;
        margin-bottom: 0;
        border-radius: 8px;
    }

    .card-text-side {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .card-text-side h3 {
        font-size: 1rem;
        margin-bottom: 2px;
    }

    .card-text-side p {
        font-size: 0.7rem;
        margin-bottom: 4px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .card-section {
        grid-column: 1 / -1;
        width: 100%;
    }

    .action-row-container {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }

    .action-stack {
        flex: 1;
        min-width: 100px;
        flex-direction: column;
        gap: 4px;
    }

    .btn-card-mini {
        padding: 5px 8px;
    }

    .action-add-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
    }
}

.side-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 2px;
}

/* --- COMPOSANT UNIFIÉ : VISIONNEUSE DE DOCUMENTS --- */
.doc-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(15px);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    padding: 2.5vw;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s opacity;
}

.doc-viewer-modal.open {
    opacity: 1;
    pointer-events: auto;
}

.doc-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.doc-viewer-header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: #0DE5D6;
}

.doc-viewer-content-wrapper {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
}

.doc-viewer-content {
    background: #0f172a;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    width: 100%;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.doc-viewer-main {
    flex: 1;
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    gap: 25px;
    max-width: 1800px;
    width: 100%;
    margin: 0 auto;
    min-height: 0;
}

.doc-viewer-info-container {
    grid-column: 1;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 25px;
    margin-bottom: 0;
    overflow-y: auto;
    height: 100%;
}

.doc-viewer-complements-container {
    grid-column: 3;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 20px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    padding: 20px;
    overflow-y: auto;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.complements-header {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

@media (max-width: 1100px) {
    .doc-viewer-main {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        overflow-y: auto;
        gap: 15px;
    }
    
    .doc-viewer-content-wrapper {
        grid-column: 1;
        grid-row: 1;
        min-height: 50vh;
    }
    
    .doc-viewer-info-container {
        grid-column: 1;
        grid-row: 2;
        height: auto;
    }
    
    .doc-viewer-complements-container {
        grid-column: 1;
        grid-row: 3;
        height: auto;
    }
}

.viewer-info-desc {
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 20px 0;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.viewer-info-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.viewer-info-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.viewer-info-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
}

.viewer-info-value {
    font-size: 0.95rem;
    color: #0DE5D6;
    font-weight: 500;
}

.viewer-info-value a {
    color: #0DE5D6;
    text-decoration: none;
    word-break: break-all;
}

.viewer-info-value a:hover {
    text-decoration: underline;
}

.doc-viewer-content video,
.doc-viewer-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.doc-viewer-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.btn-close-viewer {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    font-size: 1.2rem;
}

/* --- COMPOSANT : ITEM DE LISTE DE DOCUMENT/FICHIER --- */
.doc-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 16px;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: 0.3s;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    cursor: pointer;
    text-decoration: none;
    color: white;
    gap: 15px;
    position: relative;
    overflow: hidden;
}

.doc-item-main {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 0;
}

.doc-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #0DE5D6;
    transform: translateY(-2px);
}

.doc-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.doc-info {
    min-width: 0;
    flex: 1;
}

.doc-info h4 {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-info p {
    margin: 0;
    font-size: 0.75rem;
    opacity: 0.6;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.doc-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    padding-left: 10px;
}

.doc-ext {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--cyan);
    background: rgba(13, 229, 214, 0.1);
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.doc-action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    text-decoration: none;
    font-size: 0.9rem;
}

.doc-action-btn:hover {
    background: var(--cyan);
    color: #0f172a;
    border-color: var(--cyan);
    transform: scale(1.1);
}

.doc-thumbnail {
    width: 50px;
    height: 65px;
    background: #fff;
    border-radius: 4px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #1a2236;
}

.btn-side-add {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-side-add.img {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.btn-side-add.mod3d {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.btn-side-add.doc {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.btn-side-add:hover {
    filter: brightness(1.2);
    transform: translateX(3px);
}

.side-footer {
    margin-top: auto;
    padding-top: 10px;
}

.btn-delete-minimal {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: 0.2s;
}

.btn-delete-minimal:hover {
    background: #ef4444;
    color: white;
}

.btn-edit:hover {
    background: #3498db;
    color: white;
}

.btn-delete {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.btn-delete:hover {
    background: #e74c3c;
    color: white;
}

/* MODALS PREMIMUM DARK */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: #1a2236;
    padding: 30px;
    width: 95%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: 32px;
    position: relative;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.modal-content h2 {
    margin-bottom: 20px;
    font-size: 1.8rem;
    font-weight: 700;
}

.modal-content label {
    display: block;
    margin-bottom: 8px;
    color: #94a3b8;
    font-size: 0.9rem;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    margin-bottom: 8px;
}

.file-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 10px;
}

.btn-mini-delete {
    background: rgba(239, 68, 68, 0.1);
    border: none;
    color: #ef4444;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-mini-delete:hover {
    background: #ef4444;
    color: white;
}

/* RÉCAPITULATIF ANTI-DOUBLONS */
.recap-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
}

.recap-badge:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    color: white !important;
    transform: translateY(-2px);
}

.recap-badge.no-link:hover {
    cursor: default;
    transform: none;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

/* LAYOUT MODAL 3 COLONNES (Tri-Split) */
.modal-tri-split {
    display: grid;
    grid-template-columns: 320px 1fr 340px;
    /* Form / Arborescence / Récap */
    gap: 25px;
    margin-top: 20px;
    flex: 1;
    min-height: 0;
}

.modal-tri-split.no-links {
    grid-template-columns: 1fr 1fr;
}

.col-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding-right: 15px;
    min-height: 0;
}

.col-links {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
}

.col-links h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
    opacity: 0.7;
    color: var(--primary);
}

.col-recap {
    background: rgba(255, 255, 255, 0.01);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    padding-left: 20px;
    max-height: 520px;
    overflow-y: auto;
    min-height: 0;
}

.edit-middle::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.edit-middle::-webkit-scrollbar-track,
.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}

.edit-middle::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.2);
    border-radius: 10px;
}

.edit-middle::-webkit-scrollbar-thumb:hover,
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

/* Éléments de l'arborescence de liaison */
.link-tree-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.link-tree-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary);
}

.link-tree-item.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.link-tree-item .info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.link-tree-item .info h4 {
    margin: 0;
    font-size: 0.85rem;
    white-space: nowrap;
}

.link-tree-item input[type="checkbox"],
.link-tree-item input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* LAYOUT MODAL 2 COLONNES (Ancien, pour compatibilité si besoin) */
.modal-split {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.recap-column {
    background: rgba(255, 255, 255, 0.02);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 30px;
    max-height: 500px;
    overflow-y: auto;
}

.recap-item-detail {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

.recap-item-detail:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary);
}

.recap-item-detail h4 {
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    color: white;
}

.recap-item-detail p {
    margin: 0;
    font-size: 0.8rem;
    color: #94a3b8;
    /* Gris clair lisible */
    opacity: 0.8;
    font-style: italic;
    line-height: 1.4;
}


/* MODAL D'ÉDITION REVISITÉ */
.edit-layout {
    display: grid;
    grid-template-columns: 220px 300px 1fr;
    flex: 1;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 0;
    /* Important for flex/grid overflow */
}

.edit-sidebar {
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0;
    background: rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.edit-middle {
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0;
    overflow-y: auto;
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.1);
}

.edit-content {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.01);
    min-height: 0;
}

.edit-sort-bar {
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
}

.edit-sort-bar label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.edit-sort-bar select {
    background: #2a344a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    outline: none;
}

/* Cleanup: redundant styles removed */

.edit-sort-bar select:focus {
    border-color: var(--primary);
}

.doc-group-title {
    padding: 12px 20px 5px 20px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--current-color, var(--primary));
    opacity: 0.8;
}

.edit-right-inner {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.edit-footer {
    padding: 20px 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

/* Onglets Recap dans les modals */
.recap-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.recap-tab {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recap-tab:hover {
    background: rgba(255, 255, 255, 0.03);
    color: white;
}

.recap-tab.active {
    background: rgba(255, 255, 255, 0.06);
    color: var(--primary);
}

.linked-path-tag {
    font-size: 0.6rem;
    opacity: 0.4;
    display: block;
    margin-top: 2px;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-3d.active {
    color: #6366f1 !important;
    border-left-color: #6366f1 !important;
}

.tab-images {
    color: rgba(245, 158, 11, 0.7) !important;
}

.tab-images.active {
    color: #f59e0b !important;
    border-left-color: #f59e0b !important;
}

.tab-videos {
    color: rgba(37, 99, 235, 0.7) !important;
}

.tab-videos.active {
    color: #2563eb !important;
    border-left-color: #2563eb !important;
}

.tab-audios {
    color: rgba(236, 72, 153, 0.7) !important;
}

.tab-audios.active {
    color: #ec4899 !important;
    border-left-color: #ec4899 !important;
}

.tab-docs {
    color: rgba(16, 185, 129, 0.7) !important;
}

.tab-docs.active {
    color: #10b981 !important;
    border-left-color: #10b981 !important;
}

.tab-divers {
    color: rgba(100, 116, 139, 0.7) !important;
}

.tab-divers.active {
    color: #64748b !important;
    border-left-color: #64748b !important;
}

.tab-print3d {
    color: rgba(233, 30, 99, 0.7) !important;
}

.tab-print3d.active {
    color: #e91e63 !important;
    border-left-color: #e91e63 !important;
}

.tab-biblio {
    color: rgba(139, 92, 246, 0.7) !important;
}

.tab-biblio.active {
    color: #8b5cf6 !important;
    border-left-color: #8b5cf6 !important;
}

.tab-fichetech {
    color: rgba(13, 229, 214, 0.7) !important;
}

.tab-fichetech.active {
    color: #0DE5D6 !important;
    border-left-color: #0DE5D6 !important;
}

.edit-pane {
    display: none;
}

.edit-pane.active {
    display: block;
}

/* Styles pour la liste du milieu (Items à modifier) */
.edit-list-header {
    padding: 15px 20px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.edit-item-card {
    padding: 8px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.edit-item-card:hover {
    background: rgba(255, 255, 255, 0.03);
}

.edit-item-card.active {
    background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid var(--current-color, var(--primary));
}

.edit-item-card h5 {
    font-size: 0.9rem;
    color: white;
    margin: 0;
    white-space: nowrap;
}

.edit-item-card p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
    white-space: nowrap;
}

.edit-item-card {
    min-width: max-content;
    width: 100%;
}

/* Responsive Edit Modal */
@media (max-width: 1024px) {
    .edit-layout {
        grid-template-columns: 180px 220px 1fr;
    }
}

@media (max-width: 850px) {
    .edit-layout {
        grid-template-columns: 80px 1fr;
        grid-template-rows: auto 1fr;
    }

    .edit-sidebar {
        grid-row: 1 / 3;
    }

    .edit-middle {
        display: none;
        /* Simplification sur petit écran */
    }

    .tab-btn span {
        display: none;
    }

    .tab-btn {
        justify-content: center;
        padding: 15px 0;
    }
}

@media (max-width: 768px) {
    .edit-layout {
        display: flex;
        flex-direction: column;
        height: auto;
        max-height: 80vh;
    }

    .edit-sidebar {
        width: 100%;
        display: flex;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding: 5px 0;
    }

    .edit-middle {
        display: block;
        width: 100%;
        height: 150px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .tab-btn {
        width: auto;
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 10px 15px;
    }

    .tab-btn.active {
        border-left: none;
        border-bottom: 3px solid var(--primary);
    }
}

/* --- TITRE FLOTTANT EN PILULE (TOP CENTER) --- */
.top-center-pill {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    border-radius: 40px;
    padding: 10px 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    pointer-events: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 100;
    white-space: nowrap;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* --- VISIBILITY PILL TOGGLE --- */
.visibility-toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 16px;
    margin: 20px 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.pill-switch {
    display: flex;
    width: fit-content;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 40px;
    gap: 4px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pill-option {
    padding: 8px 20px;
    border-radius: 40px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-muted);
    z-index: 1;
}

.pill-option.active {
    color: white;
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.pill-option[data-value="public"].active {
    background: var(--success);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

/* --- USER ACCESS LIST --- */
.user-access-section {
    margin-top: 15px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    animation: fadeInDown 0.4s ease-out;
}

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

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

.user-access-header {
    padding: 12px 15px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.user-access-list {
    max-height: 250px;
    overflow-y: auto;
}

/* Custom scrollbar for access list */
.user-access-list::-webkit-scrollbar {
    width: 6px;
}

.user-access-list::-webkit-scrollbar-track {
    background: transparent;
}

.user-access-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.access-user-item {
    display: flex;
    align-items: flex-start;
    /* Aligné en haut */
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.access-user-item:last-child {
    border-bottom: none;
}

.access-user-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.access-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.user-role-tag {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 40px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

/* Permissions block */
.access-permissions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 140px;
}

.permission-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.permission-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Sub-toggle for users */
.mini-toggle {
    width: 36px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
}

.mini-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s;
}

.mini-toggle.active {
    background: var(--success);
}

.mini-toggle.active::after {
    left: 18px;
}

.mini-toggle.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(1);
}

/* Modèles de fiches techniques */
.tech-sheet-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.tech-sheet-form-column {
    flex: 1.5;
    max-width: 700px;
}

.tech-sheet-list-column {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid var(--glass-border);
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.dynamic-field-item {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.btn-icon-delete {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    font-size: 1.1rem;
}

.btn-icon-delete:hover {
    background: #ef4444;
    color: white;
}

.btn-add-value {
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: 0.2s;
    width: auto;
    margin-top: 0;
}

.template-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.2s;
}

.template-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
}

.template-card h4 {
    margin: 0;
    font-size: 0.95rem;
    color: white;
}

.template-card p {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-order {
    width: 24px;
    height: 20px;
    padding: 0;
    font-size: 0.6rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    line-height: 1;
}

.btn-order:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: var(--primary);
}

/* FIX SELECT OPTIONS IN DARK THEME */
select option {
    background-color: #1a2236 !important;
    color: white !important;
}

select {
    color-scheme: dark;
}

/* CUSTOM SCROLLBARS FOR MODALS */
.edit-sidebar::-webkit-scrollbar,
.edit-middle::-webkit-scrollbar,
.edit-right-inner::-webkit-scrollbar,
.col-links::-webkit-scrollbar,
.col-recap::-webkit-scrollbar,
#addFichetech_linksTree::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.edit-sidebar::-webkit-scrollbar-track,
.edit-middle::-webkit-scrollbar-track,
.edit-right-inner::-webkit-scrollbar-track,
.col-links::-webkit-scrollbar-track,
.col-recap::-webkit-scrollbar-track,
#addFichetech_linksTree::-webkit-scrollbar-track {
    background: transparent;
}

.edit-sidebar::-webkit-scrollbar-thumb,
.edit-middle::-webkit-scrollbar-thumb,
.edit-right-inner::-webkit-scrollbar-thumb,
.col-links::-webkit-scrollbar-thumb,
.col-recap::-webkit-scrollbar-thumb,
#addFichetech_linksTree::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.edit-sidebar::-webkit-scrollbar-thumb:hover,
.edit-middle::-webkit-scrollbar-thumb:hover,
.edit-right-inner::-webkit-scrollbar-thumb:hover,
.col-links::-webkit-scrollbar-thumb:hover,
.col-recap::-webkit-scrollbar-thumb:hover,
#addFichetech_linksTree::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* --- TECH SHEET CATEGORIES & FILTERING --- */
.category-tag {
    transition: all 0.2s ease;
}

.category-tag:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--primary) !important;
    color: var(--text-main) !important;
}

.category-tag button:hover {
    color: #ff4d4d !important;
    transform: scale(1.2);
}

.filter-bar select {
    transition: all 0.3s ease;
}

.filter-bar select:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: var(--primary) !important;
}

.template-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 15px 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.template-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary);
    transform: translateX(5px);
}

.role-badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.assign-template-card:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(99, 102, 241, 0.5) !important;
    transform: translateY(-2px);
}

.config-template-card:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(96, 165, 250, 0.5) !important;
    transform: translateX(4px);
}

/* Styles pour la liste des fichiers similaires dans la visionneuse */
.complements-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.complements-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    transition: all 0.2s ease;
    user-select: none;
}

.complements-item:hover:not(.active) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateX(4px);
}

.complements-item.active {
    background: rgba(13, 229, 214, 0.1);
    border-color: rgba(13, 229, 214, 0.3);
}

.complements-item-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.complements-item-info {
    flex: 1;
    min-width: 0;
}

.complements-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.complements-item-desc {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.8;
}

.no-complements {
    opacity: 0.4;
    font-size: 0.8rem;
    text-align: center;
    margin-top: 20px;
    font-style: italic;
}

/* Style pour les inputs datetime-local */
input[type="datetime-local"] {
    color-scheme: dark !important;
    cursor: pointer;
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

/* Drag and Drop Custom File Input styling */
.drag-drop-container {
    position: relative;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    padding: 20px 15px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 90px;
    overflow: hidden;
}

.drag-drop-container:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.04);
}

.drag-drop-container.dragover {
    border-color: var(--primary, #6366f1);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
    transform: scale(1.01);
}

.drag-drop-container input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.drag-drop-icon {
    font-size: 1.6rem;
    color: var(--text-muted);
    transition: transform 0.3s ease, color 0.3s ease;
}

.drag-drop-container.dragover .drag-drop-icon {
    color: var(--primary, #6366f1);
    transform: translateY(-3px);
}

.drag-drop-text {
    font-size: 0.85rem;
    color: var(--text-main);
    pointer-events: none;
    font-weight: 500;
}

.drag-drop-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
    pointer-events: none;
}

.drag-drop-filename {
    font-size: 0.8rem;
    color: var(--cyan, #0DE5D6);
    word-break: break-all;
    margin-top: 2px;
    font-weight: 600;
    pointer-events: none;
}