:root {
    /* 🌞 Couleur principale (orange / doré) */
    --couleur-navigation: #ffb14e;
    --couleur-navigation-degrade: linear-gradient(135deg, #ffb14e 0%, #f99d2e 100%);
    --couleur-navigation-hover: #ffca61;

    /* 🔵 Couleur secondaire (issue du logo) */
    --couleur-primaire: #1E5AA8;
    --couleur-primaire-hover: #2a6bc2;

    /* 🤍 Fonds */
    --couleur-sous-navigation: #e68210;
    --couleur-page-background: #fff8ee;
    --couleur-fond: #ffab3333;
    --couleur-fond-bis: #ffab331a;

    /* 🖱️ Interactions */
    --couleur-menu-hover: #fff0e0;
    --couleur-tooltip: #ffb14e;

    /* 🧾 Texte */
    --couleur-texte: #333333;
    --couleur-texte-clair: #666666;

    /* 🌫️ Ombres */
    --ombre-dropdown: 0 8px 24px rgba(0, 0, 0, 0.12);
    --ombre-navbar: 0 2px 12px rgba(0, 0, 0, 0.10);
}

/*** Mise en forme generale ***/
html, body {
    background-color: var(--couleur-page-background);
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    color: var(--couleur-texte);
}

.page-content {
    flex: 1;
}

/*** Couleurs ***/
a {
    color: var(--couleur-primaire);
    transition: color 0.15s ease;
}

a:hover {
    color: var(--couleur-primaire-hover);
}

.couleur-navigation {
    background: var(--couleur-navigation-degrade);
    box-shadow: var(--ombre-navbar);
}

.couleur-sous-navigation {
    background: var(--couleur-navigation-degrade);
    --bs-dropdown-link-hover-bg: var(--couleur-menu-hover);
    --bs-dropdown-link-active-color: inherit;
    --bs-dropdown-link-active-bg: transparent;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    box-shadow: var(--ombre-dropdown);
    padding: 0.4rem 0.8rem 0.4rem 0;
}

/* Lien simple dans dropdown */
.couleur-sous-navigation .dropdown-item {
    border-radius: 8px;
    margin: 0.15rem 0.4rem;
    padding: 0.5rem 0.8rem;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.couleur-sous-navigation .dropdown-item:hover {
    background-color: var(--couleur-menu-hover);
}

/* En-têtes dans dropdown */
.couleur-sous-navigation .dropdown-header {
    color: var(--couleur-sous-navigation);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.8rem 0.25rem;
    font-weight: 600;
}

/* Dropdown-toggle arrow */
.couleur-sous-navigation .dropdown-toggle::after {
    margin-left: 0.5rem;
    vertical-align: middle;
}

.couleur-fond {
    background-color: var(--couleur-fond);
}

.couleur-fond-bis {
    background-color: var(--couleur-fond-bis);
}

#filterForm {
    background-color: var(--couleur-fond-bis);
    padding: 1rem;
    border-radius: 1rem;
}

/*** Menu ***/
nav {
    font-size: 1.15rem;
}

@media (max-width: 576px) {
    nav {
        font-size: 1rem;
    }
}

.titre-nav {
    font-size: 1.3rem;
}

.navbar-logo {
    height: 100px;
    width: auto;
    transition: height 0.2s ease;
}

@media (max-width: 576px) {
    .navbar-logo {
        height: 40px;
    }
}

/* Sous-menu imbriqué (dropdown-submenu) */
.dropdown-submenu {
    position: relative;
    background-color: inherit;
}

.dropdown-submenu > .dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -0.5rem;
    margin-left: 0.5rem;
}

/* Navbar toggle personnalisé */
.navbar-toggler {
    border: none;
    padding: 0.5rem;
    transition: transform 0.2s ease;
}

.navbar-toggler:focus {
    box-shadow: none;
}

