/* Style général du conteneur */
#block-theme-mc-content {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  padding: 30px 20px;
  color: #333;
  max-width: 1200px;
  margin: 0 auto;
}

/* Pages de liste : toute la largeur disponible (actualites.css limite le bloc à 900px) */
#block-theme-mc-content:has(table.webform-results-table) {
  max-width: none;
}

/* Formulaires */
form.webform-filter-form,
form.webform-submission-bulk-form {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 25px 30px;
  margin-bottom: 40px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.05);
}

/* Détails (Filtrer les soumissions) */
details.container-inline {
  margin-bottom: 30px;
}

details summary {
  font-weight: 600;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 10px 0;
  border-bottom: 2px solid #ccc;
  color: #1a73e8;
}

details[open] summary {
  color: #155ab6;
}

/* Champs de formulaire */
.js-form-item {
  margin-bottom: 18px;
}

.form-search {
  width: 100%;
  padding: 10px 14px;
  font-size: 1rem;
  border: 1.8px solid #bbb;
  border-radius: 6px;
  transition: border-color 0.3s ease;
}

.form-search:focus {
  border-color: #1a73e8;
  outline: none;
  box-shadow: 0 0 6px rgba(26, 115, 232, 0.4);
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  font-size: 1rem;
  border: 1.8px solid #bbb;
  border-radius: 6px;
  background: white;
  transition: border-color 0.3s ease;
}

.form-select:focus {
  border-color: #1a73e8;
  outline: none;
  box-shadow: 0 0 6px rgba(26, 115, 232, 0.4);
}

/* Boutons */
.button,
input.button {
  background-color: #1a73e8;
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
  box-shadow: 0 2px 6px rgba(26, 115, 232, 0.4);
}

.button:hover,
input.button:hover {
  background-color: #155ab6;
  box-shadow: 0 4px 12px rgba(21, 90, 182, 0.6);
}

/* Bouton lien Personnaliser */
a.button.button-action {
  display: inline-block;
  margin-bottom: 40px;
  background-color: #f0f0f0;
  color: #333;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid #ccc;
  transition: background-color 0.3s ease;
}

a.button.button-action:hover {
  background-color: #ddd;
}

/* Texte des soumissions */
#block-theme-mc-content > div:last-child {
  font-size: 1.1rem;
  margin-bottom: 40px;
  font-weight: 600;
  color: #555;
}

/* Tableaux */
table.webform-results-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 30px;
  font-size: 0.95rem;
  background: white;
  border-radius: 8px;
  /* "clip" et pas "hidden" : hidden ferait du tableau le conteneur de défilement
     de l'en-tête sticky du core, qui se retrouverait décalé par-dessus les lignes. */
  overflow: clip;
  box-shadow: 0 1px 5px rgb(0 0 0 / 0.1);
}

table.webform-results-table th,
table.webform-results-table td {
  padding: 12px 15px;
  border-bottom: 1px solid #eee;
  text-align: left;
  vertical-align: middle;
  /* webform.admin.css met nowrap sur toutes les cellules : le tableau dépassait de l'écran */
  white-space: normal;
}

table.webform-results-table thead {
  background-color: #1a73e8;
  color: white;
  font-weight: 600;
  font-size: 1rem;
}

/* Le tableau porte aussi la classe responsive-enabled : on neutralise ici
   le style prévu pour les tableaux imbriqués (bons de livraison). */
table.webform-results-table.responsive-enabled thead th {
  background-color: #1a73e8;
  color: white;
  border: none;
}

table.webform-results-table.responsive-enabled td {
  background-color: transparent;
  border: none;
  border-bottom: 1px solid #eee;
}

table.webform-results-table thead th a {
  color: inherit;
  text-decoration: none;
}

table.webform-results-table thead th a:hover {
  text-decoration: underline;
}

table.webform-results-table tbody tr:hover {
  background-color: #f0f8ff;
}

table.webform-results-table tbody td a {
  color: #1a73e8;
  font-weight: 600;
}

