/* Applique la police à tout le texte de la page */
body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; /* Police sans-serif moderne */
}

:root {
    --primary-color: #222;
    --secondary-color: #666;
    --tertiary-color: #E8E8E8;
    --font-size-base: 1em;
}

/*-------------------------------------------------------------------------
Titres et labels et textes
---------------------------------------------------------------------------*/

h1, h2, h3, h4 {
    font-weight: bold; 
    color: var(--primary-color); 
    margin-bottom: 15px; 
    letter-spacing: 0.5px;
}
/* Titres principaux (h1) */
h1 {
    font-size: 2em; 
    border-bottom: 1px solid #ccc; 
    padding-bottom: 10px; 
    margin-bottom: 25px;
}
/* Titres secondaires (h2) */
h2 {
    font-size: 1.6em;
    margin-bottom: 15px; 
}
/* Titres tertiaires (h3) */
h3 {
    font-size: 1.4em; 
    margin-bottom: 10px;
}
/* Titres de sections */
label {
    font-size: 1.2em;
    font-weight: normal;
    color: black;
}
/* Texte d'explication */
.explanation-text {
    font-size: 0.9em;
    margin-top: 10px;
    margin-left: 10px;
    border-left: 1px solid var(--secondary-color);
    padding-left: 10px;
    width: 70%;
    color: #777;
}



/*-------------------------------------------------------------------------
Barre de sélection en haut (Company / Project)
---------------------------------------------------------------------------*/

/* Barre fixe en haut */
#top-bar {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #d0d0d0;
    
    z-index: 2000;
    padding: 10px 20px;
    display: flex;
    flex-wrap: wrap;       /* permet aux éléments de passer à la ligne */
    gap: 20px;             /* espace entre les dropdowns */
    box-sizing: border-box;
    border-radius: 5px;   /* arrondi coins */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Conteneur label + dropdown sur la même ligne */
.dropdown-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 200px;       /* Croissance flexible, largeur minimale 200px */
    min-width: 200px;      /* Largeur minimale pour que le label reste lisible */
}

/* Label des dropdowns */
#top-bar label {
    font-size: 0.9em;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
}

/* Select2 responsive */
.select2-container {
    width: 100% !important;    /* S’adapte à la largeur du parent */
    max-width: 400px;          /* Largeur maximale souhaitée */
}
.select2-dropdown {
    min-width: auto !important;
    width: auto !important;
    font-size: var(--font-size-base);
    z-index: 3000 !important;
}
.select2-container--open .select2-dropdown {
    z-index: 3000 !important;
}
.select2-selection__rendered {
    white-space: nowrap;
    font-weight: bold;
    font-size: var(--font-size-base);
    line-height: normal !important;
}
.select2-selection {
    height: 36px !important;
    padding: 4px 10px !important;
    display: flex !important;
    align-items: center !important;
}
.select2-selection__arrow {
    height: 36px !important;
}

.select2-results__option--highlighted {
    background-color: #666 !important;
    color: white !important; 
}


/*-------------------------------------------------------------------------
Section outils
---------------------------------------------------------------------------*/

.tool-section {
    margin-bottom: 20px;
    margin-top: 20px;
}

.tool-section label {
    font-weight: bold;
}
.tool-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Style des sections principales */
.main-section {
    background-color: #f0f0f0; /* Fond clair pour la section */
    padding: 0;               
    margin-top: 30px;
    border-radius: 5px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Barre de titre principale */
.main-section-header {
    background-color: #d0d0d0; /* Gris plus foncé pour le titre */
    padding: 12px 20px;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}

.main-section-header h2 {
    margin: 0;
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
}

/* Style du titre de la main-section */
.main-section h2 {
    margin: 0;                 /* Retire la marge par défaut */
    font-size: 1.5em;          /* Taille plus grande */
    font-weight: bold;         
}

/* Décalage du contenu sous le header */
.main-section > .tool-section {
    padding: 5px 20px;
}

.icon-spacing {
    margin-right: 8px; /* espace après l'icône */
}

/*-------------------------------------------------------------------------
Pup-up de confirmation
---------------------------------------------------------------------------*/

.custom-popup {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
  }
  .custom-popup-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    max-width: 400px;
    text-align: center;
  }
  .custom-popup .popup-buttons {
    margin-top: 20px;
  }
  .custom-popup button {
    margin: 0 10px;
    padding: 8px 16px;
  }


