/* ============================================
   CSS COMMUN - Pack Office
   Styles partagés entre toutes les pages
   ============================================ */

:root {
    --brand: #F39221;
    --brand-hover: #e0851d;
    --brand-light: rgba(243, 146, 33, 0.1);
    --text-primary: #1a1a1a;
    --text-secondary: #495057;
    --border-color: #e0e0e0;
    --bg-white: #ffffff;
    --bg-light: #f8f9fa;
    --bg-sidebar: #fafbfc;
    --header-bg: #f8f9fa;
    --header-text: #1a1a1a;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --radius: 8px;
    --sidebar-width: 280px;
    /* Largeur normale du sidebar */
    --sidebar-width-collapsed: 80px;
    /* Largeur réduite du sidebar en mode collapsed */
    --header-height: 70px;
    --swal2-confirm-button-background-color: var(--brand);
    --swal2-confirm-button-color: var(--text-primary);/*#fff*/;
}
button,
.btn:focus,
.btn:active,
.btn:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}
/* Logo */
/* Logo branding : taille max fixe pour ne pas affecter l'affichage (object-fit préserve les proportions) */
.navbar-brand img,
.branding-logo,
.app-header .navbar-brand img {
    max-height: 56px;
    max-width: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: left center;
    display: block;
}
/* Users Table */
.users-table-container {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table thead {
    background: var(--bg-light);
    border-bottom: 2px solid var(--border-color);
}

.users-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.users-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.users-table tbody tr:hover {
    background: var(--bg-light);
}

.users-table tbody tr:last-child {
    border-bottom: none;
}

.users-table tbody td {
    padding: 1rem;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.action-btn:hover {
    background: var(--brand-light);
    color: var(--brand);
}

.status-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
}
.status-active {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}
.status-inactive {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}
.dept-description {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
*{
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-primary);
    background: var(--bg-light);
    line-height: 1.6;
    overflow-x: hidden;
}
/* ========== Modale plein écran : voir enregistrement ========== */
#viewEnregistrementModal .modal-content {
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

#viewEnregistrementModal .modal-header {
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
}

#viewEnregistrementModal .modal-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

/* ----- Liste des documents (gauche) - style aligné projet ----- */
#viewEnregistrementModal .view-enr-doc-list {
    background: var(--bg-white) !important;
    border-right: 1px solid var(--border-color) !important;
}

    #viewEnregistrementModal .view-enr-doc-list .p-2.small {
        color: var(--text-secondary);
        font-weight: 600;
        border-bottom: 1px solid var(--border-color);
    }

#viewEnregistrementModal #viewEnrDocList {
    list-style: none;
    padding: 0;
    margin: 0;
    border: none;
}

#viewEnregistrementModal #viewEnrDocList .view-enr-doc-item {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-primary);
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-white);
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

#viewEnregistrementModal #viewEnrDocList .view-enr-doc-item:hover {
    background: var(--brand-light);
    color: var(--brand);
}

#viewEnregistrementModal #viewEnrDocList .view-enr-doc-item.active {
    background: var(--brand-light);
    color: var(--brand);
    font-weight: 500;
}

/* Premier / dernier item : coins arrondis comme dropdown du projet */
#viewEnregistrementModal #viewEnrDocList .view-enr-doc-item:first-child {
    border-radius: 6px 6px 0 0;
}


.form-card input,
.form-card select2,
.form-card select {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: black !important;
}
/* error message */
.msg {
    font-weight: normal;
    text-align: center;
    align-content: center;
    margin-inline: 10px;
    padding: 10px;
    border-radius: 5px;
}

.msg-success {
    background-color: #d4edda;
    color: #155724;
}
.msg-error {
    background-color: #f8d7da;
    color: #721c24;
}
.msg-info {
    background-color: #cce5ff;
    color: #004085;
}
/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn-cancel {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-white);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-cancel:hover {
    background: var(--bg-light);
    border-color: var(--brand);
    color: var(--brand);
}

.btn-submit {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    background: var(--brand);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-submit:hover {
    background: var(--brand-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(243, 146, 33, 0.3);
}

.btn-submit:active {
    transform: translateY(0);
}

.input-for-sign input,
.input-for-sign textarea{
    font-size: 14px !important;
    color: black;
}
.form-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}
.utilisateur-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem !important;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 1rem !important;
}

.form-group input,
.form-group select2,
.form-group select {
    margin-top: 0.5rem !important;
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.required {
    color: #dc3545;
}

/* Aligner la hauteur du Select2 (single) sur .form-control */
.select2-container--default .select2-selection--single {
    height: auto !important;
    min-height: calc(1.3em + 0.70rem + 0.70rem) !important; /* même hauteur que form-control */
    padding: 0.55rem 1rem !important;
    padding-right:1.5rem !important; 
    line-height: 1.5 !important;
    /*display: flex !important;*/
    align-items: center !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius) !important;
    font-size: 0.95rem !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 0 !important;
    line-height: 1.5 !important;
    display: block !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100% !important;
    top: 0 !important;
    right: 0.5rem !important;
}

.select2 {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius) !important;
    font-size: 0.95rem !important;
    transition: all 0.2s ease !important;
    font-family: inherit !important;
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius) !important;
    font-size: 0.95rem !important;
    transition: all 0.2s ease !important;
    font-family: inherit !important;
}
.select2-selection__choice__remove,
.select2-selection__clear {
    color: red !important;
}
.select2-selection__choice {
   color: black !important;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--brand) !important; /*#5897fb;*/
    color: white;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #ddd !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--brand) !important;
    border: 1px solid #aaa;
    color: ivory;
    border-radius: 4px;
    cursor: default;
    float: left;
    margin-right: 5px;
    margin-top: 5px;
    padding: 0 5px;
}
.form-input-mode {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius) !important;
    font-size: 0.95rem !important;
    transition: all 0.2s ease !important;
    font-family: inherit !important;
    padding: 0.65rem 1rem 0.65rem 5.5rem !important;
}

