/* =========================================================
   FILAMENT MANAGER
   Feuille de style principale
   ========================================================= */


/* =========================================================
   1. BASE / STRUCTURE GÉNÉRALE
   ========================================================= */

/* Corps de la page */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    background-color: #f4f5f7;
    color: #222;
}

/* Conteneur principal de l'application */
.container {
    max-width: 1300px;
    margin: 40px auto;
    padding: 0 20px;
}


/* =========================================================
   2. LOGOS ET ICÔNES
   ========================================================= */

/* Logo principal Filament Manager */
.logo-bobine {
    width: 42px;
    height: 42px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 8px;
}

/* Icônes utilisées dans les menus */
.menu-bobine-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 5%;
}


/* =========================================================
   3. EN-TÊTE DE L'APPLICATION
   ========================================================= */

header {
    margin-bottom: 30px;
}

/* Titre principal */
.container > header h1,
body:not(:has(.management-section)) > header h1 {
    margin: 0 0 5px 0;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 30px;
    font-weight: 600;
    color: #34495e;
    letter-spacing: 0.2px;
}

/* Sous-titre */
.container > header p,
body:not(:has(.management-section)) > header p {
    margin-top: 6px;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: #6f7d86;
}


/* =========================================================
   4. STATISTIQUES
   ========================================================= */

/* Les quatre cartes statistiques */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* Carte statistique générale */
.stat {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    flex: 1;
}

/* Libellé d'une statistique */
.stat-label {
    display: block;
    margin-bottom: 12px;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #34495e;
}

/* Valeur par défaut */
.stat strong {
    font-size: 28px;
}

/* Les trois cartes numériques */
.stats .stat:not(.stat-matieres) {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 105px;
    border-bottom: 4px solid #A9D6F5;
}

/* Carte : nombre de bobines */
.stats .stat:nth-child(1) {
    background-color: #F0F7FF;
}

/* Carte : poids total */
.stats .stat:nth-child(2) {
    background-color: #F0F8F2;
    border-bottom-color: #B8D8BA;
}

/* Carte : valeur du stock */
.stats .stat:nth-child(3) {
    background-color: #FFF7F0;
    border-bottom-color: #F6C6A8;
}

/* Grandes valeurs des statistiques */
.stats .stat:not(.stat-matieres) strong {
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 32px;
    font-weight: 650;
    color: #34495e;
}


/* =========================================================
   5. RÉPARTITION DES MATIÈRES
   ========================================================= */

/* Carte du graphique */
.stat-matieres {
    min-width: 0;
}

/* Conteneur graphique + légende */
.matiere-chart {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 8px;
}

/* Donut */
.matiere-pie {
    width: 82px;
    height: 82px;
    flex: 0 0 82px;
    border-radius: 50%;
    background: #e8edf0;
    position: relative;
}

/* Centre blanc du donut */
.matiere-pie::after {
    content: "";
    position: absolute;
    width: 38px;
    height: 38px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 50%;
}

/* Légende */
.matiere-legend {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    font-size: 11px;
    color: #59656d;
}

/* Ligne de légende */
.matiere-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Petit carré de couleur */
.matiere-legend-color {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 2px;
}

/* Nom de la matière */
.matiere-legend-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Pourcentage */
.matiere-legend-value {
    margin-left: auto;
    font-weight: 600;
    color: #46545d;
}


/* =========================================================
   6. MENU PRINCIPAL
   ========================================================= */

.main-menu {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 10px 0 15px 0;
}

/* Boutons du menu principal */
.main-menu button {
    border: none;
    background: transparent;
    color: #444;
    padding: 5px 8px;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

/* Survol des boutons du menu */
.main-menu button:hover {
    background-color: #f0f0f0;
    border-radius: 5px;
}

/* Élément contenant un sous-menu */
.menu-dropdown {
    position: relative;
}

/* Sous-menu */
.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    display: none;
    min-width: 180px;
    padding: 5px;
    background-color: #fafafa;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
    z-index: 1000;
}