/*-------------------------------------------------------------------------
Boutons
---------------------------------------------------------------------------*/

button {
    font-size: var(--font-size-base);
    padding: 10px 15px;
    border: none;
    background-color: rgb(255, 81, 0);
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top:10px;
}
button:hover {
    background-color: rgb(204, 65, 0);
}

/* Styles pour le bouton de flèche */
.toggle-explanation-btn {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding-left: 6px;
    padding-right: 6px;
    margin-right: 4px;
}

.toggle-explanation-btn:hover {
    background-color: #d0d0d0;
    color: white;
}

.toggle-explanation-btn i {
    transition: transform 0.15s ease-in-out;
    transform: rotate(0deg);
}
.explanation-text { padding: 10px 0; }

/* Style pour le bouton "Export ongoing" */
.export-ongoing {
    background-color: #4caf50; /* Couleur verte pour l'état en cours */
    align-items: center;
    cursor: not-allowed;
}
.export-ongoing:after {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    border-top: 3px solid var(--primary-color);
    animation: spin 1s linear infinite;
    margin-left: 10px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Style pour désactiver les boutons */
.disabled-button {
    pointer-events: none;
    opacity: 0.6;
}

/* Style pour le bouton cancel */
#cancel-export {
    display: none;
    width: 60%;
    margin: 20px auto; /* Center horizontally */
    padding: 10px;
    background-color: red;
    color: white;
    border: none;
    cursor: pointer;
}

/* Espacement entre les lignes */
.tool-buttons .line {
    width: 100%; /* Force un retour à la ligne */
}

/* Espacement horizontal entre les boutons */
.tool-buttons button {
    margin-right: 10px; 
}

/*-------------------------------------------------------------------------
Panneau latéral et overlay
---------------------------------------------------------------------------*/

/* Overlay pour le panneau d'actions (niveau 1) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 2999;
}

/* Overlay pour le panneau de logs (niveau 2) */
#sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none !important;
    z-index: 3999;
}

#sidebar-overlay.active {
    display: block !important;
}

/* Panneau d'actions (droite) */
.sidebar-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 40%;
    min-width: 300px;
    height: 100%;
    background-color: #fff;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.3);
    padding: 20px;
    overflow-y: auto;
    display: none;
    z-index: 3000;
}

.sidebar-panel h2 {
    font-size: 1.5em;
}
.sidebar-panel p {
    font-size: var(--font-size-base);
    color: #555;
    margin-bottom: 15px;
}
.sidebar-panel label {
    font-size: 0.9em;
    color: #333;
    display: block;
    margin-bottom: 10px;
}
.sidebar-panel button {
    background-color: rgb(255, 81, 0);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: var(--font-size-base);
    cursor: pointer;
    margin-top: 15px;
}
.sidebar-panel button:hover {
    background-color: rgb(204, 65, 0);
}

/* Poignée de redimensionnement invisible (10px) */
.sidebar-panel::before,
#log-sidebar-panel::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 10px;
    height: 100%;
    cursor: ew-resize;
    background-color: transparent;
}

/* Effet au survol */
.sidebar-panel::before:hover,
#log-sidebar-panel::before:hover {
    background-color: rgba(255, 81, 0, 0.3);
}

.final-export-button {
    width: 60%;
    margin-top: 30px;
    margin-left: auto;
    margin-right: auto;
    display: block;
}
.sidebar-panel input[type="checkbox"] {
    margin-right: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    #sidebar-close-btn {
        right: 10px; 
    }
}

