/* ============================= */
/* Reset largeur page / conteneurs
/* ============================= */
html, body {
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

body > * {
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* ============================= */
/* Tableau principal
/* ============================= */

/* Wrapper pour scroll horizontal sur mobile si besoin */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

/* Le tableau occupe toute la largeur,
   et les colonnes sont fixes pour respecter les pourcentages */
.table-wrapper table {
  width: 100% !important;
  border-collapse: collapse;
  table-layout: fixed; /* indispensable pour des largeurs de colonnes fiables */
}

/* Répartition des colonnes : 40 / 15 / 15 / 30 */
.table-wrapper th:nth-child(1),
.table-wrapper td:nth-child(1) { width: 40%; } /* Dénomination */

.table-wrapper th:nth-child(2),
.table-wrapper td:nth-child(2) { width: 15%; } /* Poids */

.table-wrapper th:nth-child(3),
.table-wrapper td:nth-child(3) { width: 15%; } /* Prix */

.table-wrapper th:nth-child(4),
.table-wrapper td:nth-child(4) { width: 30%; } /* Quantité */

/* Cellules */
.table-wrapper th,
.table-wrapper td {
  text-align: left;
  padding: 0.5rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  vertical-align: middle;
}

/* ============================= */
/* Contrôles de quantité
/* ============================= */

/* Conteneur input + boutons (si jamais utilisé par classe) */
td .quantity-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* Boutons +/- */
td .qty-btn {
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  background: #2c2f38;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: unset !important; /* override Classless CSS */
  padding: 0;
}

td button:hover { background: #3a3f4b; }
td button:active {
  background: #1f2229;
  transform: translateY(1px);
}

/* Champ numérique */
td input[type="number"] {
  width: 60px;     /* sera réduit en responsive */
  height: 40px;
  text-align: center;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin: 0;
  box-sizing: border-box;
}

/* ============================= */
/* Actions sous le tableau
/* ============================= */
.cart-actions {
  margin: 0.75rem 0 0.5rem;
  display: flex;
  justify-content: center;
  width: 100%;
}

#reset-btn {
  cursor: pointer;
  border: 1px solid #ddd;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  background: #1f2229;
  color: #fff;
  min-width: unset !important; /* override Classless CSS */
}

#reset-btn:hover {
  background: #efefef;
  color: #111;
}

/* ============================= */
/* Tableau récapitulatif
/* ============================= */
.summary-table,
.summary-table th,
.summary-table td {
  background: #fff !important;
  color: #111 !important;
}

.summary-table th {
  background: #f6f7f9 !important;
}

.summary-table th,
.summary-table td {
  border-bottom: 1px solid #e5e7eb !important;
}

/* Mode sombre : garder un fond clair lisible pour le récap */
@media (prefers-color-scheme: dark) {
  .summary-table,
  .summary-table th,
  .summary-table td {
    background: #ffffff !important;
    color: #111111 !important;
  }
  .summary-table th {
    background: #f2f3f5 !important;
  }
}

/* ============================= */
/* Responsive
/* ============================= */
@media (max-width: 960px) {
  .table-wrapper table {
    font-size: 0.9rem;
  }

  td .qty-btn {
    width: 32px !important;
    height: 32px;
    font-size: 1rem;
  }

  td input[type="number"] {
    width: 42px;
    height: 32px;
    font-size: 0.9rem;
  }

  .table-wrapper th,
  .table-wrapper td {
    padding: 0.35rem;
  }
}

/* encore plus petit */
@media (max-width: 480px) {
  .table-wrapper table {
    font-size: 0.85rem;
  }

  td .qty-btn {
    width: 28px !important;
    height: 28px;
    font-size: 0.95rem;
  }

  td input[type="number"] {
    width: 38px;
    height: 28px;
    font-size: 0.85rem;
  }
}