/* Éléments du sous-menu */
.submenu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 10px;
    font-size: 13px;
    background: transparent;
}

/* Affichage du sous-menu au survol */
.menu-dropdown:hover .submenu {
    display: block;
}


/* =========================================================
   7. EN-TÊTE "MES BOBINES"
   ========================================================= */

.filaments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

/* Titre "Mes Bobines" */
.filaments-header h2 {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: #23445A;
    letter-spacing: 0.2px;
}

/* Zone contenant les boutons */
.filaments-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}


/* =========================================================
   8. BOUTONS GÉNÉRAUX
   ========================================================= */

/* Style par défaut des boutons */
button {
    padding: 12px 18px;
    border: none;
    border-radius: 6px;
    background-color: #333;
    color: white;
    font-size: 15px;
    cursor: pointer;
}

/* Survol par défaut */
button:hover {
    background-color: #555;
}


/* =========================================================
   9. BOUTON "AJOUTER UNE BOBINE"
   ========================================================= */

.btn-add-filament {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    background-color: #A9D6F5;
    color: #23445A;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        transform 0.1s ease;
}

/* Survol */
.btn-add-filament:hover {
    background-color: #5B9BC4;
    color: white;
}

/* Clic */
.btn-add-filament:active {
    transform: translateY(1px);
}


/* =========================================================
   10. BOUTON "EFFACER LES FILTRES"
   ========================================================= */

.btn-reset-filters {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background-color: #f4f7f9;
    color: #5f6b73;
    border: 1px solid #d7dfe4;
    border-radius: 4px;
    font-size: 11px;
    font-weight: normal;
    cursor: pointer;
}

/* Survol */
.btn-reset-filters:hover {
    background-color: #e4edf2;
    color: #3f5968;
}


/* =========================================================
   11. ANCIEN CONTENEUR D'ACTIONS DES FILTRES
   ========================================================= */

.filters-actions {
    margin-bottom: 10px;
}


/* =========================================================
   12. TABLEAU PRINCIPAL
   ========================================================= */

/* Conteneur du tableau */
.filaments {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
}

/* Tableau */
table {
    width: 100%;
    border-collapse: collapse;
}

/* Cellules générales */
th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

/* En-têtes généraux */
th {
    color: #666;
}


/* =========================================================
   13. LIGNES DU TABLEAU DES BOBINES
   ========================================================= */

/* Cellules des données */
#filaments-table tbody td {
    padding: 6px 8px;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 12px;
    color: #4f5d66;
    line-height: 1.2;
}

/* Colonne Référence */
#filaments-table tbody td:first-child {
    font-size: 11px;
    white-space: nowrap;
}

/* Une ligne sur deux */
#filaments-table tbody tr:nth-child(even) {
    background-color: #eef6fc;
}

/* Survol d'une ligne */
#filaments-table tbody tr:hover {
    background-color: #dceefa;
}


/* =========================================================
   14. CARRÉ DE COULEUR DANS LE TABLEAU
   ========================================================= */

.color-square {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid #999;
    vertical-align: middle;
    margin-right: 6px;
}


/* =========================================================
   15. BARRE DE PROGRESSION
   ========================================================= */

.progress-bar {
    width: 120px;
    height: 14px;
    background-color: #e0e0e0;
    border-radius: 7px;
    overflow: hidden;
    display: block;
}

.progress-fill {
    height: 14px;
    display: block;
    background-color: #4caf50;
    border-radius: 7px;
}


/* =========================================================
   16. STATUT DES BOBINES
   ========================================================= */

/* Style commun */
.statut {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

/* Neuve */
.statut-neuve {
    background-color: #e3f2fd;
    color: #1565c0;
}

/* En cours */
.statut-en_cours {
    background-color: #fff3cd;
    color: #856404;
}

/* Vide */
.statut-vide {
    background-color: #f8d7da;
    color: #842029;
}

/* Sortie */
.statut-sortie {
    background-color: #e2e3e5;
    color: #41464b;
}


/* =========================================================
   17. ACTIONS DU TABLEAU
   ========================================================= */

/* La colonne des actions reste sur une seule ligne */
#filaments-table td:last-child {
    white-space: nowrap;
}

