﻿/* =========================
   Variables globales
   ========================= */
:root {
    /* Couleurs principales */
    --blue: #007bff;
    --indigo: #6610f2;
    --purple: #6f42c1;
    --pink: #e83e8c;
    --red: #dc3545;
    --orange: #fd7e14;
    --yellow: #ffc107;
    --green: #28a745;
    --teal: #20c997;
    --cyan: #17a2b8;
    --white: #fff;
    --gray: #6c757d;
    --gray-dark: #343a40;
    --primary: #022D65;
    --secondary: #3a0ca3;
    --success: #4cc9f0;
    --info: #4895ef;
    --warning: #f72585;
    --danger: #e63946;
    --dark: #212529;
    --light: #f8f9fa;
    /* Couleurs de texte et de fond */
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --bg-primary: #ffffff;
    --bg-secondary: #f7fafc;
    --border-color: #e2e8f0;
    /* Ombres */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    /* Transitions et arrondis */
    --transition: all 0.3s ease;
    --radius: 10px;
    --radius-lg: 12px;
    /* Breakpoints responsive */
    --breakpoint-xs: 0;
    --breakpoint-sm: 576px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 992px;
    --breakpoint-xl: 1200px;
    /* Polices */
    --font-family-sans-serif: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
    --font-family-monospace: SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
}

/* =========================
   Layout général
   ========================= */
.page {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.page-main {
    flex: 1;
}

/* =========================
   Header et navigation
   ========================= */
.app-header {
    background: var(--primary);
    box-shadow: var(--shadow-md);
    padding: 0.4rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.header-brand {
    font-size: 1.5rem;
    font-weight: 400;
    color: white;
    text-decoration: none;
}
.header-brand:hover {
    color: rgba(255, 255, 255, 0.9);
}
.nav-link {
    color: rgba(255, 255, 255, 0.85);
    padding: 0.5rem 1rem;
    transition: var(--transition);
}
.nav-link:hover {
    color: white;
    transform: translateY(-2px);
}
.avatar {
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: var(--transition);
    border-radius: 50%;
}
.avatar:hover {
    border-color: white;
    transform: scale(1.05);
}

/* Dropdowns */
.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    animation: fadeIn 0.3s ease;
}
.dropdown-item {
    transition: var(--transition);
    padding: 0.75rem 1.25rem;
}
.dropdown-item:hover {
    background-color: var(--bg-secondary);
}

/* =========================
   Menu principal horizontal
   ========================= */
.horizontal-main {
    background: white;
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 999;
}
.horizontalMenu-list {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
    list-style: none;
}
.horizontalMenu-list > li {
    position: relative;
}
.horizontalMenu-list > li > a, .nav > li > a {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    color: var(--text-primary);
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}
.horizontalMenu-list > li > a:hover,
.horizontalMenu-list > li.active > a,
.nav > li > a:hover,
.nav > li.active > a {
    color: var(--primary);
    background-color: var(--bg-secondary);
    border-bottom-color: var(--primary);
}
.horizontalMenu-list > li > a .fa {
    margin-right: 0.5rem;
    width: 16px;
    text-align: center;
}

/* Sous-menus */
.sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    min-width: 200px;
    padding: 0.5rem 0;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
}
.horizontalMenu-list > li:hover .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.sub-menu li {
    list-style: none;
}
.sub-menu li a {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}
.sub-menu li a:hover {
    background-color: var(--bg-secondary);
    color: var(--primary);
    padding-left: 1.5rem;
}

/* =========================
   Contenu principal
   ========================= */
.main-content-container {
    padding: 1rem 0;
}

/* =========================
   Loader global
   ========================= */
#global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* =========================
   Cartes (cards)
   ========================= */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    border: none;
    transition: var(--transition);
}
.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    font-weight: 400;
    font-size: 1rem;
    color: var(--primary);
}
.card-body {
    padding: 1.25rem;
}

/* =========================
   Barre de navigation sticky
   ========================= */
.nav-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* =========================
   Formulaires
   ========================= */
.form-control {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.4rem 1rem;
    transition: var(--transition);
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.25);
}
.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* =========================
   Boutons
   ========================= */
.btn {
    border-radius: var(--radius);
    font-weight: 500;
    transition: var(--transition);
    border: none;
}
.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: #fff;
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.btn-secondary {
    background: #6c757d;
    color: white;
}
.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* =========================
   Modales
   ========================= */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
    background-color: var(--primary);
    color: white;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}
.modal-header .close {
    color: white;
    opacity: 0.8;
}
.modal-body {
    padding: 1.5rem;
}
.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
}

/* =========================
   Animations
   ========================= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.fadeIn {
    animation-name: fadeIn;
    animation-duration: 0.5s;
}

/* =========================
   Responsive design
   ========================= */
@media (max-width: 992px) {
    .horizontalMenu-list {
        flex-direction: column;
    }
    .horizontalMenu-list > li {
        width: 100%;
    }
    .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        width: 100%;
        display: none;
        margin-left: 1rem;
    }
    .horizontalMenu-list > li:hover .sub-menu {
        display: block;
    }
    .info-chips .col-6, .info-chips .col-md-3 {
        min-width: 50%;
        max-width: 50%;
    }
}
@media (max-width: 768px) {
    .main-content-container {
        padding: 1rem 0;
    }
    .card {
        margin-bottom: 1rem;
        padding: 0.3rem;
    }
    .card-body {
        padding: 0.3rem;
    }
    .header-brand {
        font-size: 1.2rem;
    }
    .badge-primary,
    .form-label {
        font-size: 0.88rem;
    }
    .info-chips .col-6, .info-chips .col-md-3 {
        min-width: 100%;
        max-width: 100%;
    }
    .page-title {
        font-size: 1rem;
    }
}