.form-control {
    padding: 0.75rem 1rem !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius) !important;
    font-size: 0.95rem !important;
    transition: all 0.2s ease !important;
    font-family: inherit !important;
}
.select2-container--default.select2-container--focus .select2-selection--multiple,
.form-input-mode:focus,
.form-control:focus {
    outline: none !important;
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 3px var(--brand-light) !important;
}

.form-control::placeholder {
    color: var(--text-secondary) !important;
    opacity: 0.6 !important;
}

.timeout-dialog-popup {
    font-family: 'Segoe UI', Arial, sans-serif !important;
}

.timeout-dialog-popup .swal2-title {
    color: #f44336 !important;
    font-size: 24px !important;
}

.timeout-keep-alive-btn {
    padding: 12px 30px !important;
    font-size: 16px !important;
}

.timeout-sign-out-btn {
    padding: 12px 30px !important;
    font-size: 16px !important;
}

#timeout-countdown {
    display: inline-block;
    min-width: 40px;
    animation: pulse 1s infinite;
}

@font-face {
    font-family: 'BalletSign';
    src: url('/Fonts/Ballet/Ballet_24pt-Regular.ttf') format('woff2'), 
        url('/Fonts/Ballet/Ballet_28pt-Regular.ttf') format('woff'), 
        url('/Fonts/Ballet/Ballet_48pt-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'LicoriceSign';
    src: url('/Fonts/Licorice/Licorice-Regular.ttf') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'CherishSign';
    src: url('/Fonts/Cherish/Cherish-Regular.ttf') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'ZeyadaSign';
    src: url('/Fonts/Zeyada/Zeyada-Regular.ttf') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

.text-initial:hover {
    cursor: pointer;
}

.table-signataire {
    padding: 20px;
    background-color: white;
    border-radius: 10px;
    margin-top: 30px;
}

    .table-signataire tr {
        font-size: 14px !important;
    }

/* ============================================
   HEADER
   ============================================ */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--header-bg);
    color: var(--header-text);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.navbar-brand,
.brand-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand) !important;
    margin: 0;
}

.navbar-nav,
.header-nav {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.navbar-nav a,
.header-nav a,
.app-header .nav-link {
    color: var(--header-text, var(--text-secondary)) !important;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0;
    transition: color 0.2s ease;
    position: relative;
}

/* Annule Bootstrap text-dark dans le header pour utiliser la couleur branding */
.app-header .nav-link.text-dark {
    color: var(--header-text, var(--text-secondary)) !important;
}

.navbar-nav a:hover,
.navbar-nav a.active,
.header-nav a:hover,
.header-nav a.active,
.app-header .nav-link:hover,
.app-header .nav-link.active {
    color: var(--brand) !important;
}
.navbar-nav a.active::after,
.header-nav a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--brand) !important;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.app-header .lang-selector {
  border-color: color-mix(in srgb, var(--header-text) 35%, transparent);
  background: color-mix(in srgb, var(--header-text) 12%, transparent);
  color: var(--header-text);
}

.lang-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-white);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.app-header .lang-selector:hover {
  border-color: var(--header-text);
  background: color-mix(in srgb, var(--header-text) 22%, transparent);
  color: var(--header-text);
}

.lang-selector:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.app-header .user-info {
  background: color-mix(in srgb, var(--header-text) 12%, transparent);
  color: var(--header-text);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  background: var(--bg-light);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
}

