/* ---------------------------------------------------------
   STYLE GLOBAL
--------------------------------------------------------- */

body {
    font-family: Arial, sans-serif;
    background-color: #1c1c1c;
    color: #f0f0f0;
    margin: 0;
    padding: 0;
}

.container {
    display: flex;
}


/* ---------------------------------------------------------
   MENU LATÉRAL
--------------------------------------------------------- */


.menu a {
    text-decoration: none;  /* enlève le souligné */
}

.sidebar {
    width: 60px;
    background-color: #2b2b2b;
    top: 0;
    bottom: 0;
    transition: width 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: fixed;
    /* height: 100vh; */
    box-shadow: 2px 0 5px rgba(0,0,0,0.5);
    user-select: none;
    position:fixed;
    z-index: 1000; /* <- ici on le met plus haut que .tab-bar */
}

.sidebar:not(.collapsed) {
    width: 300px;
}

.sidebar button.toggle-btn {
    background-color: #444;
    color: #f0f0f0;
    border: none;
    cursor: pointer;
    padding: 10px;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    border-radius: 0 10px 10px 0;
}

.sidebar:not(.collapsed) button.toggle-btn {
    text-align: center;
    padding-left: 15px;
}

.sidebar .menu {
    display: flex;
    flex-direction: column;
    margin-top: 10px;
    flex-grow: 1;
}

.sidebar .menu button {
    background: none;
    border: none;
    width: 100%;
    color: #f0f0f0;
    padding: 12px 20px;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    border-radius: 5px;
    white-space: nowrap;        /* empêche le retour à la ligne */
    overflow: hidden;           /* cache le texte qui déborde */
    text-overflow: ellipsis;    /* ajoute des "..." si le texte est trop long */
    box-sizing: border-box;     /* inclut le padding dans la largeur */
}


.sidebar .menu button:hover {
    background-color: #4a90e2;
    transform: translateX(5px);
}

.sidebar .menu button span.text {
    opacity: 0;
    transition: opacity 0.3s ease 0.3s;
}

.sidebar:not(.collapsed) .menu button span.text {
    opacity: 1;
}

.sidebar .menu button span.icon {
    font-size: 18px;
}

.sidebar .menu button.active {
    background-color: #1f1f1f;
    border-left: 4px solid #00c853;
}

