/* ==========================================================================
   Tarifs Consultation — component styles
   Palette dérivée du visuel fourni (prune / rose)
   ========================================================================== */

.tarifs-widget {
  --c-plum: #5b2c4d;          /* fond entêtes table, boutons */
  --c-plum-dark: #4a2340;     /* hover boutons */
  --c-pink: #c2387d;          /* titres de section, labels résultat */
  --c-focus: #e91e8c;         /* bordure focus des selects */
  --c-total-bg: #e0c8de;      /* fond ligne Total */
  --c-row-alt: #ececec;       /* lignes paires du tableau */
  --c-label: #8c90a4;         /* labels au-dessus des champs */
  --c-border: #d7d7dc;        /* bordures inputs/selects */
  --c-text: #2c2630;          /* texte principal */
  --c-title: #5e4b5c;         /* titre principal de la page */

  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--c-text);
  max-width: 1100px;
  margin: 0 auto;
}

/* ---- Titre principal ---------------------------------------------------- */

.tarifs-widget__title {
  font-size: 1.85rem;
  font-weight: 600;
  color: var(--c-title);
  margin: 0 0 24px;
}

/* ---- Formulaire de filtres ------------------------------------------------ */

.tarifs-filters {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 28px;
}

.tarifs-filters__row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.tarifs-field {
  position: relative;
  flex: 1 1 0;
  min-width: 180px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: 6px 12px 7px;
  background: #fff;
  transition: border-color 0.15s ease;
}

.tarifs-field__label {
  display: block;
  font-size: 0.72rem;
  color: var(--c-label);
  line-height: 1.2;
  margin-bottom: 2px;
}

.tarifs-field select,
.tarifs-field input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.95rem;
  color: var(--c-text);
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
}

/* Le thème ajoute un outline rose sur select:focus : on le neutralise. */
.tarifs-field select:focus,
.tarifs-field select:focus-visible,
.tarifs-field input:focus,
.tarifs-field input:focus-visible {
  outline: none;
  box-shadow: none;
}

.tarifs-field--select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath fill='%23555' d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
}

.tarifs-field--select select {
  cursor: pointer;
  padding-right: 22px;
  /* Le thème limite les select à 500px : on laisse le select occuper
     toute la largeur du champ pour que le texte ne soit coupé qu'à
     la fin (avec des points de suspension). */
  max-width: none;
  text-overflow: ellipsis;
}

/* Ligne service / intervention : intervention plus large */
.tarifs-filters__row--top .tarifs-field:first-child {
  flex: 0 1 320px;
}
.tarifs-filters__row--top .tarifs-field:last-child {
  flex: 1 1 480px;
}

/* Ligne recherche patient */
.tarifs-filters__row--search {
  align-items: stretch;
}

.tarifs-filters__row--search .tarifs-field {
  flex: 1 1 0;
}

.tarifs-btn-search {
  flex: 0 0 auto;
  align-self: center;
  background: var(--c-plum);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 14px 22px;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease;
}

.tarifs-btn-search:hover {
  background: var(--c-plum-dark);
}

/* Champ masqué tant que sa dépendance n'est pas remplie */
.tarifs-field--hidden {
  display: none;
}

/* Toggle Fedasil */
.tarifs-fedasil {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--c-text);
}

.tarifs-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  flex-shrink: 0;
}

.tarifs-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.tarifs-switch__track {
  position: absolute;
  inset: 0;
  background: #c9c9cf;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.tarifs-switch__track::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.tarifs-switch input:checked + .tarifs-switch__track {
  background: var(--c-plum);
}

.tarifs-switch input:checked + .tarifs-switch__track::before {
  transform: translateX(18px);
}

/* ---- Bloc résultat --------------------------------------------------------- */

.tarifs-result__title {
  color: var(--c-pink);
  font-size: 1.3rem;
  font-weight: 600;
  margin: 32px 0 12px;
}

.tarifs-result__meta {
  margin: 0 0 18px;
  line-height: 1.7;
}

.tarifs-result__meta-line {
  display: block;
}

.tarifs-result__meta-label {
  color: var(--c-pink);
}