.btn-create-template {
  background: #007bff;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-create-template:hover {
  background: #0056b3;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

/* ============================================
   SIDEBAR
   ============================================ */

/* Hauteur fixe du bloc arbre des templates + scroll */
.folder-tree {
    height: 250px;
    max-height: 25vh;
    min-height: 100px;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
}

/* Optionnel : style de la scrollbar */
.folder-tree::-webkit-scrollbar {
    width: 3px;
}
.folder-tree::-webkit-scrollbar-track {
    background: var(--bg-sidebar, #fafbfc);
    border-radius: 3px;
}
.folder-tree::-webkit-scrollbar-thumb {
    background: var(--border-color, #ddd);
    border-radius: 3px;
}
.folder-tree::-webkit-scrollbar-thumb:hover {
    background: var(--brand, #F39221);
}
.app-sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding-top: 1.5rem;
    padding-bottom: 1rem;
    /*padding-left: 1.5rem;*/
    overflow-y: auto;
    z-index: 999;
    transition: transform 0.3s ease;
}

.app-sidebar .sidebar-footer,
.app-sidebar .sidebar-create-envelope,
.app-sidebar .sidebar-search {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

.app-sidebar {
    display: flex;
    flex-direction: column;
    /* garder le reste (position, width, height, etc.) */
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.sidebar-footer {
    flex-shrink: 0;
    padding: 1rem 0 0;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sidebar-organisation-label {
    display: block;
    font-weight: 600;
    color: var(--brand);
    margin-bottom: 0.25rem;
}

.sidebar-organisation-name {
    display: block;
    word-break: break-word;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  margin-top: -1rem;
}

.sidebar-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

.sidebar-toggle {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-white) !important;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.sidebar-toggle:hover {
  background: var(--brand-light);
  color: var(--brand);
  border-color: var(--brand);
}

.sidebar-search {
  position: relative;
  margin-bottom: 1.5rem;
}

.sidebar-search input {
  width: 100%;
  max-height: 20px;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-white);
  font-size: 0.9rem;
  transition: all 0.2s ease;
  color: black;
}

.sidebar-search input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.sidebar-search-icon {
  position: absolute;
  right: 1.5rem !important;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}

.sidebar-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-menu-item {
  margin-bottom: 0.5rem;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    /*justify-content: space-between;*/
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    font-size: 0.95rem;
    margin: 0 0.5rem;
    gap: 6px;
}

.sidebar-menu-link:hover {
  background: var(--bg-white);
  color: var(--brand);
}

.sidebar-menu-link.active {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
}

.sidebar-menu-icon {
  margin-right: 0.75rem;
  font-size: 1.1rem;
}

.sidebar-menu-arrow {
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.sidebar-menu-link.active .sidebar-menu-arrow,
.sidebar-menu-item.has-submenu.open .sidebar-menu-arrow {
  transform: rotate(90deg);
}

.sidebar-footer-superadmin {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 1rem;
}

.sidebar-user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--brand, #F39221);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    margin-bottom: 0.35rem;
}

.sidebar-user-role {
    font-weight: 700;
    /*color: #fff;*/
    display: block;
    font-size: 0.9rem;
}

.sidebar-user-email {
    font-size: 0.8rem;
    /*color: rgba(255,255,255,0.6);*/
}

.sidebar-brand-link {
    display: block;
    padding: 0.5rem 0;
}

/* Sidebar Submenu */
.sidebar-submenu {
  list-style: none;
  margin: 0.25rem 0 0.5rem 0;
  padding-left: 0;
  display: none;
}

.sidebar-menu-item.has-submenu.open > .sidebar-submenu {
  display: block;
}

.sidebar-submenu-item {
  margin: 0.15rem 0;
}

.sidebar-submenu-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem 0.35rem 2.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius);
  transition: all 0.2s ease;
}

.sidebar-submenu-link i {
  font-size: 1rem;
}

.sidebar-submenu-link:hover {
  background: var(--bg-white);
  color: var(--brand);
}

/* Sidebar Divider */
.sidebar-divider {
  margin: 1.5rem 0;
  position: relative;
  text-align: center;
}

.sidebar-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-color);
}

.sidebar-divider-text {
  position: relative;
  background: var(--bg-sidebar);
  padding: 0 0.5rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
}

/* Create Envelope Button */
.sidebar-create-envelope {
  margin-top: 1rem;
}

.create-envelope-btn {
  width: 100%;
  background: var(--header-bg);
  color: var(--header-text);
  /*  background: var(--text-primary);*/
  /*  color: white;*/
  border: none;
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
}

.create-envelope-btn:hover {
    background: color-mix(in srgb, var(--header-bg) 85%, black);
    color: var(--header-text);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.create-envelope-btn i {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.create-envelope-content {
  flex: 1;
}

.create-envelope-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.create-envelope-subtitle {
  font-size: 0.8rem;
  opacity: 0.9;
  line-height: 1.4;
}


/*  test  */
.sidebar-menu-link-sup-admin {
    display: flex;
    align-items: center;
    /*justify-content: space-between;*/
    padding: 0.75rem 1rem;
    color: rgba(255,255,255,0.95);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    font-size: 0.95rem;
    margin: 0 0.5rem;
    gap: 6px;
}
.sidebar-menu-link-sup-admin:hover {
    background: var(--bg-white);
    color: var(--brand);
}

.sidebar-menu-link-sup-admin.active {
    background: var(--brand-light);
    color: var(--brand);
    font-weight: 600;
}
.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.55);
    margin: 1rem 0 0.4rem;
    padding-left: 1rem;
}
.sidebar-footer-super-admin {
    display: flex;
    align-items: center;
    gap: 12px; /* espace avatar <-> texte */
    color: white !important;
}

.sidebar-user-avatar {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    min-width: 0; /* important pour text-truncate si besoin */
}

.sidebar-user-role {
    font-weight: 700;
}

.sidebar-user-email {
    font-size: 0.85rem;
    opacity: 0.85;
    /* optionnel si email long */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.app-main {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 2rem;
    padding-top: 1rem;
    /*min-height: calc(100vh - var(--header-height));*/
}

.content-container {
    /*max-width: 1400px;*/
    margin: 0 auto;
}

/* ============================================
   JSTREE
   ============================================ */
.jstree-wholerow-hovered {
    background: #faf0e5 !important;
    border-radius: 3px !important;
    color: #f49221 !important;
}

/*.jstree-anchor {
    color: #f49221 !important;
    font-size: 18px !important;
}*/

.jstree-wholerow-clicked {
    background: rgba(243, 146, 33, 0.2) !important;
    border-radius: 3px !important;
}


.jstree-default .jstree-hovered > .jstree-anchor {
    color: #E65100 !important;
    font-weight: 500 !important;
}

/* Sélection - Orange plus foncé */
/*.jstree-default .jstree-clicked {
    background: rgba(243, 146, 33, 0.2) !important;
    border-radius: 6px !important;
}*/

.jstree-default .jstree-clicked > .jstree-anchor {
    color: #E65100 !important;
    font-weight: 600 !important;
}

/* Hover + Sélection */
/*.jstree-default .jstree-clicked.jstree-hovered {
    background: rgba(243, 146, 33, 0.3) !important;
}*/
/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    background-color: var(--brand) !important;
    border-color: var(--brand) !important;
    color: white !important;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
  background-color: var(--brand-hover)!important;
  border-color: var(--brand-hover) !important;
  color: white !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(243, 146, 33, 0.3);
}

.btn-secondary {
  background-color: var(--bg-white) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary)!important;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  transition: all 0.2s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-secondary:hover {
  background-color: var(--bg-light) !important;
  border-color: var(--brand) !important;
  color: var(--brand)!important;
}

button.disabled {
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem !important;
    opacity: 0.5 !important;
    cursor: alias !important;
    pointer-events: none !important; /* Empêche tous les clics */
}

.btn-light-primary {
    background: var(--brand) !important;
    border-color: var(--brand) !important;
    font-size: 14px;
    color: white !important;
    padding: 0.30rem 0.5rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-light-primary:hover {
    background: var(--brand-hover) !important;
    border-color: var(--brand-hover) !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(243, 146, 33, 0.3);
}

.btn-light-secondary {
    background: var(--bg-white) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    padding: 0.30rem 0.5rem;
    font-size: 14px;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-light-secondary:hover {
    background: var(--bg-light) !important;
    border-color: var(--brand) !important;
    color: var(--brand) !important;
}

/* Pagination */
.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    border-radius: var(--radius);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.page-btn:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.page-btn.active {
    background: var(--brand);
    border-color: var(--brand);
    color: white;
    min-width: 36px;
    height: 36px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.pagination-pages span {
    color: var(--text-secondary);
    padding: 0 0.5rem;
}


/* ============================================
   DOC COMPLETED PAGE - Styles spécifiques
   ============================================ */

.doc-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.page-subtitle {
    color: var(--text-secondary);
    margin: 0;
    font-size: 1rem;
}

.doc-actions {
    display: flex;
    gap: 0.75rem;
}

/* Filters Bar */
.filters-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem 0;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Form Styles */
.form-control {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 15px;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(243, 146, 33, 0.1);
    outline: none;
}

.filter-item label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.filter-item .form-control {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.filter-item .form-control:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-light);
}


/* ============================================
   MAIN CONTENT AREA
   ============================================ */

/* 
 * Zone de contenu principal
 * S'adapte automatiquement à la largeur du sidebar
 * Transition fluide lors du changement d'état
 */
.app-main {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 2rem;
    min-height: calc(100vh - var(--header-height));
    /* Transition pour s'adapter au sidebar collapsed */
    transition: margin-left 0.3s ease;
}

/* 
 * Ajuste la marge gauche du contenu principal
 * quand le sidebar est en mode collapsed
 */
.app-sidebar.collapsed ~ .app-main {
    margin-left: 80px !important;
}

.content-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

/* ============================================
   RESPONSIVE
   ============================================ */
/* 
 * Tablettes et petits écrans (≤ 991.98px)
 * Sur mobile/tablette, le sidebar est caché par défaut
 * et s'affiche en overlay quand on clique sur le toggle
 */
@media (max-width: 991.98px) {
    .header-menu-toggle {
        display: block !important;
    }

    .sidebar-header-nav {
        display: block !important;
    }

    /* 
   * Ajuste l'espacement du header-left sur mobile
   * pour accommoder le bouton menu burger
   */
    .header-left {
        gap: 1rem;
    }

    /* 
   * Sidebar caché par défaut sur mobile
   * Utilise transform pour une animation fluide
   */
    .app-sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
        /* Force la largeur normale sur mobile */
        padding: 1.5rem;
        /* Force le padding normal sur mobile */
    }

        /* 
   * Sidebar visible quand la classe "open" est ajoutée
   * S'affiche en overlay par-dessus le contenu
   */
        .app-sidebar.open {
            transform: translateX(0);
            box-shadow: var(--shadow-md);
            /* Ombre pour l'effet overlay */
            z-index: 1001;
            /* Au-dessus du header (z-index: 1000) */
        }

    /* 
   * Overlay sombre en arrière-plan quand le sidebar est ouvert sur mobile
   * Créé dynamiquement par JavaScript pour permettre de fermer en cliquant dessus
   */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        /* Entre le header et le sidebar */
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

        .sidebar-overlay.active {
            opacity: 1;
            pointer-events: auto;
        }

    /* 
   * En mode collapsed sur mobile, on garde la largeur normale
   * pour une meilleure expérience utilisateur
   */
    .app-sidebar.collapsed {
        width: var(--sidebar-width);
        padding: 1.5rem;
    }
    

        /* 
   * Restaure les éléments cachés en mode collapsed
   * sur mobile pour une navigation complète
   */
        .app-sidebar.collapsed .sidebar-title,
        .app-sidebar.collapsed .sidebar-search,
        .app-sidebar.collapsed .sidebar-menu-link span,
        .app-sidebar.collapsed .sidebar-menu-arrow,
        .app-sidebar.collapsed .sidebar-divider,
        .app-sidebar.collapsed .create-envelope-content {
            display: block;
            opacity: 1;
        }

        .app-sidebar.collapsed .sidebar-header {
            justify-content: space-between;
        }

        .app-sidebar.collapsed .sidebar-menu-link {
            justify-content: space-between;
            padding: 0.75rem 1rem;
        }

        .app-sidebar.collapsed .sidebar-menu-icon {
            margin-right: 0.75rem;
        }

        .app-sidebar.collapsed .create-envelope-btn {
            justify-content: flex-start;
            align-items: flex-start;
            padding: 1rem;
        }

        .app-sidebar.collapsed .create-envelope-btn i {
            font-size: 1.25rem;
        }

    /* 
 * Navigation du header dans le sidebar
 * Section qui affiche les liens de navigation du header (Tableau de bord, Paramètres, etc.)
 * Visible uniquement sur mobile ou quand le sidebar est ouvert
 */

.sidebar-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-nav-item {
    margin: 0;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
}

.sidebar-nav-link:hover {
    background: var(--bg-white);
    color: var(--brand);
}

.sidebar-nav-link.active {
    background: var(--brand-light);
    color: var(--brand);
    font-weight: 600;
    position: relative;
}

.sidebar-nav-link.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--brand);
    border-radius: 0 2px 2px 0;
}

.sidebar-nav-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-nav-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

    /* 
   * Le contenu principal prend toute la largeur sur mobile
   * car le sidebar est en overlay
   */
    .app-main {
        margin-left: 0;
    }

    /* 
   * Cache la navigation du header sur mobile
   * pour économiser l'espace
   */
    .header-nav {
        display: none;
    }

    /* 
   * Simplifie les éléments du header-right sur mobile
   * Cache le sélecteur de langue et le texte de l'utilisateur
   * Garde seulement l'avatar pour économiser l'espace
   */
    .lang-selector {
        display: none;
        /* Cache le sélecteur de langue sur mobile */
    }

    .user-info span {
        display: none;
        /* Cache le texte de l'email sur mobile */
    }

    .user-info .bi-chevron-down {
        display: none;
        /* Cache la flèche du menu utilisateur sur mobile */
    }

    /* 
   * Réduit le padding du header sur mobile
   * pour maximiser l'espace disponible
   */
    .app-header {
        padding: 0 1rem;
    }

    /* 
   * Réduit la taille du nom de la marque sur mobile
   * pour laisser plus de place au menu burger
   */
    .brand-name {
        font-size: 1.1rem;
    }
}