.navbar-toggler:hover {
    transform: scale(1.1);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280,0,0,0.6%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* Liens de navigation */
.navbar .nav-link {
    border-radius: 10px;
    padding: 0.5rem 0.9rem !important;
    margin: 0 2px;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    position: relative;
    font-weight: 500;
}

/* Survol du menu */
.navbar .nav-link:hover {
    background-color: var(--couleur-navigation-hover);
    transform: scale(1.04);
}

/* Page active */
.navbar .nav-link.active,
.navbar .nav-link.dropdown-toggle.active {
    background-color: var(--couleur-navigation-hover);
    font-weight: 600;
}

/* Survol du sous-menu */
.dropdown-menu .dropdown-item:hover {
    background-color: var(--couleur-menu-hover);
}

/* Survol du sous-menu */
.dropdown-menu .dropdown-item.active {
    background-color: var(--couleur-menu-hover);
    font-weight: 600;
    color: #000;
}

/*** Responsive : menu collapse ***/
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: var(--couleur-navigation-degrade);
        border-radius: 0 0 12px 12px;
        padding: 0.5rem;
        margin-top: 0.5rem;
        box-shadow: var(--ombre-dropdown);
    }

    .navbar-collapse .navbar-nav {
        gap: 0.25rem;
    }

    .navbar-collapse .nav-link {
        padding: 0.6rem 1rem !important;
        border-radius: 8px;
    }

    /* Dropdowns en pleine largeur sur mobile */
    .navbar-collapse .dropdown-menu {
        background: rgba(255, 255, 255, 0.9) !important;
        border: none;
        box-shadow: none;
        border-radius: 8px;
        padding: 0.25rem;
        margin-top: 0.25rem;
        margin-bottom: 0.25rem;
    }

    .navbar-collapse .dropdown-menu .dropdown-item {
        padding: 0.5rem 1rem;
        margin: 0;
        border-radius: 6px;
    }

    .navbar-collapse .dropdown-menu .dropdown-header {
        padding: 0.4rem 1rem;
    }

    /* Sous-menus mobiles : affichage vertical */
    .dropdown-submenu > .dropdown-menu {
        position: static !important;
        top: auto;
        left: auto;
        margin: 0.25rem 0 0.25rem 1rem !important;
        border-radius: 8px;
    }
}

/*** Tooltip ***/
.custom-tooltip {
    --bs-tooltip-bg: var(--couleur-tooltip);
    --bs-tooltip-color: var(--bs-dark);
}

/*** Mise en forme Tabulator ***/
/* Conteneur général */
.tabulator {
    border-radius: 8px !important;
    border: 1px solid #dee2e6 !important;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important;
    font-size: 14px !important;
}

/* En-têtes */
.tabulator .tabulator-header {
    background-color: #f8f9fa !important;
    border-bottom: 1px solid #dee2e6 !important;
}

.tabulator .tabulator-header .tabulator-col {
    background-color: color-mix(in srgb, var(--couleur-navigation) 65%, white 35%) !important;
    font-size: 15px !important;
    padding: 5px;
}

.tabulator .tabulator-col {
    font-weight: 600 !important;
    color: var(--couleur-texte) !important;
}

/* Lignes */
.tabulator-row {
    background-color: #fff !important;
    transition: background-color 0.15s ease;
}

.tabulator-row:nth-child(even) {
    background-color: #fdfdfd;
}

.tabulator-row:hover {
    background-color: #fdf0e3 !important;
}

/* Cellules */
.tabulator-cell {
    padding: 5px 5px !important;
    border-right: 1px solid rgba(119, 119, 119, 0.71) !important;
    border-left: 1px solid rgba(119, 119, 119, 0.71) !important;
    border-bottom: 1px solid rgba(119, 119, 119, 0.71) !important;
    align-content: center;
    font-size: 16px !important;
}

/* Sélection */
.tabulator-row.tabulator-selected {
    background-color: #dbeafe !important;
}

/* Boutons dans les cellules */
.tabulator-cell {
    padding: 5px 5px !important;
    font-size: 16px !important;
}

/* Scroll plus discret */
.tabulator .tabulator-tableholder::-webkit-scrollbar {
    height: 8px !important;
}

.tabulator .tabulator-tableholder::-webkit-scrollbar-thumb {
    background: #ced4da !important;
    border-radius: 4px !important;
}

.tabulator {
    --tabulator-border-color: #dee2e6 !important;
    --tabulator-header-background-color: #e9ecef !important;
    --tabulator-row-hover-background-color: #f8f9fa !important;
    --tabulator-row-selected-background-color: #cfe2ff !important;
}

.tabulator .btn {
    border-radius: 6px;
}

.tabulator-col .tabulator-col-sorter {
    opacity: 1;
}

.tabulator-col.tabulator-sortable:hover .tabulator-col-sorter {
    opacity: 1;
}