/* Boutons d'action : taille commune */
#filaments-table .btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 28px;
    padding: 0;
    margin: 2px;
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}


/* ---------------------------------------------------------
   ⚖️ Pesée
   --------------------------------------------------------- */

#filaments-table .btn-pesee {
    background-color: #DCEEFF;
    border-color: #B9D9F2;
    color: #3F6F91;
}

#filaments-table .btn-pesee:hover {
    background-color: #B9D9F2;
}


/* ---------------------------------------------------------
   📤 Sortie
   --------------------------------------------------------- */

#filaments-table .btn-sortie {
    background-color: #FFF0DC;
    border-color: #F0D1A5;
    color: #936A32;
}

#filaments-table .btn-sortie:hover {
    background-color: #F0D1A5;
}


/* ---------------------------------------------------------
   ✏️ Modifier
   --------------------------------------------------------- */

#filaments-table .btn-modifier {
    background-color: #E1F2E5;
    border-color: #BBDDC3;
    color: #477653;
}

#filaments-table .btn-modifier:hover {
    background-color: #BBDDC3;
}


/* ---------------------------------------------------------
   🗑️ Supprimer
   --------------------------------------------------------- */

#filaments-table .btn-supprimer {
    background-color: #F9DEDE;
    border-color: #E8BBBB;
    color: #984848;
}

#filaments-table .btn-supprimer:hover {
    background-color: #E8BBBB;
}


/* Boutons désactivés */
#filaments-table .btn-action:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    filter: grayscale(100%);
}


/* =========================================================
   18. LÉGENDE DES ACTIONS
   ========================================================= */

.actions-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    color: #6b7378;
    font-size: 11px;
}

.actions-legend span:first-child {
    font-weight: 600;
    color: #555;
}


/* =========================================================
   19. FILTRES DU TABLEAU
   ========================================================= */

/* ---------------------------------------------------------
   Sélecteurs classiques
   --------------------------------------------------------- */

#filaments-table th select {
    width: 100%;
    height: 28px;
    padding: 0 24px 0 8px;
    background-color: white;
    color: #4f5d66;
    border: 1px solid #cbd9e2;
    border-radius: 5px;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    box-sizing: border-box;
}

/* Survol */
#filaments-table th select:hover {
    background-color: white;
    border-color: #9fc6df;
}

/* Focus */
#filaments-table th select:focus {
    outline: none;
    background-color: white;
    box-shadow: 0 0 0 2px rgba(169, 214, 245, 0.35);
}


/* ---------------------------------------------------------
   Recherche par référence
   --------------------------------------------------------- */

#filaments-table th input[type="search"] {
    width: 100%;
    height: 28px;
    padding: 0 8px;
    background-color: white;
    color: #4f5d66;
    border: 1px solid #cbd9e2;
    border-radius: 5px;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 12px;
    font-weight: 400;
    box-sizing: border-box;
}

/* Survol */
#filaments-table th input[type="search"]:hover {
    background-color: white;
    border-color: #9fc6df;
}

/* Focus */
#filaments-table th input[type="search"]:focus {
    outline: none;
    border-color: #8bbfe0;
    box-shadow: 0 0 0 2px rgba(169, 214, 245, 0.35);
}


/* ---------------------------------------------------------
   Sélecteur de couleur personnalisé
   --------------------------------------------------------- */

.filter-color-select {
    position: relative;
    width: 100%;
    min-width: 110px;
}

/* Valeur actuellement sélectionnée */
.filter-color-selected {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 6px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    box-sizing: border-box;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

/* Survol */
#filter-color .filter-color-selected:hover {
    background-color: white;
    border-color: #9fc6df;
}

/* Lorsque la liste est ouverte */
#filter-color:has(.filter-color-options.open) .filter-color-selected {
    border-color: #8bbfe0;
    box-shadow: 0 0 0 2px rgba(169, 214, 245, 0.35);
}