/* 
 * Petits écrans mobiles (≤ 575.98px)
 * Ajustements supplémentaires pour très petits écrans
 */
@media (max-width: 575.98px) {
    .app-header {
        padding: 0 0.75rem;
        /* Padding encore plus réduit sur très petits écrans */
    }

    .app-main {
        padding: 1rem;
    }

    .brand-name {
        font-size: 1rem;
        /* Taille encore plus petite sur très petits écrans */
    }

    .navbar-brand img,
    .branding-logo {
        max-height: 44px;
        max-width: 140px;
    }

    /* 
   * Sidebar en pleine largeur sur très petits écrans
   * pour une meilleure lisibilité
   */
    .app-sidebar {
        width: 100%;
        max-width: 100%;
    }

    /* 
   * Réduit encore plus les éléments du header sur très petits écrans
   * Garde seulement le menu burger et l'avatar
   */
    .header-right {
        gap: 0.5rem;
        /* Réduit l'espacement entre les éléments */
    }

    .user-info {
        padding: 0.5rem;
        /* Padding réduit pour l'avatar */
    }

    .user-avatar {
        width: 28px;
        /* Avatar légèrement plus petit */
        height: 28px;
        font-size: 0.85rem;
    }
}

/* ============================================
   UTILITIES
   ============================================ */