/* Statut : seulement le badge dans le tableau (date et message sur la page de la demande) */
table.webform-results-table .webform-workflow-author-and-changed,
table.webform-results-table .webform-workflow-log-public {
  display: none;
}

table.webform-results-table .webform-workflow-state-label {
  white-space: nowrap;
}

/* Motif de la demande : 3 lignes max, texte complet au survol (classes posées par theme_mc.js) */
table.webform-results-table td.motif-cell {
  min-width: 200px;
  max-width: 280px;
  cursor: help;
}

table.webform-results-table .motif-tronque {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
}

table.webform-results-table th.select-all,
table.webform-results-table td.select-all {
  width: 40px;
  text-align: center;
}

.webform-results-table__icon {
  text-align: center;
  width: 40px;
}

/* Signatures images */
.webform-signature-image {
  max-height: 50px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Tables imbriqués pour bons de livraison */
table.responsive-enabled {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 0.9rem;
}

table.responsive-enabled th,
table.responsive-enabled td {
  padding: 8px 10px;
  border: 1px solid #ddd;
  text-align: left;
  background-color: #fafafa;
}

table.responsive-enabled thead th {
  background-color: #e2e8f0;
  font-weight: 600;
}

/* Dropbutton actions */
.webform-dropbutton-wrapper {
  min-width: 150px;
  text-align: center;
}

/* Pas de menu déroulant dans les tableaux : toutes les actions en boutons côte à côte.
   Le menu du core est positionné en absolu et était coupé par le tableau (overflow). */
table.webform-results-table td .dropbutton-multiple {
  padding-right: 0;
  margin-right: 0;
}

table.webform-results-table td .dropbutton-multiple .dropbutton-widget {
  position: static;
  padding-right: 0;
}

table.webform-results-table .dropbutton-multiple .dropbutton .secondary-action {
  display: block;
}

table.webform-results-table .dropbutton-toggle {
  display: none;
}

table.webform-results-table td.webform-dropbutton-wrapper {
  text-align: left;
}

table.webform-results-table .webform-dropbutton ul.dropbutton {
  flex-wrap: nowrap;
}

.webform-dropbutton ul.dropbutton {
  list-style: none;
  padding: 0;
  margin: 0;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.webform-dropbutton ul.dropbutton li {
  margin: 0;
}

.webform-dropbutton ul.dropbutton li a,
.webform-dropbutton ul.dropbutton li button {
  background: #e1e7f3;
  border: 1px solid #a0aad4;
  color: #333;
  padding: 6px 12px;
  font-size: 0.9rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.25s ease;
  text-decoration: none;
}

.webform-dropbutton ul.dropbutton li a:hover,
.webform-dropbutton ul.dropbutton li button:hover {
  background: #c7d1f5;
}

/* Responsive : ajout d'espace vertical entre les blocs dans les petits écrans */
@media (max-width: 768px) {
  #block-theme-mc-content {
    padding: 20px 10px;
  }
  form.webform-filter-form,
  form.webform-submission-bulk-form {
    padding: 20px 15px;
    margin-bottom: 30px;
  }
  table.webform-results-table th,
  table.webform-results-table td {
    padding: 10px 8px;
  }
}

/* Écrans étroits : les colonnes ne tiennent pas, le tableau défile horizontalement
   (sinon la colonne Actions est coupée, la page étant en overflow-x: hidden).
   L'en-tête sticky du core est désactivé : dans un conteneur de défilement, il se
   retrouverait décalé par-dessus les lignes (voir le commentaire sur overflow: clip). */
@media (max-width: 1200px) {
  table.webform-results-table {
    display: block;
    overflow-x: auto;
  }
  table.webform-results-table.sticky-header thead {
    position: static;
  }
}

/* Force la modale Webform au-dessus de tout */
.ui-dialog.webform-ui-dialog {
  z-index: 501 !important;
}

/* Important : overlay aussi */
.ui-widget-overlay {
  z-index: 500 !important;
}