/* Petit carré de couleur */
.filter-color-square {
    width: 16px;
    height: 16px;
    border: 1px solid #999;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Texte de la couleur */
.filter-color-text {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Petite flèche */
.filter-color-arrow {
    font-size: 10px;
    color: #666;
}

/* Liste des couleurs */
.filter-color-options {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 180px;
    overflow-y: auto;
}

/* Liste ouverte */
.filter-color-options.open {
    display: block;
}

/* Une couleur dans la liste */
.filter-color-option {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 7px;
    cursor: pointer;
}

/* Survol d'une couleur */
.filter-color-option:hover {
    background-color: #f2f2f2;
}

/* Couleur "Toutes" */
.filter-color-rainbow {
    background: linear-gradient(
        135deg,
        red 0%,
        orange 20%,
        yellow 35%,
        lime 50%,
        cyan 65%,
        blue 80%,
        violet 100%
    );
}


/* =========================================================
   20. FORMULAIRE D'AJOUT / MODIFICATION DE BOBINE
   ========================================================= */

/* Conteneur principal */
/* Voile de la modale d'ajout / modification */
#filament-form.form-container {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    background-color: rgba(20, 30, 40, 0.55);
    overflow-y: auto;
}

/* Panneau de la modale */
.filament-modal-content {
    width: min(900px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    box-sizing: border-box;
    padding: 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
}

.filament-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.filament-modal-header h2 {
    margin: 0;
    color: #34495e;
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    background: #eef2f5;
    color: #43515c;
    font-size: 26px;
    line-height: 1;
}

.modal-close:hover {
    background: #dce5eb;
    color: #1f2d36;
}

/* Formulaire */
#filament-form form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px 20px;
}

#filament-form form label {
    min-width: 0;
}

#filament-form form label:has(textarea) {
    grid-column: 1 / -1;
}

#filament-form .form-buttons {
    grid-column: 1 / -1;
}

/* Labels */
.form-container label {
    display: grid;
    gap: 6px;
    font-weight: bold;
}

/* Champs */
.form-container input {
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
}

/* Boutons du formulaire */
.form-buttons {
    display: flex;
    gap: 10px;
}


/* ---------------------------------------------------------
   Sélecteur de couleur du formulaire
   --------------------------------------------------------- */

.color-picker {
    position: relative;
    width: 100%;
}

.color-selected {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
    text-align: left;
    color: #222;
}

/* Liste déroulante des couleurs */
.color-options {
    display: none;
    position: absolute;
    z-index: 1000;
    width: 100%;
    background: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    max-height: 200px;
    overflow-y: auto;
}

/* Liste visible */
.color-options.visible {
    display: block;
}

/* Une option de couleur */
.color-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    cursor: pointer;
}

.color-option:hover {
    background-color: #f0f0f0;
}

/* Code HEX */
.color-hex {
    margin-left: auto;
    color: #777;
    font-size: 0.85em;
    font-family: monospace;
}

/* Carré de couleur dans le sélecteur */
.color-selected .color-square {
    flex-shrink: 0;
}

/* Nom de la couleur sélectionnée */
.color-selected .color-name {
    color: #222;
    font-weight: normal;
}

/* HEX de la couleur sélectionnée */
.color-selected .color-hex {
    color: #777;
    font-family: monospace;
    margin-left: auto;
}


/* ---------------------------------------------------------
   Sélecteur de couleur HTML
   --------------------------------------------------------- */

.color-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-picker-wrapper #color-picker {
    width: 42px;
    height: 38px;
    padding: 2px;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
}

#color-hex {
    width: 90px;
    box-sizing: border-box;
    padding: 8px 10px;
    font-size: 14px;
    text-transform: uppercase;
}


/* =========================================================
   21. FENÊTRE MODALE GÉNÉRALE
   ========================================================= */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

/* Contenu */
.modal-content {
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    width: 400px;
    max-width: calc(100% - 40px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    margin-top: 0;
}


/* =========================================================
   22. FENÊTRE DE PESÉE
   ========================================================= */

#weighing-form .modal-content {
    width: 420px;
    max-width: calc(100% - 40px);
}