/* ---- Tableau --------------------------------------------------------------- */

.tarifs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.tarifs-table thead th {
  background: var(--c-plum);
  color: #fff;
  text-align: left;
  font-weight: 500;
  padding: 12px 18px;
}

.tarifs-table thead th.tarifs-table__col-prix {
  text-align: right;
}

.tarifs-table tbody td {
  padding: 12px 18px;
}

.tarifs-table tbody tr:nth-child(even) {
  background: var(--c-row-alt);
}

.tarifs-table td.tarifs-table__col-prix {
  text-align: right;
  white-space: nowrap;
}

.tarifs-table tfoot td {
  background: none;
  font-weight: 700;
  padding: 14px 18px;
}

/* Total : uniquement à droite, sans fond, en mauve (comme l'entête
   Prix) avec une fine bordure de la même couleur. */
.tarifs-table tfoot td.tarifs-table__col-prix {
  text-align: right;
  white-space: nowrap;
  padding: 0;
}

.tarifs-table__total {
  display: block;
  margin-top: 12px;
  padding: 10px 18px;
  text-align: right;
  color: var(--c-plum);
  border: 1px solid var(--c-plum);
}

/* ---- Actions ---------------------------------------------------------------- */

.tarifs-result__actions {
  text-align: center;
  margin: 28px 0 32px;
}

.tarifs-btn-download {
  background: var(--c-plum);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 26px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.tarifs-btn-download:hover {
  background: var(--c-plum-dark);
}
.tarifs-result__fedasil {
  font-weight: 700;
}

.tarifs-result__fedasil.is-authorized {
  color: #2e7d32;
}

.tarifs-result__fedasil.is-agreement {
  color: #e65100;
}

.tarifs-result__fedasil.is-denied {
  color: #d32f2f;
}
/* ---- Responsive -------------------------------------------------------------- */

@media (max-width: 720px) {
  .tarifs-filters__row {
    flex-direction: column;
  }
  .tarifs-filters__row--top .tarifs-field,
  .tarifs-filters__row--top .tarifs-field:first-child,
  .tarifs-filters__row--top .tarifs-field:last-child {
    flex: 1 1 auto;
  }
  .tarifs-btn-search {
    width: 100%;
  }
}

.tarifs-pdf-share,
.tarifs-pdf-error {
  margin: 12px 0 0;
  font-size: 0.875rem;
  word-break: break-all;
}

.tarifs-pdf-share[hidden],
.tarifs-pdf-error[hidden] {
  display: none;
}

.tarifs-pdf-error {
  color: #d32f2f;
}

/* Loader affiché pendant le chargement du filtre suivant / du récapitulatif */
.tarifs-loader {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -14px 0 20px;
  font-size: 0.875rem;
  color: var(--c-label);
}

.tarifs-loader[hidden] {
  display: none;
}

.tarifs-loader__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--c-border);
  border-top-color: var(--c-pink);
  border-radius: 50%;
  animation: tarifs-spin 0.7s linear infinite;
}

@keyframes tarifs-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tarifs-loader__spinner {
    animation-duration: 2s;
  }
}


/* ---- Espace entre le contenu de la page et le widget (cette page uniquement) --
   Le widget est dans .region-content-below, juste après .region-content.
   On divise par deux le padding-bottom du thème (3rem mobile / 5rem desktop)
   uniquement quand cette région contient le widget. */
.region-content:has(+ .region-content-below .tarifs-widget) {
  padding-bottom: 1.5rem;
}

@media screen and (min-width: 992px) {
  .region-content:has(+ .region-content-below .tarifs-widget) {
    padding-bottom: 2.5rem;
  }
}

/* Le thème met une marge basse de 1em sur les titres : on la supprime sur le
   dernier titre du contenu quand il est directement suivi du widget. */
.region-content:has(+ .region-content-below .tarifs-widget) .field--name-field-corps > .field__item:last-child h2 {
  margin-bottom: 0;
}

/* Mobile : petit espace de part et d'autre du widget. */
@media screen and (max-width: 991px) {
  .tarifs-widget {
    padding-left: 16px;
    padding-right: 16px;
  }
}