.text-muted {
    color: var(--text-secondary) !important;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mt-5 {
    margin-top: 3rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mb-5 {
    margin-bottom: 3rem;
}

.d-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 1rem;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
}

.toast {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 300px;
    animation: slideInRight 0.3s ease;
    position: relative;
}

    .toast.success {
        border-left: 4px solid #28a745;
    }

    .toast.error {
        border-left: 4px solid #dc3545;
    }

    .toast.warning {
        border-left: 4px solid #ffc107;
    }

    .toast.info {
        border-left: 4px solid #17a2b8;
    }

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: #28a745;
}

.toast.error .toast-icon {
    color: #dc3545;
}

.toast.warning .toast-icon {
    color: #ffc107;
}

.toast.info .toast-icon {
    color: #17a2b8;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.toast-message {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .toast-close:hover {
        background: var(--bg-light);
        color: var(--text-primary);
    }

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.fade-out {
    animation: slideOutRight 0.3s ease forwards;
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ============================================
   LOADING STATES
   ============================================ */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--bg-light);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner-large {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: var(--radius);
}

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

    .btn-loading::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 16px;
        height: 16px;
        border: 2px solid transparent;
        border-top-color: currentColor;
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
    }

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */
*:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--brand);
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    z-index: 10001;
    border-radius: 0 0 var(--radius) 0;
}

    .skip-link:focus {
        top: 0;
    }

/* ============================================
   TOOLTIPS
   ============================================ */
[data-tooltip] {
    position: relative;
}

    [data-tooltip]:hover::after {
        content: attr(data-tooltip);
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%);
        padding: 0.5rem 0.75rem;
        background: #333;
        color: white;
        font-size: 0.85rem;
        white-space: nowrap;
        border-radius: 4px;
        margin-bottom: 0.5rem;
        z-index: 1000;
        pointer-events: none;
        animation: fadeIn 0.2s ease;
    }

    [data-tooltip]:hover::before {
        content: '';
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%);
        border: 5px solid transparent;
        border-top-color: #333;
        margin-bottom: -5px;
        z-index: 1000;
        pointer-events: none;
    }

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}



/* ============================================
   SIDEBAR OVERLAY (Mobile)
   ============================================ */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
SIDEBAR COLLAPSED STATE (Desktop)
============================================ */
.app-sidebar.collapsed .sidebar-content {
    overflow: hidden
}
.app-sidebar.collapsed{
   
    max-width: 80px;
    overflow: hidden;
    padding: 0;
}

.workflow-setup-layout .document-content-vide {
    margin-left: var(--sidebar-width);
}

.app-sidebar.collapsed ~ .workflow-setup-layout .document-content-vide {
    margin-left: 4rem;
}