/* Bouton de fermeture du panneau d'actions */
#sidebar-close-btn {
    position: fixed;
    top: 5px;
    right: calc(40% + 55px); 
    width: 40px;
    height: 40px;
    background: white;
    border: none;
    border-radius: 4px;
    font-size: 18px;
    cursor: pointer;
    color: #333;
    z-index: 3001; 
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    display: none; /* Caché par défaut */
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, transform 0.2s ease;
}

#sidebar-close-btn:hover {
    color: #d9534f;   
    transform: scale(1.1);
}

/*-------------------------------------------------------------------------
Tooltips
---------------------------------------------------------------------------*/

/* Icône ? pour les tooltips */
.info-icon {
    font-size: 0.8em;
    cursor: help; /* Curseur d'aide */
    margin-left: 5px;
    vertical-align: middle;
}
/* Tooltip personnalisé */
.info-icon:hover::after {
    content: attr(data-tooltip); /* Texte provenant de data-tooltip */
    position: absolute;
    background: var(--secondary-color);
    color: #fff;
    padding: 5px;
    border-radius: 5px;
    font-size: 12px;
    white-space: pre-wrap;
    min-width: 250px;
    max-width: 500px; /* Limite la largeur */
    transform: translateX(20px);
    z-index: 5000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}
.info-icon:hover {
    position: relative; /* Nécessaire pour le tooltip */
}

/*-------------------------------------------------------------------------
Barre d'avancement
---------------------------------------------------------------------------*/

/* Style de la barre de progression */
#progressBar {
    background-color: var(--tertiary-color);
    color: white;
}
progress::-webkit-progress-value {
    background-color: green;
}
progress::-moz-progress-bar {
    background-color: green;
}

/*-------------------------------------------------------------------------
Logs
---------------------------------------------------------------------------*/

/* Style des logs pour avoir un défilement vertical si nécessaire */
#log {
    max-height: 90%;
    overflow-y: scroll;
}

/* Panneau de logs (droite, au-dessus du panneau d'actions) */
#log-sidebar-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 35%;
    min-width: 300px;
    height: 100%;
    background-color: #fff;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.3);
    padding: 20px;
    overflow-y: auto;
    display: none;
    z-index: 4000; /* Au-dessus de tout */
    transition: transform 0.3s ease;
}

#log-sidebar-panel h2 {
    font-size: 1.5em;
}
#log-sidebar-panel .progress-container {
    width: 100%;
    margin-top: 20px;
}
#log-sidebar-panel .log-container {
    margin-top: 20px;
    height: calc(100% - 180px);
    overflow-y: auto;
    padding: 10px;
    background-color: #f8f8f8;
}
/* Bouton de réinitialisation dans le panneau */
#log-sidebar-panel #resetButton {
    position: absolute;
    top: 5px;
    right: 10px;
    padding: 10px 15px;
    background-color: var(--secondary-color);
    border-radius: 4px;
    color: white;
    cursor: pointer;
}
#log-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 3000;
}

/* Bouton chevron pour le panneau de logs */
#toggle-log-sidebar {
    margin: 0px;
    position: fixed;
    right: 0;
    top: 50%;
    width: 50px;
    height: 50px;
    background-color: #fff;
    border: 1px solid #ddd;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.3);
    border-radius: 8px 0 0 8px;
    color: #333;
    font-size: 1.5em;
    cursor: pointer;
    z-index: 4001; /* Au-dessus du panneau de logs */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: right 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
}

/* Bouton lorsque le panneau est fermé */
#toggle-log-sidebar.closed {
    right: 0;
    transform: translateY(-50%) rotate(0deg);
    border-radius: 8px 0 0 8px;
}

/* Bouton lorsque le panneau est ouvert */
#toggle-log-sidebar.open {
    right: 35%; 
    transform: translateY(-50%) rotate(180deg);
    border-radius: 16px;
}

#toggle-log-sidebar:hover {
    background-color: #888;
    color: white;
}

#log-sidebar-panel {
    transition: transform 0.5s ease;
}
#log-sidebar-panel.open {
    transform: translateX(0);
}
#log-sidebar-panel.closed {
    transform: translateX(100%);
}