/* Import des polices Roboto */
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap");

/* Variables CSS pour les couleurs */
:root {
  --primary-dark: #2a256d;
  --primary-orange: #f05124;
  --primary-green: #28a745;
  --background-light: #f8f9fa;
  --background-grey: #c4c4c4;
  --border-color: #dee2e6;
  --text-dark: #333;
  --text-muted: #6c757d;
  --shadow: 1px 2px 8px #00000094;
}

/* Base du tableau produits */
.tableau-produits {
  font-family: "Roboto", sans-serif;
  max-width: 100%;
  width: 1011px;
  margin: 20px auto;
  background: #f1f1f1;
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Titre de la famille */
.titre-famille {
  background: #f1f1f1;
  color: var(--primary-dark);
  margin: 0;
  padding: 20px 30px;
  font-size: 18px;
  font-weight: 500;
  text-align: left;
}

/* Structure en grille du tableau */
.tableau-header,
.ligne-produit {
  display: grid;
  grid-template-columns: 125px 1fr 150px 25px 100px 80px 200px;
  /* grid-template-columns: 125px 1fr 76px 78px 100px 90px 6px; */
  gap: 10px;
  align-items: center;
  padding: 1px 20px;
  border-bottom: 1px solid var(--border-color);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* En-tête du tableau */
.tableau-header {
  background: var(--background-light);
  font-weight: 500;
  color: var(--or2);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}

/* Lignes de produits */
.ligne-produit {
  transition: background-color 0.2s ease;
}

.ligne-produit:hover {
  background-color: #f8f9ff;
}

.ligne-produit:last-child {
  border-bottom: none;
}

/* Colonnes spécifiques */
.col-code {
  font-family: "Roboto Mono", monospace;
  font-weight: 500;
  color: var(--or2);
  font-size: 14px;
}

.col-code2 {
  font-family: "Roboto Mono", monospace;
  font-weight: 500;
  color: var(--text-dark);
  font-size: 12px;
  font-style: italic;
}

.col-description {
  line-height: 1.4;
}

.col-description .designation {
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.designation {
  font-size: 11px;
}

.col-description .couleur-int {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.col-description .matiere {
  font-size: 10px;
  color: var(--primary-dark);
  font-weight: bold;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.col-description .format {
  font-size: 11px;
  font-weight: bold;
  color: var(--primary-orange);
  margin-bottom: 2px;
}

/* Couleurs */
.couleurs-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 80px;
  overflow-y: auto;
}

.couleur-item {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 6px;
  padding: 0 8px;
  background: #cecece;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  min-width: 80px;
  width: 100%;
}

.couleur-image {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  order: 2;
}

.couleur-nom {
  color: var(--text-dark);
  font-weight: 400;
  flex-grow: 1;
  order: 1;
  text-align: left;
}

/* Conditionnement */
.col-nb {
  text-align: center;
  font-weight: 500;
  color: var(--text-muted--);
}

.col-nb2 {
  font-size: 10px;
}

/* Contrôle de quantité */
.quantite-control {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  width: 100px;
}

.btn-moins,
.btn-plus {
  background: var(--background-light);
  border: none;
  width: 32px;
  height: 32px;
  font-size: 16px;
  font-weight: bold;
  color: var(--primary-dark);
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-moins:hover,
.btn-plus:hover {
  background: var(--primary-dark);
  color: white;
}

.input-quantite {
  border: none;
  width: 50px;
  height: 32px;
  text-align: center;
  font-weight: 500;
  background: white;
  font-family: "Roboto", sans-serif;
}

/* Prix */
.col-prix {
  font-weight: 500;
  color: var(--text-dark);
  font-size: 12px;
  text-align: right;
}

/* Bouton ajouter au panier */
.btn-ajouter-panier {
  background: var(--vert1);
  color: var(--blanc1);
  border: none;
  padding: 8px 8px;
  border-radius: 6px;
  font-family: "Roboto", sans-serif;
  font-weight: 500;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-ajouter-panier:hover {
  background: var(--vert2);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(170, 170, 170, 0.3);
}

.btn-ajouter-panier:active {
  transform: translateY(0);
}

/* Messages d'erreur */
.erreur {
  color: var(--rouge1);
  background: var(--blanc3);
  border: 1px solid var(--blanc3);
  padding: 15px;
  border-radius: 6px;
  margin: 20px;
  font-family: "Roboto", sans-serif;
}

/* Tableau du panier */
.table-panier {
  width: 100%;
  border-collapse: collapse;
  font-family: "Roboto", sans-serif;
  background: antiquewhite;
  margin-bottom: 20px;
}
.table-panier th,
.table-panier td {
  border: 1px solid var(--border-color);
  padding: 10px 8px;
  text-align: left;
  font-size: 16px;
}
.table-panier th {
  background: var(--fond-principal);
  color: #fff;
  font-weight: 500;
}
.table-panier tr:nth-child(even) {
  background: var(--background-light);
}
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
.recap-panier {
  background: var(--background-light);
  border-radius: 8px;
  padding: 18px 20px;
  margin: 0 auto 20px auto;
  font-size: 18px;
  box-shadow: var(--shadow);
  width: 260px;
}
.recap-panier p {
  margin: 8px 0;
}
@media (max-width: 900px) {
  .table-panier th,
  .table-panier td {
    font-size: 15px;
    padding: 8px 6px;
  }
  .recap-panier {
    font-size: 16px;
    padding: 14px 10px;
  }
}
@media (max-width: 600px) {
  .table-responsive {
    overflow-x: auto;
  }
  .table-panier th,
  .table-panier td {
    font-size: 13px;
    padding: 6px 4px;
  }
  .recap-panier {
    font-size: 15px;
    padding: 10px 5px;
  }
}

/* Responsive */
@media (max-width: 1200px) {
  .tableau-header,
  .ligne-produit {
    grid-template-columns: 100px 1fr 160px 70px 120px 100px 165px;
    gap: 10px;
    padding: 12px 15px;
  }

  .titre-famille {
    padding: 15px 20px;
    font-size: 20px;
  }
}

@media (max-width: 768px) {
  .tableau-header,
  .ligne-produit {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .tableau-header > div,
  .ligne-produit > div {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
  }

  .tableau-header > div:before,
  .ligne-produit > div:before {
    content: attr(data-label);
    font-weight: bold;
    display: inline-block;
    width: 100px;
    color: var(--primary-dark);
  }

  .couleurs-container {
    max-height: none;
  }

  .quantite-control {
    width: fit-content;
  }
}

/* Animation d'ajout au panier */
@keyframes ajoutPanier {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

.btn-ajouter-panier.adding {
  animation: ajoutPanier 0.3s ease;
  background: #28a745;
}

.btn-ajouter-panier.adding:after {
  content: " ✓";
}

/* Actions: colonne dédiée aux boutons (panier + personnaliser) */
.col-action {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Bouton personnaliser : s'assurer qu'il tient dans la colonne */
.personalize-item {
  background: #f05124;
  color: #fff;
  border: none;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
}

.personalize-item:hover {
  transform: translateY(-1px);
}

/* Ajustements des largeurs quand la colonne couleur est masquée */

.tableau-header.sans-couleur,
.ligne-produit.sans-couleur {
  /* grid-template-columns: 140px 1fr 30px 120px 90px 120px; */
  grid-template-columns: 103px 1fr 46px 89px 73px 174px;
}

.tableau-header.sans-couleur .col-description.sans-couleur {
  width: 40%;
}

.tableau-header.sans-couleur .col-code.sans-couleur {
  width: 15%;
}

.tableau-header.sans-couleur .col-nb.sans-couleur {
  text-align: center;
  width: 10%;
}

.tableau-header.sans-couleur .col-quantite.sans-couleur {
  width: 15%;
}

.tableau-header.sans-couleur .col-prix.sans-couleur {
  width: 84%;
}

.tableau-header.sans-couleur .col-action.sans-couleur {
  width: 8%;
}