#weighing-form-content {
    margin-top: 25px;
}

/* Un champ de pesée */
.weighing-field {
    margin-bottom: 18px;
}

.weighing-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
}

.weighing-field input {
    box-sizing: border-box;
    width: 100%;
    padding: 9px 10px;
    font-size: 15px;
}

/* Boutons de la fenêtre de pesée */
#weighing-form .form-buttons {
    margin-top: 25px;
}


/* =========================================================
   23. PAGES DE GESTION
   ========================================================= */

/* ---------------------------------------------------------
   Conteneur principal
   --------------------------------------------------------- */

body:has(.management-section) > header,
body:has(.management-section) > main {
    width: 1000px;
    max-width: calc(100% - 40px);
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}


/* ---------------------------------------------------------
   En-tête
   --------------------------------------------------------- */

body:has(.management-section) > header {
    margin-top: 30px;
    margin-bottom: 20px;
}

body:has(.management-section) > header h1 {
    margin: 0 0 5px 0;
    font-size: 26px;
}

body:has(.management-section) > header p {
    margin: 0;
    color: #666;
    font-size: 14px;
}


/* ---------------------------------------------------------
   Bouton retour à l'accueil
   --------------------------------------------------------- */

.btn-retour {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 15px;
    padding: 6px 10px;
    color: #444;
    background-color: #f2f2f2;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-decoration: none;
    font-size: 12px;
    cursor: pointer;
}

.btn-retour:hover {
    background-color: #e5e5e5;
}


/* ---------------------------------------------------------
   Menu "Bobines" des pages de gestion
   --------------------------------------------------------- */

.menu-bobines-gestion {
    background: none;
    border: none;
    padding: 6px 10px;
    margin: 0;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.menu-bobines-gestion:hover {
    background-color: #e9ecef;
    border-radius: 6px;
}


/* ---------------------------------------------------------
   Cartes de gestion
   --------------------------------------------------------- */

.management-section {
    width: 100%;
    box-sizing: border-box;
    background-color: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    padding: 18px 22px;
    margin-bottom: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}


/* ---------------------------------------------------------
   Titres des cartes
   --------------------------------------------------------- */

.management-section h2 {
    margin: 0 0 16px 0;
    font-size: 18px;
    color: #222;
}


/* ---------------------------------------------------------
   Formulaire de gestion
   --------------------------------------------------------- */

.management-form {
    display: flex;
    align-items: end;
    gap: 12px;
    flex-wrap: wrap;
}

/* Chaque bloc du formulaire */
.management-form > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}


/* ---------------------------------------------------------
   Labels
   --------------------------------------------------------- */

.management-form label {
    font-weight: bold;
    font-size: 12px;
    color: #444;
}


/* ---------------------------------------------------------
   Champs
   --------------------------------------------------------- */

.management-form input {
    box-sizing: border-box;
    height: 34px;
    padding: 6px 9px;
    font-size: 13px;
    color: #222;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    outline: none;
}

/* Focus */
.management-form input:focus {
    border-color: #999;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.04);
}


/* ---------------------------------------------------------
   Boutons du formulaire
   --------------------------------------------------------- */

.management-form-buttons {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 7px;
}

.management-form-buttons button {
    width: auto;
    margin: 0;
    white-space: nowrap;
}


/* ---------------------------------------------------------
   Bouton Ajouter
   --------------------------------------------------------- */

.btn-ajouter {
    width: auto;
    height: 34px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: normal;
    color: #fff;
    background-color: #333;
    border: none;
    border-radius: 5px;
    white-space: nowrap;
    cursor: pointer;
}

.btn-ajouter:hover {
    background-color: #555;
}


/* ---------------------------------------------------------
   Bouton Annuler
   --------------------------------------------------------- */

.btn-annuler {
    height: 34px;
    padding: 6px 11px;
    font-size: 12px;
    color: #444;
    background-color: #f2f2f2;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
}

.btn-annuler:hover {
    background-color: #e5e5e5;
}