.sidebar .menu .menu-separator {
    width: 60%;          /* largeur du trait (ajuste selon ton goût) */
    height: 1px;         /* épaisseur du trait */
    background-color: #444;
    margin: 10px auto;   /* centrer horizontalement */
    border-radius: 2px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.sidebar .menu .menu-separator:hover {
    opacity: 1;
}

/* Scroll vertical pour le menu latéral */
.sidebar .menu {
    display: flex;
    flex-direction: column;
    margin-top: 10px;
    flex-grow: 1;

    overflow-y: auto;      /* scroll vertical si nécessaire */
    overflow-x: hidden;    /* pas de scroll horizontal */
    padding-right: 4px;    /* éviter que la scrollbar chevauche le contenu */
}

/* Style de la scrollbar (Webkit/Chrome/Safari) */
.sidebar .menu::-webkit-scrollbar {
    width: 6px;
}

.sidebar .menu::-webkit-scrollbar-thumb {
    background-color: #00c853;
    border-radius: 3px;
}

.sidebar .menu::-webkit-scrollbar-track {
    background-color: #2b2b2b;
    border-radius: 3px;
}

/* Style pour Firefox */
.sidebar .menu {
    scrollbar-width: thin;
    scrollbar-color: #007a3d #2b2b2b;
}


/* ---------------------------------------------------------
   CONTENU PRINCIPAL
--------------------------------------------------------- */

.main-content {
    flex: 1;
    margin-left: 60px;
    padding: 30px;
    padding-bottom: 80px; /* <- espace pour la tab-bar + marge */
    transition: margin-left 0.3s ease;
}

.sidebar:not(.collapsed) ~ .main-content {
    margin-left: 300px;
}

h1 {
    color: #00c853;
    margin-top: 0;
    font-size: 2em;
}

/* ---------------------------------------------------------
   CARTES (FAUX GRAPHIQUES)
--------------------------------------------------------- */

.charts {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

.chart {
    flex: 1;
    background-color: #2a2a2a;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #ccc;
    box-shadow: 0 0 10px rgba(0,0,0,0.4);
    transition: transform 0.2s, background-color 0.2s;
}

.chart:hover {
    transform: translateY(-5px);
    background-color: #333;
}

/* ---------------------------------------------------------
   BARRE D'ONGLETS (TYPE EXCEL) - VERSION HARMONIEUSE SCROLLABLE
--------------------------------------------------------- */

.tab-bar {
    position: fixed;
    bottom: 0;
    left: 60px;  /* largeur du sidebar collasped */
    right: 0;
    height: 40px;
    background-color: #2b2b2b;
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 4px;
    box-shadow: 0 -1px 4px rgba(0,0,0,0.4);
    z-index: 900;
    transition: left 0.3s ease;
    overflow-x: auto;      /* scrollbar horizontale si besoin */
    overflow-y: hidden;
    padding-bottom: 0px;   /* espace pour scrollbar */
}

.sidebar:not(.collapsed) ~ .main-content .tab-bar {
    left: 300px;
}

.sidebar.collapsed ~ .main-content .tab-bar {
    left: 60px;
}

.tab-bar::-webkit-scrollbar {
    height: 6px;
}

.tab-bar::-webkit-scrollbar-thumb {
    background-color: #00c853;
    border-radius: 3px;
}

.tab-bar::-webkit-scrollbar-track {
    background-color: #2b2b2b;
    border-radius: 3px;
}

.tab {
    box-sizing: border-box;
    background-color: #383838;
    color: #f0f0f0;
    padding: 6px 16px;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    border: 1px solid #444;
    border-bottom: none;
    height: 40px;
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s, transform 0.15s;
    flex-shrink: 0;  /* empêcher le rétrécissement */
    text-decoration: none; /* supprime le soulignement */
    color: inherit;        /* garde la couleur du texte parent */
}

.tab:hover {
    background-color: #00c853;
    color: #121212;
}

.tab.active {
    background-color: #1f1f1f;
    color: #00c853;
    font-weight: bold;
    border-color: #00c853;
}

.tab.add-tab {
    background: none;
    border: none;
    color: #00c853;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    height: 32px;
    width: 0px;             /* bouton carré */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;           /* ne pas rétrécir */
    transition: color 0.2s, transform 0.15s;
}

.tab.add-tab:hover {
    color: #44ff77;
    transform: scale(1.1);
}


/* ---------------------------------------------------------
   TABLEAU
--------------------------------------------------------- */

table {
    width: 100%;
    border-collapse: collapse;
    background-color: #2b2b2b;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

th, td {
    padding: 8px 12px;
    border-bottom: 1px solid #444;
    text-align: left;
}

th {
    background-color: #383838;
    color: #00c853;
    cursor: pointer;
    user-select: none;
    position: relative;
}

th .sort-arrow {
    font-size: 0.8em;
    margin-left: 5px;
    color: #888;
}

tbody tr:nth-child(even) {
    background-color: #2f2f2f;
}

tbody tr:nth-child(odd) {
    background-color: #383838;
}

tbody tr:hover {
    background-color: #4a90e2;
    color: #fff;
}

.add-btn {
    color: #00c853;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 16px;
    text-align: center;
}

.add-btn:hover {
    color: #00d458;
    transform: scale(1.1);
}

.delete-btn {
    color: #e53935;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 16px;
    text-align: center;
}

.delete-btn:hover {
    color: #ff6659;
    transform: scale(1.1);
}

.add-new-row td {
    text-align: center;
    background-color: #383838;
    font-weight: bold;
    cursor: pointer;
    color: #4caf50;
    transition: 0.2s;
}

.add-new-row td:hover {
    text-decoration: underline;
    background-color: #00c853;
    color: white;
    transform: translateY(-2px);
}

.footer-buttons {
    display: flex;
    gap: 20px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.btn {
    padding: 8px 16px;
    background-color: #444;
    color: #f0f0f0;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s, transform 0.2s;
}

.btn:hover {
    background-color: #00c853;
    color: #121212;
    transform: translateY(-2px);
}

td[contenteditable="true"] {
    transition: background-color 0.2s, color 0.2s;
}

td[contenteditable="true"]:focus {
    background-color: #005f99;
    color: #fff;
    border-radius: 3px;
}

.table-container {
    padding-top: 20px;
    padding-bottom: 20px;
    /*border-radius: 10px;
    background-color: #2a2a2a;
    box-shadow: 0 0 8px rgba(0,0,0,0.4);*/
}

.table-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.table-header .left {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-right:  20px;
}

.table-header .table-title {
    font-weight: bold;
    color: #00c853;
    font-size: 1.1em;
    cursor: text;
}

.table-header .actions {
    display: flex;
    gap: 2px;
    font-size: 14px;
    align-items: center;
    margin-left: auto;
}

.table-header .actions button {
    background: none;       /* plus de fond */
    color: #cccccc;         /* couleur du logo */
    border: none;
    border-radius: 0;       /* pas d'arrondi */
    cursor: pointer;
    padding: 0;             /* ajuster selon le logo */
    transition: color 0.2s, transform 0.2s;
    text-align: center;
}

.table-header .actions button:hover {
    color: #00c853;         /* couleur au hover */
    transform: scale(1.1);  /* léger zoom si tu veux */
    text-align: center;
}

.table-header .actions .duplicate-table {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0px;
    transition: color 0.2s, transform 0.2s;
    font-size: 16px; /* taille générale de l’icône */
}

.table-header .actions .duplicate-table .plus-big {
    font-size: 20px;   /* plus grand */
    line-height: 1;
}

.table-header .actions .duplicate-table .plus-small {
    font-size: 10px;   /* plus petit */
    line-height: 1;
}

.table-header .actions .duplicate-table:hover {
    color: #00c853;
    transform: scale(1.2);
}


.table-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 10px;
    font-weight: normal;  /* plus en gras */
    color: #f0f0f0;
}


td.url-cell {
    color: #4a90e2;
    cursor: pointer;
}

td.url-cell.editing {
    color: #fff;
    text-decoration: none;
}


/* ---------------------------------------------------------
   MENU CONTEXTUEL
--------------------------------------------------------- */

.context-menu {
    position: absolute;
    background: #2b2b2b;
    border: 1px solid #444;
    border-radius: 5px;
    padding: 5px 0;
    display: none;
    z-index: 1000;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.context-menu button {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: #f0f0f0;
    text-align: left;
    padding: 8px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.context-menu button:hover {
    background-color: #4a90e2;
}


/* ---------------------------------------------------------
   PROJECT CHART
--------------------------------------------------------- */

.chart {
    /* flex-direction: column;   canvas et légende côte à côte verticalement */
    /* flex-direction: row;  /* canvas et légende côte à côte horizontalement */
    align-items: center;
}

.chart h3 {
    margin-bottom: 4px; /* réduit l’espace sous le titre */
}

.chart-controls {
    margin-bottom: 12px; /* si tu veux un petit espace avant le chart-body */
    flex-direction: column; /* canvas et légende côte à côte verticalement */
    padding-right: 20px;
}

.chart-controls select {
    padding: 3px 5px;
    border-radius: 5px;
    border: none;
    background-color: #383838;
    color: #f0f0f0;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.chart-controls select:hover {
    background-color: #444;
}

.chart-body {
    display: flex;
    flex-direction: row;  /* canvas et légende côte à côte horizontalement */
    justify-content: center;
    align-items: center;
    gap: 20px; /* espace entre canvas et légende */
}

.chart-container {
    flex: 0 0 auto;
}

.chart-legend {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
}

.chart-total {
    margin-top: 20px;
}




/* ---------------------------------------------------------
   LOGIN PAGE
--------------------------------------------------------- */

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow-y: hidden; /* évite scrollbar inutile */
}

.login-container {
    background-color: #2b2b2b;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    width: 300px;
}

.login-container h2 {
    color: #00c853;
    margin-top: 0;
    text-align: center;
}

.login-container form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-container label {
    display: flex;
    flex-direction: column;
    font-weight: bold;
    font-size: 14px;
}

.login-container input[type="text"],
.login-container input[type="password"] {
    padding: 8px;
    border-radius: 5px;
    border: none;
    background-color: #383838;
    color: #f0f0f0;
    margin-top: 5px;
}

.login-container input::placeholder {
    color: #aaa;
}

.login-container button {
    padding: 10px;
    border-radius: 5px;
    border: none;
    background-color: #00c853;
    color: #121212;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.login-container button:hover {
    background-color: #44ff77;
}

.error {
    color: #e53935;
    text-align: center;
    font-weight: bold;
}

/* ---------------------------------------------------------
   FILTRE DE COLONNE (STYLE EXCEL) - FOND SOMBRE
--------------------------------------------------------- */

.filter-dropdown {
    position: absolute;
    background-color: #2b2b2b;   /* fond sombre identique au menu contextuel */
    border: 1px solid #444;      /* bordure légèrement plus claire */
    border-radius: 5px;
    padding: 8px;
    min-width: 180px;            
    max-height: 250px;           
    overflow-y: auto;            
    overflow-x: hidden;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    z-index: 10000;              
    font-size: 14px;
    color: #f0f0f0;              /* texte clair */
}

/* Liste */
.filter-dropdown ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Items */
.filter-dropdown li {
    padding: 3px 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Hover sur les items */
.filter-dropdown li:hover {
    background-color: #383838;   /* léger contraste au hover */
    border-radius: 3px;
}

/* Checkboxes */
.filter-dropdown input[type="checkbox"] {
    accent-color: #00c853;       /* couleur verte cohérente avec le thème */
    cursor: pointer;
}

/* Input recherche */
.filter-dropdown input[type="text"] {
    margin-bottom: 5px;
    padding: 4px 6px;
    border-radius: 4px;
    border: none;
    background-color: #383838;   /* fond sombre pour input aussi */
    color: #f0f0f0;              /* texte clair */
}

.filter-dropdown input[type="text"]::placeholder {
    color: #aaa;
}


/* ---------------------------------------------------------
PROJECT LIST - BOUTON DE DUPLICATION
--------------------------------------------------------- */

/* Bouton duplication dans le tableau */
.duplicate-btn {
    color: #8e44ad;         /* vert thème */
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 16px;
    text-align: center;
    border-radius: 4px;
    padding: 4px 6px;
    transition: color 0.2s, transform 0.15s, background-color 0.2s;
}

.duplicate-btn:hover {
    color: #9b59b6;         /* texte sombre sur hover */
    transform: scale(1.1);   /* léger zoom */
}


.duplicate-btn .plus-big {
    font-size: 18px;   /* plus grand */
    line-height: 1;
}

.duplicate-btn .plus-small {
    font-size: 10px;   /* plus petit */
    line-height: 1;
}


/* ---------------------------------------------------------
POPUP CENTRALE - STYLE AMÉLIORÉ
--------------------------------------------------------- */

.standard-popup {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.75); /* légèrement plus foncé pour contraste */
display: flex;
justify-content: center;
align-items: center;
z-index: 5000;
}

.standard-popup.hidden {
display: none;
}

.standard-popup .popup-content {
background-color: #2b2b2b;      /* couleur du sidebar et du tableau */
color: #f0f0f0;                 /* texte clair cohérent */
padding: 25px 30px;
width: 450px;
border-radius: 10px;
box-shadow: 0 0 20px rgba(0,0,0,0.7);
display: flex;
flex-direction: column;
gap: 15px;
transition: transform 0.2s ease, opacity 0.2s ease;
}

.standard-popup .popup-content h2 {
color: #00c853;                 /* vert du thème */
margin-top: 0;
font-size: 1.8em;
text-align: center;
}

.standard-popup .form-section {
display: flex;
flex-direction: column;
gap: 8px;
}

.standard-popup .form-section h3 {
font-size: 1.1em;
font-weight: bold;
color: #00c853;
margin: 0;
}

.standard-popup .shape-select {
display: flex;
gap: 10px;
flex-wrap: wrap;
}

.standard-popup .shape-select button {
flex: 1 1 calc(50% - 5px);
background-color: #383838;
color: #f0f0f0;
border: none;
border-radius: 5px;
padding: 10px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.2s, transform 0.15s;
}

.standard-popup .shape-select button:hover {
background-color: #00c853;
color: #121212;
transform: translateY(-2px);
}

.standard-popup select {
padding: 6px 8px;
border-radius: 5px;
border: none;
background-color: #383838;
color: #f0f0f0;
font-size: 14px;
cursor: pointer;
transition: background-color 0.2s;
}

.standard-popup select:hover {
background-color: #444;
}

.standard-popup .results {
display: flex;
flex-direction: column;
gap: 5px;
font-weight: bold;
color: #ccc;
padding-top: 10px
}

.standard-popup .results span {
color: #00c853;
}

.standard-popup .results p {
margin:0;
}

.standard-popup .popup-buttons {
display: flex;
justify-content: flex-end;
gap: 15px;
margin-top: 10px;
}

.standard-popup .popup-buttons button {
padding: 8px 16px;
background-color: #444;
color: #f0f0f0;
border: none;
border-radius: 5px;
font-weight: bold;
cursor: pointer;
transition: background-color 0.2s, transform 0.15s;
}

.standard-popup .popup-buttons button:hover {
background-color: #00c853;
color: #121212;
transform: translateY(-2px);
}

/* ----------------- INPUT NUMBER & DIMENSION GROUP ----------------- */

.standard-popup .popup-content input[type="number"] {
width: 100%;                      /* étire au maximum horizontalement */
padding: 6px 8px;
border-radius: 5px;
border: none;
background-color: #383838;
color: #f0f0f0;
font-size: 14px;
transition: background-color 0.2s, color 0.2s;
text-align: right;
-moz-appearance: textfield;       /* Firefox */
}

.standard-popup .popup-content input[type="number"]::-webkit-inner-spin-button,
.standard-popup .popup-content input[type="number"]::-webkit-outer-spin-button {
-webkit-appearance: none;          /* Chrome, Edge, Safari */
margin: 0;
}

.standard-popup .popup-content input[type="number"]:focus {
background-color: #005f99;
color: #fff;
outline: none;
}

.standard-popup .dimension-group {
display: flex;
gap: 15px;                         /* espace horizontal entre label et input */
padding-bottom: 5px;
align-items: center;
}

.standard-popup .dimension-group label {
flex: 1 1 120px;                   /* largeur fixe pour labels */
font-weight: bold;
color: #ccc;
font-size: 14px;
}

.standard-popup .dimension-group .input-wrapper {
flex: 1 1 auto;                     /* input prend tout l'espace restant */
display: flex;
justify-content: flex-start;
align-items: center;
}

.standard-popup .shape-select button.active {
    background-color: #00c853;  /* vert thème */
    color: #121212;              /* texte sombre pour contraste */
    transform: translateY(-2px); /* même effet que hover */
}

/* Scrollbar globale sombre */

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background-color: #1f1f1f; /* plus sombre que le fond */
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb {
    background-color: #007a3d; /* vert assombri */
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
    background-color: #00c853; /* vert du thème au hover */
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #007a3d #1f1f1f;
}