.tabulator-cell[data-field="action"] {
    text-align: center;
    white-space: nowrap;
}

.row-entree {
    background-color: #ededed !important;
}

.row-total-annee {
    background-color: #f3e6a3 !important;
    font-weight: bold;
}

.row-total-mois {
    background-color: #cbf3cf !important;
}

.row-total-journee {
    background-color: #dbeafe !important;
}

.liste {
    max-height: 75vh;
}

.apercu-couleur {
    height: 48px;
    border-radius: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.media-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 0.75rem;
}

/* ---- Documents ---- */

.document-layout {
    display: flex;
    min-height: 60vh;
}

.document-sidebar {
    width: 280px;
    min-width: 150px;
    max-width: 500px;
    flex-shrink: 0;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.document-sidebar::-webkit-scrollbar {
    width: 5px;
}

.document-sidebar::-webkit-scrollbar-thumb {
    background: var(--couleur-navigation);
    border-radius: 4px;
}

.document-main {
    flex: 1;
    min-width: 300px;
}

/* Resizer handle */

.document-resizer {
    width: 6px;
    flex-shrink: 0;
    cursor: col-resize;
    background: rgba(0,0,0,0.08);
    position: relative;
    transition: background 0.15s;
    margin-right: 12px;
    border-radius: 3px;
}

.document-resizer:hover,
.document-resizer:active {
    background: var(--couleur-navigation);
}

.document-toolbar {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Fil d'Ariane */

#fil-arianne {
    padding: 0.4rem 0.6rem;
    background: var(--couleur-fond-bis);
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
}

#fil-arianne .breadcrumb-item + .breadcrumb-item::before {
    content: "›";
}

/* Arborescence */

.espace-item {
    margin-bottom: 0.5rem;
}

.espace-titre {
    cursor: pointer;
    padding: 0.5rem 0.6rem;
    border-radius: 0.5rem;
    transition: all 0.15s;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 3px solid transparent;
}

.dossier-titre {
    cursor: pointer;
    padding: 0.4rem 0.5rem;
    border-radius: 0.4rem;
    transition: all 0.15s;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 3px solid transparent;
}

.espace-titre:hover {
    background-color: rgba(0,0,0,0.04);
    border-left-color: var(--couleur-navigation);
}

.dossier-titre:hover {
    background-color: rgba(0,0,0,0.04);
    border-left-color: #ccc;
}

.espace-titre.actif {
    background-color: var(--couleur-navigation);
    font-weight: 700;
    border-left-color: #e09a30;
    color: #000;
}

.dossier-titre.actif {
    background-color: #ffdbb5;
    font-weight: 600;
    border-left-color: var(--couleur-navigation);
    color: #000;
}

/* Lignes d'arborescence */

.dossier-enfants {
    border-left: 1px solid #ddd;
    margin-left: 0.7rem;
    padding-left: 0.1rem;
    padding-bottom: 0.1rem;
}

.dossier-noeud {
    position: relative;
    margin: 0.08rem 0;
    padding-left: 0.7rem;
}

/* Petit L horizontal : part de la bordure verticale jusqu'au titre */
.dossier-noeud::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 0.7rem;
    height: 1px;
    background: #ddd;
    pointer-events: none;
}

/* Admin badge */

.admin-badge {
    display: inline-block;
    background-color: #dc3545;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.3rem;
    border-radius: 0.2rem;
    vertical-align: middle;
    line-height: 1.2;
}

/* Bouton supprimer dossier (visible au survol) */

.btn-supprimer-dossier {
    opacity: 0;
    transition: opacity 0.15s;
    font-size: 0.65rem;
    line-height: 1;
    margin-left: 0.3rem;
    vertical-align: middle;
}

.dossier-titre:hover .btn-supprimer-dossier {
    opacity: 1;
}

.dossier-noeud:hover > .dossier-titre .btn-supprimer-dossier {
    opacity: 1;
}

/* Drop zone */

.document-dropzone {
    border: 2px dashed #adb5bd;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    text-align: center;
    color: #adb5bd;
    margin-bottom: 0.5rem;
    transition: border-color 0.15s, background-color 0.15s, color 0.15s;
    font-size: 0.85rem;
    cursor: default;
}

.document-dropzone p {
    margin-bottom: 0;
}

.document-dropzone .bi {
    display: none;
}