/* ---------------------------------------------------------
   Tableau des pages de gestion
   --------------------------------------------------------- */

.management-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

/* En-tête */
.management-table th {
    padding: 8px 10px;
    text-align: left;
    font-size: 12px;
    font-weight: bold;
    color: #555;
    background-color: #f5f6f8;
    border-bottom: 1px solid #ddd;
}

/* Cellules */
.management-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
    color: #333;
}

/* Pas de bordure sur la dernière ligne */
.management-table tbody tr:last-child td {
    border-bottom: none;
}

/* Survol */
.management-table tbody tr:hover {
    background-color: #fafafa;
}


/* ---------------------------------------------------------
   Colonne Actions
   --------------------------------------------------------- */

.management-table th:last-child,
.management-table td:last-child {
    width: 70px;
    text-align: center;
}


/* ---------------------------------------------------------
   Bouton Supprimer des pages de gestion
   --------------------------------------------------------- */

.btn-supprimer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 5px;
    background-color: #fff0f0;
    color: #c62828;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

.btn-supprimer:hover {
    background-color: #ffe0e0;
    color: #a51f1f;
    transform: none;
}


/* =========================================================
   24. MODALE DE CONFIRMATION
   ========================================================= */

/* Fond de la modale */
.confirmation-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    background-color: rgba(0, 0, 0, 0.45);
    align-items: center;
    justify-content: center;
}

/* Modale visible */
.confirmation-modal.visible {
    display: flex;
}


/* ---------------------------------------------------------
   Contenu
   --------------------------------------------------------- */

.confirmation-content {
    width: 400px;
    max-width: calc(100% - 40px);
    box-sizing: border-box;
    padding: 22px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    text-align: center;
}


/* ---------------------------------------------------------
   Icône
   --------------------------------------------------------- */

.confirmation-icon {
    font-size: 32px;
    margin-bottom: 8px;
}


/* ---------------------------------------------------------
   Titre
   --------------------------------------------------------- */

.confirmation-content h2 {
    margin: 0 0 10px 0;
    font-size: 18px;
}


/* ---------------------------------------------------------
   Message
   --------------------------------------------------------- */

.confirmation-content p {
    margin: 0 0 20px 0;
    color: #555;
    font-size: 13px;
    line-height: 1.5;
}


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

.confirmation-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.confirmation-buttons button {
    width: auto;
    height: 32px;
    padding: 5px 13px;
    font-size: 12px;
    white-space: nowrap;
}


/* ---------------------------------------------------------
   Bouton Confirmer
   --------------------------------------------------------- */

.btn-confirmation {
    background-color: #c62828;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.btn-confirmation:hover {
    background-color: #a51f1f;
}


/* =========================================================
   25. RESPONSIVE
   ========================================================= */

/* ---------------------------------------------------------
   Écrans de moins de 1040 px
   --------------------------------------------------------- */

@media (max-width: 1040px) {

    body:has(.management-section) > header,
    body:has(.management-section) > main {
        width: auto;
        max-width: calc(100% - 30px);
    }
}


/* ---------------------------------------------------------
   Écrans de moins de 650 px
   --------------------------------------------------------- */

@media (max-width: 650px) {

    /* Formulaire de gestion en colonne */
    .management-form {
        align-items: stretch;
        flex-direction: column;
    }

    /* Chaque bloc prend toute la largeur */
    .management-form > div {
        width: 100%;
    }

    /* Champs pleine largeur */
    .management-form input {
        width: 100%;
    }

    /* Boutons restent côte à côte */
    .management-form-buttons {
        flex-direction: row !important;
    }
}

/* Modale d'ajout / modification : adaptation aux petits écrans */
@media (max-width: 650px) {
    #filament-form.form-container {
        padding: 10px;
        align-items: flex-start;
    }

    .filament-modal-content {
        max-height: calc(100vh - 20px);
        padding: 18px;
    }

    #filament-form form {
        grid-template-columns: minmax(0, 1fr);
    }

    #filament-form form label:has(textarea),
    #filament-form .form-buttons {
        grid-column: auto;
    }
}