.app-sidebar.collapsed .create-envelope-content {
    max-width: 10px;
    max-height: 30px;
    padding: 0;
}
.app-sidebar.collapsed .sidebar-title{
    display: none;
}
.app-sidebar.collapsed .sidebar-title,
.app-sidebar.collapsed .sidebar-search,
.app-sidebar.collapsed .sidebar-search input,
.app-sidebar.collapsed .sidebar-divider-text,
.app-sidebar.collapsed .create-envelope-content,
.app-sidebar.collapsed .jstree {
    opacity: 0;
    visibility: hidden;
}

.app-sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}
.app-sidebar.collapsed .sidebar-toggle  {
    margin-top: 2rem;
    margin-left: 1rem;
}

/* ============================================
   TOOLTIPS en mode collapsed
   ============================================ */
[data-tooltip] {
    position: relative;
}

.app-sidebar.collapsed [data-tooltip]:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 10px;
    padding: 8px 12px;
    background: #333;
    color: white;
    font-size: 13px;
    white-space: nowrap;
    border-radius: 6px;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.app-sidebar.collapsed [data-tooltip]:hover::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 4px;
    border: 6px solid transparent;
    border-right-color: #333;
    z-index: 9999;
}

/* ============================================
   SIDEBAR SEARCH ICON
   ============================================ */
.sidebar-search {
    position: relative;
}

.sidebar-search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.sidebar-search input {
    padding-right: 35px;
}

/* ============================================
   SIDEBAR SCROLLED STATE
   ============================================ */
.app-sidebar.scrolled .sidebar-header {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ============================================
   MOBILE STYLES
   ============================================ */
@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        left: -280px;
        transition: left 0.3s ease;
        z-index: 999;
    }

        .app-sidebar.open {
            left: 0;
        }

        /* Cache les tooltips sur mobile */
        .app-sidebar [data-tooltip]:hover::before,
        .app-sidebar [data-tooltip]:hover::after {
            display: none;
        }
}

/* ============================================
   HEADER MENU TOGGLE (Mobile)
   ============================================ */
.header-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    padding: 8px;
    cursor: pointer;
    color: #333;
    margin-right: 15px;
}

.sidebar-header-nav {
    display: none ;
}


.header-menu-toggle:hover {
    color: #F39221;
}

/* ============================================
   JSTREE SEARCH HIGHLIGHT
   ============================================ */
.jstree-search {
    font-weight: bold;
    background-color: yellow;
    color: black;
}




/* Pour manage template debut */
.ct-input-wrapper {
    visibility: hidden
}

.ct-drop-down-container {
    margin-top: -2rem !important;
}