.document-dropzone.drag-over {
    border-color: var(--couleur-navigation);
    background-color: rgba(255, 177, 78, 0.1);
    color: #6c757d;
    padding: 2rem;
}

.document-dropzone.drag-over .bi {
    display: inline-block;
}

/* Dossier survolé par drag */

.dossier-titre.drag-over {
    background-color: rgba(255, 177, 78, 0.2);
    border-left-color: var(--couleur-navigation);
    font-weight: 600;
}

/* Preview */

#apercu-contenu iframe,
#apercu-contenu video,
#apercu-contenu audio {
    max-width: 100%;
}

#apercu-contenu pre {
    max-height: 70vh;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* File link */

.lien-fichier {
    text-decoration: none;
    color: inherit;
}

.lien-fichier:hover {
    text-decoration: underline;
}

/* ---- Timeline événements ---- */

.timeline-container {
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem 0;
}

.timeline-year {
    position: relative;
}

.timeline-year::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50px;
    bottom: 0;
    transform: translateX(-50%);
    width: 3px;
    background: var(--couleur-navigation);
    opacity: 0.5;
}

.timeline-year::after {
    content: '';
    display: table;
    clear: both;
}

.timeline-year-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 0;
    gap: 1.5rem;
    clear: both;
    position: relative;
    z-index: 2;
}

.timeline-year-header::before,
.timeline-year-header::after {
    content: '';
    flex: 1;
    max-width: 30%;
    height: 2px;
    background: var(--couleur-navigation);
    opacity: 0.3;
}

.timeline-year-header span {
    display: inline-block;
    font-size: 2rem;
    font-weight: 700;
    background: var(--couleur-menu-hover);
    border-radius: 2rem;
    color: var(--couleur-navigation);
    padding: 0 1.5rem;
    flex-shrink: 0;
}

.timeline-item {
    position: relative;
    width: 50%;
    padding: 1rem 0;
    clear: both;
}

.timeline-item.left {
    float: left;
    padding-right: 2.5rem;
}

.timeline-item.right {
    float: left;
    margin-left: 50%;
    padding-left: 2.5rem;
}

.timeline-connector {
    position: absolute;
    top: 50%;
    width: 2rem;
    height: 2px;
    background: var(--couleur-navigation);
    opacity: 0.5;
}

.timeline-item.left .timeline-connector {
    right: 0;
}

.timeline-item.right .timeline-connector {
    left: 0;
}

.timeline-dot {
    position: absolute;
    top: 50%;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--couleur-navigation);
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px var(--couleur-navigation);
    transform: translateY(-50%);
    z-index: 1;
}

.timeline-item.left .timeline-dot {
    right: -8px;
}

.timeline-item.right .timeline-dot {
    left: -8px;
}

.timeline-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.timeline-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.timeline-card-img {
    width: 100%;
    height: 350px;
    object-fit: contain;
    background-color: #f5f5f5;
    display: block;
}

.timeline-card-img-placeholder {
    width: 100%;
    height: 350px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #ccc;
}

.timeline-card-body {
    padding: 1.25rem;
}

.timeline-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--couleur-texte);
}

.timeline-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #eee;
}

.timeline-card-meta-item {
    font-size: 0.875rem;
    color: var(--couleur-texte-clair);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.timeline-card-meta-item i {
    color: var(--couleur-navigation);
}

.timeline-card-desc {
    font-size: 0.9rem;
    color: var(--couleur-texte-clair);
    line-height: 1.6;
    margin-bottom: 0;
}

.timeline-card-desc p:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .timeline-year::before {
        left: 20px;
    }

    .timeline-item {
        width: 100%;
        float: none;
        padding: 1rem 0 1rem 3rem !important;
        margin-left: 0 !important;
    }

    .timeline-connector {
        left: 20px !important;
        width: 1.5rem;
    }

    .timeline-dot {
        left: 12px !important;
        right: auto !important;
    }

    .timeline-year-header::before,
    .timeline-year-header::after {
        max-width: 15%;
    }

    .timeline-card-img,
    .timeline-card-img-placeholder {
        height: 250px;
    }
}

@media (max-width: 576px) {
    .timeline-card-img,
    .timeline-card-img-placeholder {
        height: 200px;
    }

    .timeline-card-body {
        padding: 1rem;
    }

    .timeline-card-title {
        font-size: 1.1rem;
    }

    .timeline-year-header span {
        font-size: 1.5rem;
    }
}
