body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
}

/* Style pour the dashboard */
.container {
    margin: auto;
    padding: 20px;
}
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}
.card {
    background: #f4f4f4;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 1px 1px 6px rgba(0,0,0,0.1);
}
.card h4 {
    margin-bottom: 10px;
}

/* Style pour le navbar */
.navbar {
  display: flex;
  justify-content: space-between; /* Sépare gauche/droite */
  align-items: center;
  background-color: #2c2f4e;
  padding: 10px 20px;
  overflow-x: auto;
}

.nav-items {
  display: flex;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
  margin-right: 30px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.3s;
}

.nav-item:hover {
  color: #ffca28;
}

.material-symbols-outlined {
  font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 24;
  font-size: 24px;
  margin-bottom: 4px;
}

.label {
  font-size: 12px;
}

/* Partie profil utilisateur */
.user-profile {
  display: flex;
  align-items: center;
  color: #fff;
}

.profile-pic {
  width: 32px;
  height: 32px;
  background-color: #ccc;
  border-radius: 50%;
  margin-right: 10px;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.username {
  font-size: 14px;
  font-weight: 500;
}

.details {
  font-size: 10px;
  color: #ccc;
}

/* --- Popup de profil utilisateur --- */
.profile-popup {
  display: none;
  position: fixed;
  right: 0;
  top: 100%;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 100;
  transition: all 0.2s ease;
}

.popup-item {
  display: block;
  padding: 10px 16px;
  color: #333;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s;
}

.popup-item:hover {
  background-color: #f5f5f5;
}

.popup-item.logout {
  color: #d32f2f;
  font-weight: 500;
}

/* Fix bouton de déconnexion pour qu'il ressemble aux liens */
.popup-item-button {
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: #d32f2f;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
}

.popup-item-button:hover {
  background-color: #fbe9e7;
}

/* Style pour formulaire de créer de l'utilisateur principale */
.register-container {
  max-width: 1000px;
  margin: auto;
  padding: 20px;
}

.register-container h2 {
  text-align: center;
  margin-bottom: 30px;
  font-size: 28px;
}

.register-form {
  background: #f9f9f9;
  padding: 25px;
  border-radius: 10px;
  border: 1px solid #ddd;
}

.form-columns {
  display: flex;
  gap: 30px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.form-section {
  flex: 1;
  min-width: 300px;
  padding: 10px;
}

.form-section legend {
  font-weight: bold;
  margin-bottom: 15px;
}

.form-field {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
}

.form-field label {
  margin-bottom: 5px;
  font-weight: 500;
}

.form-field input,
.form-field select {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

.form-actions {
  text-align: center;
  margin-top: 20px;
}

.form-actions button {
  padding: 10px 25px;
  background:rgb(38, 29, 1);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 16px;
  cursor: pointer;
}

.form-actions button:hover {
  background: #1e203a;
}

/* Style pour la page de connexion */
.login-container {
  max-width: 600px;
  margin: 20px auto;
  background: #f9f9f9;
  padding: 30px;
  border-radius: 10px;
  border: 1px solid #ddd;
}

.login-container h2 {
  text-align: center;
  margin-bottom: 25px;
  font-size: 26px;
}

.login-form .form-field {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
}

.login-form label {
  margin-bottom: 5px;
  font-weight: 500;
}

.login-form input {
  padding: 8px;
  border-radius: 5px;
  border: 1px solid #ccc;
}

.register-link {
  margin-top: 20px;
  text-align: center;
}

.form-errors {
  color: red;
  margin-bottom: 15px;
  text-align: center;
}

/* Style pour la page profil utilisateur */
.entreprise-logo,
.user-avatar {
  max-height:60px; 
  height: 52px; 
  width: 52px; 
  border: #ccc solid 1px; 
  border-radius: 15%;
}

.entreprise-photo,
.user-photo {
  text-align: center;
}

/* Style pour le formulaire d'ajout ou de modification d'une utilisateur */
.form-container {
  max-width: 700px;
  margin: 20px auto;
  padding: 30px;
  background-color: #f9f9f9;
  border-radius: 10px;
  border: 1px solid #ddd;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.user-form .form-group {
  margin-bottom: 10px;
}

.user-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.user-form input,
.user-form select,
.user-form textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  box-sizing: border-box; /* <-- Assure que le padding n’élargit pas le champ */
}

.btn-submit {
  background-color: #2c2f4e;
  color: white;
  padding: 10px 38px;
  display: block;
  margin: 0 auto;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-size: 16px;
}

.btn-submit:hover {
  background-color: #1e203a;
}

/* Style tableau pour lister les membres de chaque entreprise */
.members-container {
  margin: 0;
  padding: 20px;
}
.members-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.members-table thead {
  background-color: #3f3f3f;
  color: white;
}

.members-table th,
.members-table td {
  padding: 12px 16px;
  text-align: left;
  font-size: 14px;
}

.members-table tbody tr:nth-child(odd) {
  background-color: #f9f9f9;
}

.members-table tbody tr:nth-child(even) {
  background-color: #ffffff;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: none;
  cursor: pointer;
  text-decoration: none;
}

.action-btn i {
  margin-right: 6px;
}

.action-btn.edit {
  color: #0288d1;
}

.action-btn.edit:hover {
  text-decoration: underline;
}

.action-btn.delete {
  color: #d32f2f;
}

.action-btn.delete:hover {
  text-decoration: underline;
}

.btn-add-member {
  display: inline-flex;
  align-items: center;
  background-color: #4caf50;
  color: white;
  padding: 8px 18px;
  margin: 20px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 50px;
  text-decoration: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s, box-shadow 0.3s;
}

.btn-add-member i {
  margin-right: 8px;
  font-size: 16px;
}

.btn-add-member:hover {
  background-color: #388e3c;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Style tableau toujours pour lister les membres de chaque entreprise partie popup */
/* Modale de confirmation */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-box {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  max-width: 220px;
  width: 90%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.modal-actions {
  margin-top: 20px;
  display: flex;
  justify-content: space-around;
}

.btn-confirm {
  background-color: #d32f2f;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 50px;
  cursor: pointer;
}

.btn-confirm:hover {
  background-color: #b71c1c;
}

.btn-cancel {
  background-color: #aaa;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 50px;
  cursor: pointer;
}

.btn-cancel:hover {
  background-color: #888;
}

/* Style pour la page unauthorized */
.unauthorized-container {
  margin: 20px auto;
  text-align: center;
}

.unauthorized-container h2 {
  color: #d32f2f;
  margin-bottom: 16px;
}


/* Style pour le footer */
.main-footer {
  background-color: #2c2f4e;
  color: #ffffff;
  padding: 20px 0;
  text-align: center;
  font-size: 14px;
  border-top: 3px solid #ffca28;
  margin-top: 40px;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}

.main-footer .footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-link {
  color: #ffca28;
  text-decoration: none;
}

.footer-link:hover {
  text-decoration: underline;
  text-decoration: none; /* Supprime le soulignement par défaut */
}


/* Page pour formulaire d'ajout de Categorie, Marque, Fournisseur, Produit et liste produits */
.grid-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "categorie marque"
    "fournisseur produit";
  gap: 0; /* Pas d'espace interne, on va créer des bordures */
  border: 1px solid #ccc;
  margin: 20px;
}

/* Chaque box a ses propres bordures pour délimitation nette */
.box {
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 0;
  background-color: #fefefe;
}

/* Nommer les zones */
#marque-form { grid-area: marque; border-right: 1px solid #ccc; border-bottom: 1px solid #ccc; }
#categorie-form { grid-area: categorie; border-left: 1px solid #ccc; border-bottom: 1px solid #ccc; }
#produit-form { grid-area: produit; border-right: 1px solid #ccc; border-top: 1px solid #ccc; }
#fournisseur-form { grid-area: fournisseur; border-left: 1px solid #ccc; border-top: 1px solid #ccc; }

.box h3 {
  margin-top: 0;
  font-size: 16px;
  margin-bottom: 10px;
  color: #333;
}

/* 🌟 Champs de formulaire stylés */
.box form input,
.box form textarea,
.box form select {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  background-color: #fff;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.box form input:focus,
.box form textarea:focus,
.box form select:focus {
  border-color: #3498db;
  box-shadow: 0 0 3px rgba(52, 152, 219, 0.5);
  outline: none;
}

/* 🌟 Bouton stylé */
.box form .btn {
  background-color: #2ecc71;
  color: white;
  border: none;
  padding: 10px 15px;
  font-size: 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.box form .btn:hover {
  background-color: #27ae60;
}

.product-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.product-column input,
.product-column select,
.product-column textarea {
  width: 100%;
  padding: 6px 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 10px;
}

.product-column select {
  background-color: #fff;
}

/* Corrige le débordement des champs dans toutes les .box */
.box form {
  box-sizing: border-box;
  width: 100%;
  display: block;
}

/* Empêche les champs de déborder */
.box form input,
.box form textarea,
.box form select {
  box-sizing: border-box;
  max-width: 100%;
}

/* ➕ Affichage horizontal pour les formulaires Catégorie et Marque */
.inline-form {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.inline-form input[type="text"] {
  flex: 1;
  margin-bottom: 0 !important;
}

.inline-form .btn {
  white-space: nowrap;
  padding: 8px 14px;
  margin-bottom: 0 !important;
}

.form-inline-group {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.form-inline-group input[type="text"] {
  flex: 1;
  margin-bottom: 0 !important;
}

.form-inline-group .btn {
  margin-bottom: 0 !important;
  padding: 10px 16px;
  white-space: nowrap;
}

/* Ajout du filtre style */
.filter-bar {
  border: 1px solid #ccc;
  padding: 15px;
  margin: 20px;
  background-color: #f4f6f8;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

/* Groupement des champs */
.filter-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex-grow: 1;
}

/* Champs individuels */
.filter-bar select,
.filter-bar input[type="text"] {
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #bbb;
  border-radius: 4px;
  background-color: #fff;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  min-width: 140px;
}

.filter-bar select:focus,
.filter-bar input[type="text"]:focus {
  border-color: #3498db;
  box-shadow: 0 0 4px rgba(52, 152, 219, 0.4);
  outline: none;
}

/* 🔍 Bouton rechercher */
.filter-bar .btn {
  background-color: #2ecc71;
  color: white;
  border: none;
  padding: 9px 15px;
  font-size: 14px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.filter-bar .btn i {
  font-size: 14px;
}

.filter-bar .btn:hover {
  background-color: #27ae60;
}

/* Une partie du style pour le tableau des produits - L'autre a déjà été redifer depuis le tableau des membres */
.products-container {
  margin: 20px;
}
.products-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.products-table thead {
  background-color: #3f3f3f;
  color: white;
}

.products-table th,
.products-table td {
  padding: 12px 16px;
  text-align: left;
  font-size: 14px;
}

.products-table tbody tr:nth-child(odd) {
  background-color: #f9f9f9;
}

.products-table tbody tr:nth-child(even) {
  background-color: #ffffff;
}

/* Style pour ouvrir le formulaire modale qui permet de modifier une facture */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  overflow-y: auto; /* scroll si besoin */
  padding: 20px; /* un peu d'espace sur mobile */
}

.modal-content {
  background-color: #fff;
  padding: 25px 30px;
  border-radius: 10px;
  width: 100%;
  max-width: 700px; /* un peu plus large pour les produits */
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  position: relative;
  animation: fadeIn 0.3s ease-in-out;
  box-sizing: border-box;
  max-height: 90vh;
  overflow-y: auto; /* scroll interne si trop grand */
}

.produits-edit-container label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.produits-list {
  max-height: 220px; /* hauteur max avant scroll */
  overflow-y: auto;
  border: 1px solid #ddd;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 10px;
  background: #fafafa;
}

.product-line-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.product-line-edit select,
.product-line-edit input {
  flex: 1 1 100px;
  min-width: 100px;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 14px;
}

.product-line-edit button.remove-btn {
  flex: 0 0 32px;
  background: #e74c3c;
  border: none;
  color: white;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
}

.product-line-edit button.remove-btn:hover {
  background: #c0392b;
}

.small-btn {
  padding: 6px 12px;
  font-size: 14px;
  border-radius: 5px;
  background-color: #2980b9;
  color: white;
  border: none;
  cursor: pointer;
  margin-top: 5px;
}
.small-btn:hover {
  background-color: #1f618d;
}

.modal-title {
  margin-bottom: 20px;
  font-size: 20px;
  font-weight: 600;
  color: #2c3e50;
}

.modal .close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  color: #aaa;
  cursor: pointer;
  transition: color 0.2s ease;
}
.modal .close:hover {
  color: #e74c3c;
}

.modal-form .form-group {
  margin-bottom: 15px;
  text-align: left;
}

.modal-form label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #333;
}

.modal-form select,
.modal-form input[type="date"],
.modal-form textarea,
.modal-form input[type="text"],
.modal-form input[type="number"] {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  background: #f9f9f9;
  display: block;
}


.modal-form textarea {
  resize: vertical;
}

.modal-actions {
  margin-top: 25px;
  display: flex;
  justify-content: space-between;
}

.modal .btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s ease;
}

.modal .cancel {
  background-color: #bdc3c7;
  color: #2c3e50;
}
.modal .cancel:hover {
  background-color: #95a5a6;
}

.modal .confirm {
  background-color: #27ae60;
  color: #fff;
}
.modal .confirm:hover {
  background-color: #1e8449;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-columns {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 30px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.modal-col {
  flex: 1;
  min-width: 230px;
  box-sizing: border-box;
}

/* Facultatif : ajoute un fond ou bordure pour visualiser */
.modal-col.left {
  padding-right: 10px;
  border-right: 1px solid #ddd;
}

.modal-col.right {
  padding-left: 10px;
}

@media (max-width: 768px) {
  .modal-columns {
    flex-direction: column;
  }
  .modal-col {
    width: 100%;
    border: none;
    padding: 0;
  }
}