/* ==========================================================
   FILAMENT MANAGER — MODERNI­SATION DE LA FENÊTRE DE PESÉE
   ========================================================== */

/* Fond flouté derrière la fenêtre */

#weighing-form.modal {
    position: fixed;
    inset: 0;
    z-index: 3000;

    align-items: center;
    justify-content: center;

    padding: 20px;
    box-sizing: border-box;

    background: rgba(20, 30, 40, 0.25);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* Fenêtre principale */

#weighing-form .modal-content {
    width: min(480px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-sizing: border-box;

    padding: 28px;

    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 18px;

    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);

    animation: weighing-appear 160ms ease-out;
}

/* Apparition douce */

@keyframes weighing-appear {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.99);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Titre */

#weighing-form .modal-content h2 {
    margin: 0 0 24px;
    padding-bottom: 18px;

    color: #24364B;
    font-size: 24px;
    font-weight: 750;

    border-bottom: 1px solid #E8EDF3;
}

/* Encadrés d'informations de la bobine */

#weighing-form .modal-content > p {
    display: flex;
    flex-direction: column;
    gap: 5px;

    margin: 10px 0;
    padding: 12px 14px;

    border: 1px solid #E5EAF0;
    border-radius: 10px;

    background: #F7F9FC;
    color: #64748B;
    font-size: 13px;
}

/* Valeurs des informations */

#weighing-form .modal-content > p strong {
    color: #24364B;
    font-size: 16px;
    font-weight: 700;
}

/* Formulaire */

#weighing-form #weighing-form-content {
    display: grid;
    gap: 18px;
    margin-top: 24px;
}

/* Chaque champ */

#weighing-form .weighing-field {
    display: grid;
    gap: 8px;
}

/* Libellés */

#weighing-form .weighing-field label {
    color: #344256;
    font-size: 14px;
    font-weight: 700;
}

/* Saisie du poids et date */

#weighing-form .weighing-field input {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    box-sizing: border-box;

    border: 1px solid #D5DDE7;
    border-radius: 9px;

    background: #FBFCFE;
    color: #1F2937;

    font: inherit;
    font-size: 16px;

    outline: none;

    transition:
        border-color 140ms ease,
        box-shadow 140ms ease,
        background 140ms ease;
}

/* Champ actif */

#weighing-form .weighing-field input:focus {
    border-color: #5B9BC4;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(91, 155, 196, 0.18);
}

/* Boutons */

#weighing-form .form-buttons {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;

    margin-top: 8px;
    padding-top: 20px;

    border-top: 1px solid #E8EDF3;
}

#weighing-form .form-buttons button {
    min-height: 44px;
    padding: 11px 19px;

    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;

    cursor: pointer;
    transition: background 140ms ease, transform 140ms ease;
}

/* Enregistrer */

#weighing-form .form-buttons button[type="submit"] {
    border: none;
    background: #A9D6F5;
    color: #23445A;
}

#weighing-form .form-buttons button[type="submit"]:hover {
    background: #5B9BC4;
    color: #FFFFFF;
}

/* Annuler */

#weighing-form #cancel-weighing {
    border: 1px solid #D1D5DB;
    background: #E5E7EB;
    color: #374151;
}

#weighing-form #cancel-weighing:hover {
    background: #D1D5DB;
    color: #1F2937;
}

/* Clic sur les boutons */

#weighing-form .form-buttons button:active {
    transform: translateY(1px);
}

/* Petits écrans */

@media (max-width: 520px) {
    #weighing-form.modal {
        padding: 10px;
    }

    #weighing-form .modal-content {
        max-height: calc(100vh - 20px);
        padding: 20px 16px;
        border-radius: 14px;
    }

    #weighing-form .modal-content h2 {
        font-size: 21px;
    }

    #weighing-form .form-buttons button {
        flex: 1;
    }
}

/* Respect des préférences d'accessibilité */

@media (prefers-reduced-motion: reduce) {
    #weighing-form .modal-content {
        animation: none;
    }

    #weighing-form * {
        transition: none !important;
    }
}