/* Access Management  */
.access-management {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.access-filters {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.filter-separator {
    padding: 0.5rem 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    align-self: center;
}

.access-actions {
    display: flex;
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 991.98px) {
    .fab {
        left: 2rem;
    }

    .access-filters {
        flex-direction: column;
    }

    .filter-separator {
        align-self: flex-start;
    }
}
/* Pour manage template fin */


/* table status */
.table-status-signed {
    background: #F39221;
    color: var(--brand);
}

.table-status-completed {
    background: #e9f6ec;
    color: #28a780;
}
/*Pending - Orange */
.table-status-pending {
    background: #FF98001A;
    color: #E65100;
}

/*Not Started - Gris */
.table-status-not-started,
.table-status-isdraft,
.table-status-notstarted {
    background: #9E9E9E1A;
    color: #424242;
}

/*Declined - Rouge */
.table-status-declined {
    background: #D32F2F1A;
    color: #B71C1C;
}

/*Recalled - Bleu */
.table-table-status-recalled {
    background: #2196F31A;
    color: #0D47A1;
}

/* Expired - Ambre */
.table-status-expired {
    background: #FF8F001A;
    color: #E65100;
}

Deleted-Rouge
.table-status-deleted {
    background: #F443361A;
    color: #C62828;
}

/* Completed - Vert */
.table-status-completed,
.table-status-success {
    background: #4CAF501A;
    color: #1B5E20;
}

/*In Progress - Bleu */
.table-status-in-progress {
    background: #03A9F41A;
    color: #01579B;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 14px;
    display: inline-block;
    font-weight: 500;
}

/* Warning - Jaune */
.status-warning {
    background: #FFC1071A;
    color: #F57F17;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 14px;
    display: inline-block;
    font-weight: 500;
}


/* Buttons */
.btn-brand {
    background-color: var(--brand);
    border-color: var(--brand);
    color: white;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-brand:hover {
    background-color: var(--brand-hover);
    border-color: var(--brand-hover);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(243, 146, 33, 0.3);
}

.btn-brand:active {
    transform: translateY(0);
}

.btn-outline-brand {
    border-color: var(--border-color);
    color: var(--text-primary);
    font-weight: 500;
    padding: 12px 24px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-outline-brand:hover {
    background-color: var(--bg-light);
    border-color: var(--border-color);
    color: var(--text-primary);
}
/* Logs styles */
.log-level {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.85em;
}
.log-level-Information { background-color: #d1ecf1; color: #0c5460; }
.log-level-Warning { background-color: #fff3cd; color: #856404; }
.log-level-Error { background-color: #f8d7da; color: #721c24; }
.log-level-Fatal { background-color: #f5c6cb; color: #721c24; }
.log-table { font-size: 0.9em; }
.log-message { max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Table */
.doc-table {
    width: 100%;
    border-collapse: collapse;
}

.doc-table thead {
    background: var(--bg-light);
    border-bottom: 2px solid var(--border-color);
}

.doc-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.doc-table th input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--brand);
}

.doc-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.doc-table tbody tr:hover {
    background: var(--bg-light);
}

.doc-table td {
    padding: 1rem;
    vertical-align: middle;
}

/*Templates CSS*/
.editor-container {
    min-height: 400px;
}

.template-select-container {
    margin-bottom: 1.5rem;
}

.template-select-container select {
    width: 100%;
    padding: 0.5rem;
    font-size: 1rem;
}

.note-info {
    background-color: #f8f9fa;
    border-left: 4px solid #007bff;
    padding: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

/* Styles pour l'éditeur riche uniquement */
.rich-text-container * {
    box-sizing: border-box;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

.simple-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.simple-input:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
}

.rich-text-container {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.rich-text-container:focus-within {
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
}
.toolbar-template {
    background: #f5f5f5;
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.toolbar-template button {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    color: #333;
}

.toolbar-template button:hover {
    background: #f0f0f0;
    border-color: #ff6b35;
}

.toolbar-template button.active {
    background: #ff6b35;
    color: white;
    border-color: #ff6b35;
}

.toolbar-template select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 14px;
}

.color-picker-wrapper {
    position: relative;
    display: inline-block;
}

.color-picker-btn {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    color: #333;
    display: flex;
    align-items: center;
    gap: 6px;
}

.color-picker-btn:hover {
    background: #f0f0f0;
    border-color: #ff6b35;
}

.color-preview {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid #ddd;
    background: #000;
}

.color-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.color-quick-buttons {
    display: flex;
    gap: 4px;
    align-items: center;
}

.color-quick-btn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-quick-btn:hover {
    transform: scale(1.1);
    border-color: #ff6b35;
}

.rich-text-editor {
    min-height: 200px;
    padding: 16px;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    overflow-y: auto;
    outline: none;  
}

.rich-text-editor:empty:before {
    content: "Saisissez votre texte ici...";
    color: #999
}

/* input number  */

/* Styles pour le bouton de sélection de pays */
.phone-input-wrapper .dropdown {
    position: static;
}

/* S'assurer que le bouton et l'input aient la même hauteur avec input-group-lg */
.input-group-lg .country-selector-btn {
    border: 2px solid #e0e0e0;
    border-right: none;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
    transition: var(--transition);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    height: calc(1.5em + 1.5rem + 4px);
}

.country-selector-btn {
    border: 2px solid #e0e0e0;
    border-right: none;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
    transition: var(--transition);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
}

    .country-selector-btn:hover {
        background-color: #e9ecef;
        border-color: var(--primary-color);
        color: var(--primary-color);
    }

    .country-selector-btn:focus,
    .country-selector-btn.show {
        box-shadow: 0 0 0 0.2rem rgba(243, 146, 33, 0.25);
        border-color: var(--primary-color);
        background-color: #fff;
    }

    .country-selector-btn::after {
        margin-left: 0.5rem;
    }

    .country-selector-btn #selectedFlag {
        font-size: 1.2rem;
        line-height: 1;
        margin-right: 0.5rem;
    }

    .country-selector-btn #selectedDialCode {
        font-size: 0.9rem;
        flex: 1;
        text-align: left;
    }

/* Dropdown de pays */
.countryListContainer{
    padding: 0;
}
.countryListContainer li{
    margin-left: 0px;
}
.countryListContainer li img {
    width: 25px;
    height: auto;
    margin-right: -10px;
    vertical-align: middle;
}
.country-dropdown {
    min-width: 250px;
    max-width: 350px;
    width: 100%;
    max-height: 300px;
    margin-top: 0.25rem;
    overflow-y: auto;
    overflow-x: hidden;
}
.country-name{
    max-width: 70%;
}
.country-dropdown input {
    max-width: 95%;
    max-height: 32px;
}

.country-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.country-dropdown .dropdown-item:hover {
    background-color: var(--brand-light);
}

.country-dropdown .dropdown-item .country-flag {
    font-size: 1.2rem;
    margin-right: 0.75rem;
    width: 24px;
    text-align: center;
}
.selected-flag-img {
    /*font-size: 1.2rem;
    margin-right: 0.75rem;*/
    width: 30px;
    text-align: center;
}
.country-dropdown .dropdown-item .country-name {
    flex: 1;
}

.country-dropdown .dropdown-item .country-code {
    color: var(--brand);
    font-weight: 600;
    margin-left: 0.5rem;
}

.input-group .form-control {
    border-left: none;
}

.input-group .form-control:focus {
    border-left: 2px solid var(--primary-color);
}
.input-group .input-group-lg{

}

/* Dropdown-item : couleurs primaires (--brand) */
.dropdown-menu .dropdown-item {
    color: var(--text-primary, #1a1a1a);
}

    .dropdown-menu .dropdown-item:hover,
    .dropdown-menu .dropdown-item:focus {
        background-color: var(--brand-light);
        color: var(--brand);
    }

    .dropdown-menu .dropdown-item.active {
        background-color: var(--brand);
        color: #fff;
    }


button.submitting,
input[type="submit"].submitting {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

button.submitting .spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* ── Branding / Co-branding page ───────────────────────────── */
.color-radio {
    cursor: pointer;
    display: block;
    position: relative;
    outline: 2px solid transparent;
    outline-offset: 3px;
    transition: outline-color 0.15s ease;
}

.color-radio input[type="radio"] {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
}

.color-radio.color-radio-selected {
    outline-color: var(--bs-primary, #0d6efd);
}

/* Indicateur radio (point central) sur la couleur sélectionnée */
.color-radio.color-radio-selected::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.color-picker-input {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: transparent;
}

.color-picker-input::-webkit-color-swatch-wrapper { padding: 0; }

.color-picker-input::-webkit-color-swatch {
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: 50%;
}

.color-picker-input::-moz-color-swatch {
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: 50%;
}

.drop-zone {
    border: 2px dashed;
    border-radius: 1px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.25s, background 0.25s, transform 0.2s;
    position: relative;
    overflow: hidden;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: black;
    background: rgba(91, 91, 255, 0.05);
    transform: scale(1.01);
}

.drop-zone.dragover {
    background: rgba(91, 91, 255, 0.1);
}

.drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.drop-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    background: rgba(91, 91, 255, 0.12);
    border-radius: 12px;
    display: grid;
    place-items: center;
    transition: background 0.25s;
}

.drop-zone:hover .drop-icon {
    background: rgba(91, 91, 255, 0.22);
}

.drop-label {
    font-size: 0.88rem;
    color: gray;
    line-height: 1.6;
}

.drop-label strong {
    color: grey;
    font-weight: 500;
}

.preview-wrapper {
    display: none;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1.5rem;
    animation: fadeSlideUp 0.35s ease forwards;
}

.preview-wrapper.visible {
    display: flex;
}

.preview-frame {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    min-height: 140px;
    overflow: hidden;
}

#preview-img {
    max-width: 100%;
    max-height: 160px;
    object-fit: contain;
}

.btn-reset {
    background: none;
    border: 1px solid grey;
    color: gray;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.78rem;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    align-self: flex-end;
}

.btn-reset:hover {
    border-color: red;
    color: darkred;
}

/* ============================================
    DocCompleted - Tabs (DocActive, DocInactive, DocAnnulé, DocPurgé)
============================================ */

.doccompleted-tabs {
    border-bottom: 2px solid var(--border-color, #dee2e6);
    margin-bottom: 1.5rem;
    gap: 0;
}

    .doccompleted-tabs .nav-item {
        margin-bottom: -2px;
    }

    .doccompleted-tabs .nav-link {
        padding: 0.75rem 1.25rem;
        font-weight: 600;
        font-size: 0.95rem;
        color: var(--text-secondary, #6c757d);
        border: none;
        border-bottom: 3px solid transparent;
        background: transparent;
        border-radius: var(--radius, 6px) var(--radius, 6px) 0 0;
        transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    }

        .doccompleted-tabs .nav-link:hover {
            color: var(--text-primary, #212529);
            background: var(--bg-light, #f8f9fa);
        }

        /* Actif : vert (documents complétés) */
        .doccompleted-tabs .nav-link[href*="documentStoreTab=Active"].active,
        .doccompleted-tabs .nav-link.tab-active.active {
            color: #1B5E20;
            border-bottom-color: #4CAF50;
            background: rgba(76, 175, 80, 0.08);
        }

        /* Inactif : orange (en attente / brouillon) */
        .doccompleted-tabs .nav-link[href*="documentStoreTab=Inactive"].active,
        .doccompleted-tabs .nav-link.tab-inactive.active {
            color: #E65100;
            border-bottom-color: #FF9800;
            background: rgba(255, 152, 0, 0.08);
        }

        /* Annulé : rouge */
        .doccompleted-tabs .nav-link[href*="documentStoreTab=Annule"].active,
        .doccompleted-tabs .nav-link.tab-annule.active {
            color: #B71C1C;
            border-bottom-color: #D32F2F;
            background: rgba(211, 47, 47, 0.08);
        }

        /* Purgé : gris / archivé */
        .doccompleted-tabs .nav-link[href*="documentStoreTab=Purge"].active,
        .doccompleted-tabs .nav-link.tab-purge.active {
            color: #424242;
            border-bottom-color: #757575;
            background: rgba(158, 158, 158, 0.12);
        }


/* Bouton Confirmer = couleur primaire */
div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm) {
    background-color: var(--brand) !important;
    color: #fff !important;
}

    div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):hover {
        background-color: var(--brand-hover) !important;
    }

/* Optionnel : bouton Annuler en secondaire / neutre */
div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel) {
    background-color: var(--brand-secondary, #6e7881) !important;
    color: #fff !important;
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Toujours afficher les deux actions (Oui / Annuler) côte à côte */
div:where(.swal2-container) .swal2-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    justify-content: center !important;
    width: 100% !important;
}

/* PLANS & QUOTAS CSS */
.plan-management-container {
    padding: 1.5rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    background: #f8f9fa;
}

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.plan-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.btn-create-plan {
    padding: 0.65rem 1.5rem;
    border-radius: 25px;
    border: none;
    background: #21479d;
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

    .btn-create-plan:hover {
        background: #1a3a7d;
    }

.plan-cards {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.plan-card {
    flex: 1 1 240px;
    min-width: 220px;
    max-width: 320px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    position: relative;
    display: flex;
    flex-direction: column;
}

.plan-card-has-tag {
    padding-top: 2rem;
}

.plan-tag {
    position: absolute;
    top: -6px;
    right: 12px;
    background: #ffa500;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    letter-spacing: 0.03em;
}

.plan-card-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 0.35rem 0;
}

.plan-card-desc {
    font-size: 0.9rem;
    color: #666;
    margin: 0 0 1rem 0;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
    flex: 1;
}

    .plan-features li {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.35rem 0;
        font-size: 0.95rem;
        color: #333;
    }

        .plan-features li i {
            color: #28a745;
            font-size: 1rem;
            flex-shrink: 0;
        }

.btn-card-action {
    padding: 0.6rem 1rem;
    border-radius: 25px;
    border: 1px solid #ccc;
    background: #fff;
    color: #333;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
}

    .btn-card-action:hover {
        border-color: #999;
        background: #f5f5f5;
    }

@media (max-width: 768px) {
    .plan-cards {
        flex-direction: column;
    }

    .plan-card {
        max-width: 100%;
    }
}