/* =========================
   Utilitaires
   ========================= */
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.rounded { border-radius: var(--radius) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.text-primary { color: var(--primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.bg-light { background-color: var(--bg-secondary) !important; }

/* =========================
   Dropdown user menu
   ========================= */
.user-menu-container { position: relative; }
.dropdown-menu-right { right: 0; left: auto; }

/* =========================
   Fix Bootstrap conflicts
   ========================= */
.container { max-width: 100%; }
.row { margin-right: 0; margin-left: 0; }

/* =========================
   Tableaux personnalisés
   ========================= */
.table-width-custom { width: 100% !important; }

/* =========================
   Clearfix
   ========================= */
.clearfix:after {
    content: "";
    display: table;
    clear: both;
}

/* =========================
   Correction box-sizing
   ========================= */
*, ::after, ::before {
    box-sizing: border-box !important;
}

/* =========================
   Styles spécifiques pages
   ========================= */
/* Mission Page */
.hidden { display: none; }
.btn-group .dropdown-menu .dropdown-item:hover {
    color: #800080;
    cursor: pointer;
}
.btn-group .dropdown-menu .dropdown-item {
    transition: color 0.3s;
}
.oval-button {
    border-radius: 50px;
    padding: 1px 2px;
    margin: 0 1px;
}
.tr-grise {
    color: #b0b0b0;
    text-decoration: line-through;
    opacity: 0.5;
    pointer-events: none;
}

/* Tache Page */
.breadcrumb {
    background: none;
    font-size: 0.95rem;
}
.breadcrumb-item.active {
    color: var(--primary);
    font-weight: 500;
}
.form-control[readonly], textarea[readonly] {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    color: var(--primary);
    font-size: 0.95rem;
}

/* =========================
   Grille responsive pour info chips
   ========================= */
.info-chips .col-6, .info-chips .col-md-3 {
    min-width: 140px;
}

/* =========================
   Statistiques interactives
   ========================= */
.stat {
    transition: background-color 0.3s ease;
}
.stat:hover {
    background-color: #022D65;
    color: #ffffff;
    cursor: pointer;
}

/* =========================
   Modale personnalisée
   ========================= */
.align-bottom-right-absolute {
    position: absolute;
    bottom: 0;
    right: 0;
}
.modal-custom .modal-dialog {
    max-width: 55%;
}
.modal-custom .form-control {
    width: 100%;
}
.modal-custom .select2-container {
    width: 100% !important;
}

/* =========================
   Marges utilitaires
   ========================= */
.mb-5, .my-5 {
    margin-bottom: 1rem !important;
}

/* =========================
   Sélecteurs personnalisés pour select2
   ========================= */
.select2-multiple, .select2-tache {
    min-height: 38px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    padding: 0.4rem 1rem;
    width: 100%;
    font-size: 1rem;
    background: #fff;
}

/* =========================
   Toast notifications
   ========================= */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}
.toast {
    min-width: 260px;
    max-width: 350px;
    background: #fff;
    color: #222;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    padding: 1rem 1.5rem 1rem 1rem;
    display: flex;
    align-items: center;
    font-size: 1rem;
    opacity: 0.98;
    border-left: 6px solid var(--info);
    animation: fadeIn 0.5s;
    pointer-events: auto;
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-info { border-left-color: var(--info); }
.toast .toast-icon {
    margin-right: 0.75rem;
    font-size: 1.3rem;
}
.toast .toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #888;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}
.toast .toast-close:hover { color: #222; }
/* =========================
   Tooltip Toast notifications
   ========================= */
.tooltip-toast {
    position: absolute;
    z-index: 10000;
    min-width: 180px;
    max-width: 260px;
    background: #fff;
    color: #222;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.13);
    padding: 0.7rem 1rem;
    font-size: 0.98rem;
    border-left: 4px solid var(--info);
    opacity: 0.98;
    display: flex;
    align-items: center;
    pointer-events: auto;
    transition: opacity 0.2s;
}
.tooltip-toast.toast-success { border-left-color: var(--success); }
.tooltip-toast.toast-error { border-left-color: var(--danger); }
.tooltip-toast.toast-info { border-left-color: var(--info); }
.tooltip-toast .toast-icon {
    margin-right: 0.6rem;
    font-size: 1.1rem;
}
.tooltip-toast .toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #888;
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.2s;
}
.tooltip-toast .toast-close:hover { color: #222; }
.tooltip-toast .tooltip-arrow {
    position: absolute;
    left: 18px;
    top: -8px;
    width: 16px;
    height: 8px;
    overflow: hidden;
}
.tooltip-toast .tooltip-arrow::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0;
    width: 8px;
    height: 8px;
    background: #fff;
    border-left: 4px solid inherit;
    border-radius: 2px 2px 0 0;
    box-shadow: 0 -2px 6px rgba(0,0,0,0.08);
    transform: rotate(45deg);
}