/* ========== BASE ========= */

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f4f4f4;
}

header {
  background: linear-gradient(135deg, #192d4e, #c82c4f);
  color: white;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  z-index: 1000;
}

header img {
  height: 50px;
}

main {
  padding: 20px;
  margin-top: 80px; /* Compense la barre fixe */
}

ul,
ol {
  padding: 0 0 0 0;
  margin: 0 0 0 50px;
}

/* ========== INTRODUCTION ========= */

.intro form {
  padding: 20px 20px 0 20px;
}

/* ========== LAYOUT (GRID / STRUCTURE) ========= */

/* Grille de plaque 96 puits */
.plate {
  display: none;
  grid-template-columns: repeat(13, 1fr); /* 12 colonnes + 1 label */
  gap: 5px;
  text-align: center;
  margin-top: 20px;
}

.plate .label {
  font-weight: bold;
  background-color: #ddd;
  padding: 10px;
  border: 1px solid #ccc;
}

/* Puits individuels */
.well {
  background-color: white;
  border: 1px solid #ccc;
  padding: 10px;
  border-radius: 5px;
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.well #id {
  color: red;
  font-size: 15px;
}

/* ========== BARRE DE PROGRESSION ========= */

.progressbar {
  width: 90%;
  height: 10px;
  border: 2px solid black;
  margin-top: 5px;
  position: relative;
}

.progressbar .fill {
  height: 100%;
  background: linear-gradient(to right, green, red);
  transition: width 0.3s ease;
}

/* ========== FORMULAIRES ET UPLOAD ========= */

.upload-form {
  margin: 0 0 20px 0;
  background: #fff;
  padding: 20px;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.upload-input {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

.upload-button,
.button,
.buttonExport,
.submitBtn {
  background-color: #192d4e;
  color: #fff;
  padding: 10px 15px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}

.upload-button:hover,
.button:hover,
.buttonExport:hover {
  background-color: #c82c4f;
}

.upload-button:disabled {
  background-color: #ccc;
  color: #666;
  cursor: not-allowed;
  border: 1px solid #aaa;
}

.title {
  font-weight: bold;
  font-size: 16px;
}

/* ========== UPLOAD TABS ========= */

.upload-tabs-wrapper {
  border: 1px solid #ccc;
  border-radius: 6px;
  overflow: hidden;
  background-color: #fff;
}

.upload-tabs-header {
  display: flex;
  border-bottom: 1px solid #ccc;
}

.upload-tab {
  flex: 1;
  background-color: #eee;
  border: none;
  border-right: 1px solid #ccc;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
  text-align: center;
  font-weight: bold;
  color: #333;
}

.upload-tab:last-child {
  border-right: none;
}

.upload-tab-active {
  background-color: #192d4e;
  color: white;
}

.upload-tab-content {
  padding: 15px;
  background: #fff;
}

/* ========== ORGANISATION DES BLOCS ========= */

.upload-sections {
  /* display: flex;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%; */
}

/* ========== ALIGNEMENT DES ÉLÉMENTS FACTEUR ========= */

.upload-tab-content > div[style*="display: flex"] {
  justify-content: space-between;
  align-items: center;
}

.upload-tab-content
  > div[style*="display: flex"]
  > div[style*="display: flex"] {
  margin-left: auto;
  gap: 5px;
}

/* ========== TRI DU TABLEAU ========= */

#listTable {
  table-layout: fixed; /* Force les largeurs définies */
  width: 100%;
}

#listTable th,
#listTable td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}

/* Permettre aux en-têtes de passer sur deux lignes */
#listTable th {
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.2;
  min-height: 40px;
  vertical-align: top;
  padding: 8px 4px;
}

/* Permettre le retour à la ligne pour certaines colonnes */
#listTable td:nth-child(2), /* Sample/Échantillon */
#listTable td:nth-child(8), /* Concentration ug/ml */
#listTable td:nth-child(9) {
  /* Concentration ufc/ml */
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.2;
}

.sortable {
  position: relative;
  user-select: none;
  min-width: 120px; /* Largeur minimale pour éviter le redimensionnement */
}

.sortable:hover {
  background-color: #2a4a7a !important;
}

.sort-indicator {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: 0.7;
  width: 12px;
  text-align: center;
}

.sortable:hover .sort-indicator {
  opacity: 1;
}

/* Largeurs spécifiques pour certaines colonnes */
.sortable[data-sort="well"] {
  min-width: 80px;
  width: 80px;
}

.sortable[data-sort="sample"] {
  min-width: 150px;
  width: 150px;
}

.sortable[data-sort="ct-arn"],
.sortable[data-sort="ct-adn"],
.sortable[data-sort="ct-ci"],
.sortable[data-sort="ct-arn-offset"],
.sortable[data-sort="ct-adn-offset"],
.sortable[data-sort="ct-ci-offset"] {
  min-width: 100px;
  width: 100px;
}

.sortable[data-sort="concentration-ug"],
.sortable[data-sort="concentration-ufc"] {
  min-width: 140px;
  width: 140px;
}

.sortable[data-sort="viabilite"] {
  min-width: 100px;
  width: 100px;
}

.sortable[data-sort="status"] {
  min-width: 100px;
  width: 100px;
}

/* Responsive : blocs en colonne sur mobile */
@media screen and (max-width: 768px) {
  .upload-sections .upload-form,
  .upload-sections .upload-form.infos {
    flex: 1 1 100%;
    max-width: 100%;
  }

  /* Responsive pour les nouveaux éléments facteur et sauvegarder */
  .upload-tab-content > div[style*="display: flex"] {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    justify-content: flex-start;
  }

  .upload-tab-content
    > div[style*="display: flex"]
    > div[style*="display: flex"] {
    justify-content: flex-end;
    margin: 5px 0;
    margin-left: 0;
  }

  .upload-tab-content input[type="number"] {
    width: 100px !important;
    text-align: center;
  }

  .upload-tab-content label {
    font-size: 13px;
  }
}

/* ========== STATUTS DES PUITS (résultats) ========= */

.row-positif {
  background-color: #f8d7da; /* Rouge pâle */
}

.row-negatif {
  background-color: #d4edda; /* Vert pâle */
}

.row-invalide {
  background-color: #fff3cd; /* Jaune/orange pâle */
}

/* ========== MESSAGES D'ERREUR ========= */

.error {
  color: #a94442;
  background-color: #f2dede;
  border: 1px solid #ebccd1;
  padding: 10px 15px;
  border-radius: 4px;
  margin-top: 10px;
}

/* ========== PANNEAU DEBUG ========= */

.debug-panel {
  margin-top: 0px;
  background: #f9f9f9;
  padding: 15px;
  font-family: monospace;
  font-size: 13px;
}

.debug-panel h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
}

.debug-panel pre {
  max-height: 300px;
  overflow-y: auto;
  background: #fff;
  padding: 10px;
  border: 1px solid #ddd;
}

/* ========== Print ========= */

@media print {
  .no-print {
    display: none !important;
  }
  .printme {
    display: block !important;
  }
}
