/* =====================================================================
 * DISTRO5 UI — Componenti di base
 * ---------------------------------------------------------------------
 * Caricato per ultimo (gruppo "theme", weight 200) dopo color-*.css e
 * custom.css: vince a parità di specificità, senza !important.
 * Gli !important presenti servono SOLO a superare regole già marcate
 * !important in custom.css (batch, caption, loader).
 *
 * Indice
 *  1. Sfondo e testo globali
 *  2. Messaggi di sistema (status / warning / error / info)
 *  3. Messaggi di elaborazione: loader AJAX, overlay, barra batch
 *  4. Pulsanti
 *  5. Campi form
 *  6. Tabelle (Views, DataTables, bootstrap-table)
 *  7. Card e pannelli
 *  8. Pager e tab
 *  9. Dialog / modali
 * 10. Badge e utilità
 * ===================================================================== */


/* 1. SFONDO E TESTO GLOBALI ============================================ */

body {
  background-color: var(--d5-bg);
  background-image: var(--d5-bg-gradient);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
  color: var(--d5-text-body);
  -webkit-font-smoothing: antialiased;
}

body a {
  color: var(--d5-link);
  transition: color var(--d5-transition);
}
body a:hover,
body a:focus {
  color: var(--d5-link-hover);
}

::selection {
  background: var(--d5-primary);
  color: var(--d5-on-primary);
}

/* Scrollbar discreta (Chrome/Safari/Edge + Firefox) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--d5-border-strong) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--d5-border-strong);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}


/* 2. MESSAGGI DI SISTEMA ============================================== */

/* Contenitore: i messaggi multipli si impilano con spazio regolare */
[data-drupal-messages] {
  display: flex;
  flex-direction: column;
  gap: var(--d5-space-2);
  margin: var(--d5-space-4) 0;
}

body .messages {
  --d5-msg-color: var(--d5-info);
  --d5-msg-soft:  var(--d5-info-soft);
  position: relative;
  margin: 0;
  padding: var(--d5-space-3) var(--d5-space-4) var(--d5-space-3) 52px;
  background: var(--d5-surface);
  background-image: linear-gradient(var(--d5-msg-soft), var(--d5-msg-soft));
  border: 1px solid var(--d5-border);
  border-left: 4px solid var(--d5-msg-color);
  border-radius: var(--d5-radius);
  box-shadow: var(--d5-shadow);
  color: var(--d5-text);
  font-size: var(--d5-fs);
  line-height: 1.5;
  letter-spacing: normal;
  text-transform: none;
}
.headings-wide-spacing-enabled .messages {
  letter-spacing: normal;
  text-transform: none;
}

/* Icona tonda a sinistra (Font Awesome 5, già caricato dal tema) */
body .messages::before {
  content: "\f05a";
  position: absolute;
  left: 14px;
  top: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--d5-msg-color);
  color: var(--d5-surface);
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  font-size: 12px;
  line-height: 24px;
  text-align: center;
}
body .messages::after {
  content: none;
}

body .messages a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
body .messages .messages__list {
  margin: 0;
  padding-left: 1.1em;
}
body .messages .messages__item + .messages__item {
  margin-top: var(--d5-space-1);
}
body .messages code,
body .messages em.placeholder {
  font-style: normal;
  font-weight: 600;
}

body .messages--status  { --d5-msg-color: var(--d5-success); --d5-msg-soft: var(--d5-success-soft); }
body .messages--warning { --d5-msg-color: var(--d5-warning); --d5-msg-soft: var(--d5-warning-soft); }
body .messages--error   { --d5-msg-color: var(--d5-danger);  --d5-msg-soft: var(--d5-danger-soft); }
body .messages--info    { --d5-msg-color: var(--d5-info);    --d5-msg-soft: var(--d5-info-soft); }

body .messages--status::before  { content: "\f00c"; }
body .messages--warning::before { content: "\f12a"; }
body .messages--error::before   { content: "\f00d"; }

/* Alert Bootstrap usati da alcuni moduli: stesso aspetto dei messaggi */
body .alert {
  border-radius: var(--d5-radius);
  border: 1px solid var(--d5-border);
  border-left-width: 4px;
  background: var(--d5-surface);
  color: var(--d5-text);
}
body .alert-success { border-left-color: var(--d5-success); background-image: linear-gradient(var(--d5-success-soft), var(--d5-success-soft)); }
body .alert-warning { border-left-color: var(--d5-warning); background-image: linear-gradient(var(--d5-warning-soft), var(--d5-warning-soft)); }
body .alert-danger  { border-left-color: var(--d5-danger);  background-image: linear-gradient(var(--d5-danger-soft),  var(--d5-danger-soft)); }
body .alert-info    { border-left-color: var(--d5-info);    background-image: linear-gradient(var(--d5-info-soft),    var(--d5-info-soft)); }


/* 3. MESSAGGI DI ELABORAZIONE ========================================= */

/* 3a. Loader AJAX in linea (pulsanti, filtri Views, autocomplete) */
.ajax-progress-throbber,
.ajax-progress.ajax-progress-throbber {
  display: inline-flex;
  align-items: center;
  gap: var(--d5-space-2);
  margin: 0 var(--d5-space-2);
  padding: 4px 10px 4px 6px;
  background: var(--d5-surface-3);
  border: 1px solid var(--d5-border);
  border-radius: 999px;
  color: var(--d5-text-muted);
  font-size: var(--d5-fs-xs);
  vertical-align: middle;
}
.ajax-progress-throbber .throbber {
  display: inline-block;
  width: 14px;
  height: 14px;
  padding: 0;
  margin: 0;
  background: none;
  border: 2px solid var(--d5-border-strong);
  border-top-color: var(--d5-primary);
  border-radius: 50%;
  animation: d5-spin .8s linear infinite;
}
.ajax-progress-throbber .message {
  padding: 0;
  display: inline;
}

/* 3b. Overlay a schermo intero ---------------------------------------
 * - .ajax-progress-fullscreen: modulo ajax_loader ("sempre a schermo intero"),
 *   contiene la sua animazione a onde (.ajax-throbber.sk-wave);
 * - .d5-page-loader: stesso overlay mostrato da d5-ui.js quando un clic o
 *   l'invio di un form carica una nuova pagina.
 * Sfondo oscurato, animazione bianca al centro dello schermo.            */
body .ajax-progress.ajax-progress-fullscreen,
body .ajax-progress-fullscreen,
.d5-page-loader {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  opacity: 1;
  background-color: rgba(0, 32, 46, .45);
  background-image: none;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  border-radius: 0;
  cursor: progress;
}
body .ajax-progress-fullscreen .ajax-throbber,
.d5-page-loader .ajax-throbber {
  --sk-color: #ffffff !important;
  --sk-size: 48px;
  width: 48px;
  height: 48px;
}
/* Ripiego se il markup dell'animazione non è disponibile */
body .ajax-progress-fullscreen:not(:has(.ajax-throbber))::after,
.d5-page-loader:not(:has(.ajax-throbber))::after {
  content: "";
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, .25);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: d5-spin .9s linear infinite;
}

/* Loader del modulo ajax_loader fuori dall'overlay: colore del brand */
.ajax-throbber.sk-wave,
.ajax-throbber {
  --sk-color: var(--d5-primary);
}

/* 3c. Barra di avanzamento Drupal (batch, import, upload) */
[data-drupal-progress] {
  max-width: 720px;
  margin: var(--d5-space-4) 0;
  font-size: var(--d5-fs);
}
[data-drupal-progress] .progress__label {
  margin-bottom: var(--d5-space-2);
  color: var(--d5-text);
  font-weight: 600;
}
body [data-drupal-progress] .progress__track {
  height: 10px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--d5-surface-3) !important;
  border: 1px solid var(--d5-border);
  border-radius: 999px !important;
}
body [data-drupal-progress] .progress__bar {
  height: 100%;
  min-width: 10px;
  background-color: var(--d5-primary);
  background-image:
    linear-gradient(45deg, rgba(255,255,255,.18) 25%, transparent 25%, transparent 50%,
                    rgba(255,255,255,.18) 50%, rgba(255,255,255,.18) 75%, transparent 75%),
    var(--d5-primary-gradient);
  background-size: 20px 20px, 100% 100%;
  border-radius: 999px !important;
  transition: width .4s ease;
  animation: d5-stripes 1s linear infinite;
}
body [data-drupal-progress] .progress__percentage {
  float: right;
  margin-top: var(--d5-space-2);
  color: var(--d5-primary) !important;
  font-family: var(--d5-font-mono);
  font-size: var(--d5-fs-sm);
}
body [data-drupal-progress] .progress__description {
  margin-top: var(--d5-space-2);
  color: var(--d5-text-muted) !important;
  font-size: var(--d5-fs-sm);
}

/* 3d. Pagina batch: finestra centrata (riprende l'impostazione esistente) */
body.path-batch {
  background: var(--d5-bg) !important;
  background-image: var(--d5-bg-gradient) !important;
}
body.path-batch .page-container {
  background: var(--d5-surface) !important;
  border: 1px solid var(--d5-border);
  border-radius: var(--d5-radius-lg) !important;
  box-shadow: var(--d5-shadow-lg);
  color: var(--d5-text);
}
body.path-batch h1.page-title {
  color: var(--d5-text) !important;
}

@keyframes d5-spin    { to { transform: rotate(360deg); } }
@keyframes d5-stripes { to { background-position: 20px 0, 0 0; } }

@media (prefers-reduced-motion: reduce) {
  .ajax-progress-throbber .throbber,
  .ajax-progress-fullscreen::after,
  body [data-drupal-progress] .progress__bar { animation: none; }
}


/* 4. PULSANTI ========================================================= */

body .button,
body input[type="submit"],
body input[type="button"],
body input[type="reset"],
body button.button,
body a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--d5-space-2);
  min-height: 36px;
  margin: 0 var(--d5-space-2) var(--d5-space-2) 0;
  padding: 0 var(--d5-space-4);
  background: var(--d5-primary-soft);
  border: 1px solid #b9d5ea;   /* bordo: visibile anche sullo sfondo pagina */
  border-radius: var(--d5-radius-sm);
  box-shadow: none;
  color: var(--d5-primary-soft-text);
  font-family: inherit;
  font-size: var(--d5-fs);
  font-weight: 600;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--d5-transition), border-color var(--d5-transition),
              color var(--d5-transition), box-shadow var(--d5-transition);
}
body .button:hover,
body input[type="submit"]:hover,
body input[type="button"]:hover,
body input[type="reset"]:hover,
body a.button:hover {
  background: #cfeafb;
  border-color: transparent;
  color: var(--d5-primary-dark);
}

/* Contorno: bianco bordato (es. "Search & Generate", "Reset") */
body .button--outline,
body a.button--outline,
body input#edit-reset,
body .button.button--outline {
  background: var(--d5-surface);
  border-color: var(--d5-border-strong);
  color: var(--d5-text);
}
body .button--outline:hover,
body a.button--outline:hover,
body input#edit-reset:hover {
  background: var(--d5-surface);
  border-color: var(--d5-primary);
  color: var(--d5-primary-dark);
}
body .button:focus-visible,
body input[type="submit"]:focus-visible,
body input[type="button"]:focus-visible,
body a.button:focus-visible {
  outline: none;
  box-shadow: var(--d5-focus-ring);
}

/* Primario: azione principale del form (Salva, Cerca, Applica) */
body .button--primary,
body .button.button--primary,
body a.button--primary,
body input.button--primary,
body .form-actions input[type="submit"]#edit-submit,
body .views-exposed-form input[type="submit"][id^="edit-submit"],
body .btn-primary {
  background: var(--d5-primary-gradient);
  border-color: var(--d5-primary-dark);
  color: var(--d5-on-primary);
}
body .button--primary:hover,
body .button.button--primary:hover,
body a.button--primary:hover,
body input.button--primary:hover,
body .form-actions input[type="submit"]#edit-submit:hover,
body .views-exposed-form input[type="submit"][id^="edit-submit"]:hover,
body .btn-primary:hover {
  background: var(--d5-primary-light);
  border-color: var(--d5-primary);
  color: var(--d5-on-primary);
}

/* Pericolo: Elimina */
body .button--danger,
body a.button--danger,
body input[type="submit"][id*="delete"],
body .btn-danger {
  background: transparent;
  border-color: var(--d5-danger);
  color: var(--d5-danger);
}
body .button--danger:hover,
body a.button--danger:hover,
body input[type="submit"][id*="delete"]:hover,
body .btn-danger:hover {
  background: var(--d5-danger);
  border-color: var(--d5-danger);
  color: #fff;
}

/* Azioni VBO (form .vbo-view-form): sono azioni principali -> blu pieno.
 * Restano escluse "Pulisci la selezione" (secondario) e le eliminazioni (rosso). */
body form.vbo-view-form .form-actions input.js-form-submit.form-submit:not([value*="Delete"]):not([value*="Elimina"]):not([value*="Pulisci"]):not([value*="Clear"]):not([value*="Remove"]):not([value*="Rimuovi"]) {
  background: var(--d5-primary-gradient);
  border: 1px solid var(--d5-primary-dark);
  color: var(--d5-on-primary);
}
body form.vbo-view-form .form-actions input.js-form-submit.form-submit:not([value*="Delete"]):not([value*="Elimina"]):not([value*="Pulisci"]):not([value*="Clear"]):not([value*="Remove"]):not([value*="Rimuovi"]):hover {
  background: var(--d5-primary-light);
  border-color: var(--d5-primary);
  color: var(--d5-on-primary);
}

body .button--small {
  min-height: 28px;
  padding: 0 var(--d5-space-3);
  font-size: var(--d5-fs-sm);
}

body .button:disabled,
body .button.is-disabled,
body input[type="submit"]:disabled {
  opacity: .38;
  cursor: not-allowed;
  filter: saturate(.4);
}


/* 5. CAMPI FORM ======================================================= */

body .form-item label,
body .fieldset-legend,
body legend {
  color: var(--d5-text);
  font-size: var(--d5-fs-sm);
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
}

body input.form-text,
body input.form-email,
body input.form-number,
body input.form-tel,
body input.form-url,
body input.form-search,
body input.form-date,
body input.form-time,
body input.form-autocomplete,
body input[type="password"],
body select.form-select,
body textarea.form-textarea {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  background-color: var(--d5-field-bg);
  border: 1px solid var(--d5-field-border);
  border-radius: var(--d5-radius-sm);
  box-shadow: none;
  color: var(--d5-field-text);
  font-family: inherit;
  font-size: var(--d5-fs);
  transition: border-color var(--d5-transition), box-shadow var(--d5-transition);
}
body textarea.form-textarea {
  min-height: 96px;
  line-height: 1.5;
}
body input.form-text:focus,
body input.form-email:focus,
body input.form-number:focus,
body input.form-search:focus,
body input.form-date:focus,
body input.form-autocomplete:focus,
body input[type="password"]:focus,
body select.form-select:focus,
body textarea.form-textarea:focus {
  outline: none;
  border-color: var(--d5-primary);
  box-shadow: var(--d5-focus-ring);
}
body input::placeholder,
body textarea::placeholder {
  color: var(--d5-field-placeholder);
  opacity: 1;
}

/* Campi in errore (Drupal aggiunge .error) */
body input.error,
body select.error,
body textarea.error {
  border-color: var(--d5-danger);
  box-shadow: 0 0 0 3px var(--d5-danger-soft);
}
body .form-item--error-message {
  margin-top: var(--d5-space-1);
  color: var(--d5-danger);
  font-size: var(--d5-fs-sm);
}

/* Testi di aiuto */
body .description,
body .form-item .description {
  margin-top: var(--d5-space-1);
  color: var(--d5-text-muted);
  font-size: var(--d5-fs-xs);
}

/* Checkbox e radio con colore brand */
body input[type="checkbox"],
body input[type="radio"] {
  accent-color: var(--d5-primary);
}

/* Fieldset / details */
body fieldset,
body details {
  margin: 0 0 var(--d5-space-4);
  padding: var(--d5-space-4);
  background: var(--d5-surface);
  border: 1px solid var(--d5-border);
  border-radius: var(--d5-radius);
}
body details > summary {
  margin: calc(var(--d5-space-4) * -1) calc(var(--d5-space-4) * -1) 0;
  padding: var(--d5-space-3) var(--d5-space-4);
  color: var(--d5-text);
  font-weight: 600;
  cursor: pointer;
}
body details[open] > summary {
  margin-bottom: var(--d5-space-4);
  border-bottom: 1px solid var(--d5-border);
}

/* Filtri esposti delle Views: barra compatta */
body .views-exposed-form {
  padding: var(--d5-space-4);
  margin-bottom: var(--d5-space-4);
  background: var(--d5-surface);
  border: 1px solid var(--d5-border);
  border-radius: var(--d5-radius);
}


/* 6. TABELLE ========================================================== */

body table {
  width: 100%;
  margin: var(--d5-space-4) 0 var(--d5-space-5);
  border-collapse: separate;
  border-spacing: 0;
  background: var(--d5-surface);
  border: 1px solid var(--d5-table-border, #c3d7e8);
  border-radius: var(--d5-radius);
  /* niente overflow:hidden: taglierebbe i dropbutton nella colonna Operazioni */
  font-size: var(--d5-fs-sm);
}
body table thead tr:first-child th:first-child { border-top-left-radius: var(--d5-radius); }
body table thead tr:first-child th:last-child  { border-top-right-radius: var(--d5-radius); }
body table caption,
body table#datatable caption,
body table.dataTable caption,
body table.views-view-table caption {
  caption-side: top;
  padding: 0 0 var(--d5-space-2);
  color: var(--d5-text-muted) !important;
  font-weight: 600;
  text-align: left;
}

body table tr th,
body table thead th {
  padding: 6px 10px;
  background: var(--d5-th-bg);
  border: 0;
  border-bottom: 2px solid var(--d5-th-border);
  border-left: 1px solid var(--d5-th-sep, #bdd6ea);
  color: var(--d5-th-text);
  font-size: var(--d5-fs-sm);
  font-weight: var(--d5-th-weight);
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  text-align: left;
  vertical-align: middle;
}
body table tr th a,
body table thead th a {
  color: inherit;
  text-decoration: none;
}
body table tr th.is-active,
body table tr th.is-active a {
  color: var(--d5-primary);
}

body table tr th:first-child,
body table thead th:first-child {
  border-left: 0;
}

body table tr td {
  padding: 4px 10px;
  background-color: transparent;
  border: 0;
  border-bottom: 1px solid var(--d5-td-border, #d5e2ee);
  color: var(--d5-text-body);
  font-size: var(--d5-fs);
  font-weight: 400;
  vertical-align: middle;
}
body table tbody tr:last-child td {
  border-bottom: 0;
}
body table tbody tr {
  transition: background var(--d5-transition);
}
body table tbody tr:hover td {
  background-color: var(--d5-surface-2);
}
/* Riga selezionata (VBO, tableselect) */
body table tbody tr.selected td,
body table tbody tr.is-selected td {
  background-color: var(--d5-primary-soft);
}
body table td.is-active {
  background-color: transparent;
}

/* Paragrafi dentro le celle: elements.css dà a ogni <p> 15px di spazio sotto,
 * che spostava in alto icone e pulsanti rispetto al testo delle altre colonne. */
body table td > p:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
}
/* Celle con pulsanti/icone in un <p> o <div> (es. risultati Spotify Search):
 * in riga flessibile, centrati in verticale. */
body table td > p:has(> a.btn),
body table td > p:has(> .btn),
body table td > div:has(> a.btn) {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  line-height: 1;
}
body table td > p:has(> a.btn) > a.btn,
body table td > div:has(> a.btn) > a.btn {
  margin: 0;
  vertical-align: middle;
}

/* Codici (ISRC, UPC, ISWC): carattere a spaziatura fissa per leggerli bene */
body td.views-field-field-isrc,
body td.views-field-field-upc,
body td.views-field-field-iswc,
body td[class*="views-field-field-isrc"],
body td[class*="views-field-field-upc"] {
  font-family: var(--d5-font-mono);
  font-size: var(--d5-fs-xs);
  letter-spacing: .02em;
}

/* Libreria DataTables (jquery.dataTables.css): righe alterne e colonna
 * ordinata erano lavanda (#e2e4ff / #eaebff). Il file è della libreria,
 * quindi lo si adegua da qui.                                          */
body table.dataTable tbody tr.odd,
body table.dataTable tbody tr.even {
  background-color: var(--d5-surface);
}
body table.dataTable tbody tr.odd td,
body table.dataTable.stripe tbody tr.odd,
body table.dataTable.display tbody tr.odd {
  background-color: var(--d5-surface-3);
}
body table.dataTable.display tbody tr.odd > .sorting_1,
body table.dataTable.display tbody tr.even > .sorting_1,
body table.dataTable.order-column tbody tr > .sorting_1,
body table.dataTable tbody td.sorting_1 {
  background-color: rgba(1, 144, 217, .05);
}
body table.dataTable.display tbody tr:hover > td,
body table.dataTable.hover tbody tr:hover > td {
  background-color: var(--d5-surface-2);
}

/* DataTables / bootstrap-table: controlli coerenti */
body .dataTables_wrapper .dataTables_filter label,
body .dataTables_wrapper .dataTables_length label,
body .dataTables_wrapper .dataTables_info {
  color: var(--d5-text-muted) !important;
  font-size: var(--d5-fs-sm);
}
body .dataTables_wrapper .dataTables_filter input,
body .dataTables_wrapper .dataTables_length select,
body .bootstrap-table .search input {
  min-height: 32px;
  padding: 4px 10px;
  background: var(--d5-field-bg);
  border: 1px solid var(--d5-field-border);
  border-radius: var(--d5-radius-sm);
  color: var(--d5-field-text) !important;
}
body .bootstrap-table .fixed-table-toolbar .btn,
body .bootstrap-table .fixed-table-toolbar .btn-secondary {
  background: var(--d5-surface-3);
  border-color: var(--d5-border-strong);
  color: var(--d5-text);
}
body .bootstrap-table .fixed-table-toolbar .btn:hover {
  border-color: var(--d5-primary);
  color: var(--d5-primary);
}
body .bootstrap-table .fixed-table-container {
  border-color: var(--d5-border);
  border-radius: var(--d5-radius);
}

/* Contenitore che scorre in orizzontale per tabelle larghe */
body .views-view-table-wrapper,
body .table-responsive {
  overflow-x: auto;
  border-radius: var(--d5-radius);
}


/* 7. CARD E PANNELLI ================================================== */

body .card,
body .view .card {
  background: var(--d5-surface);
  border: 1px solid var(--d5-border);
  border-radius: var(--d5-radius);
  box-shadow: var(--d5-shadow);
  color: var(--d5-text);
  transition: border-color var(--d5-transition), transform var(--d5-transition);
}
body .view .card:hover {
  border-color: var(--d5-primary);
}
body .card-header,
body .card-footer {
  background: var(--d5-surface-2);
  border-color: var(--d5-border);
}

/* Classe di utilità per qualsiasi blocco/pannello */
.d5-panel {
  padding: var(--d5-space-5);
  background: var(--d5-surface);
  border: 1px solid var(--d5-border);
  border-radius: var(--d5-radius);
  box-shadow: var(--d5-shadow);
}


/* 8. PAGER E TAB ====================================================== */

body nav.pager {
  margin: var(--d5-space-5) 0;
  padding: 0;
  background: transparent;
  border: 0;
}
body nav.pager .pager__items {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
body nav.pager li.pager__item {
  display: flex;
  align-items: center;
  float: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  line-height: 1;
  list-style: none;
  vertical-align: middle;
}
body nav.pager li.pager__item::before,
body nav.pager li.pager__item::after { content: none; }
/* Nessuna casella vuota */
body nav.pager li.pager__item:empty,
body nav.pager li.pager__item > a:empty { display: none; }

body nav.pager li.pager__item > a,
body nav.pager li.pager__item--ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 36px;
  height: 36px;
  margin: 0;
  padding: 0 12px;
  background: var(--d5-surface);
  border: 1px solid var(--d5-border);
  border-radius: var(--d5-radius-sm);
  box-shadow: none;
  color: var(--d5-text-muted);
  font-size: var(--d5-fs-sm);
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color var(--d5-transition), color var(--d5-transition), background var(--d5-transition);
}
body nav.pager li.pager__item > a > span[aria-hidden] { display: inline; }
body nav.pager li.pager__item > a:hover,
body nav.pager li.pager__item > a:focus {
  background: var(--d5-primary-soft);
  border-color: var(--d5-primary);
  color: var(--d5-primary-dark);
}
/* Pagina corrente: azzurro sfumato, testo blu petrolio, ombra leggera INTERNA */
body nav.pager li.pager__item.is-active > a,
body nav.pager li.pager__item--active > a {
  background: linear-gradient(180deg, #e6f5fe 0%, #bfe5fa 100%);
  border-color: #8fcdee;
  box-shadow: inset 0 1px 3px rgba(0, 64, 89, .18);
  color: var(--d5-header-bg);
  font-weight: 700;
  cursor: default;
}

/* Paginazione di bootstrap-table / Bootstrap: stesso aspetto */
body .pagination {
  gap: 6px;
  flex-wrap: wrap;
}
body .pagination .page-item .page-link {
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  background: var(--d5-surface);
  border: 1px solid var(--d5-border);
  border-radius: var(--d5-radius-sm) !important;
  color: var(--d5-text-muted);
  font-size: var(--d5-fs-sm);
  box-shadow: none;
}
body .pagination .page-item .page-link:hover {
  background: var(--d5-primary-soft);
  border-color: var(--d5-primary);
  color: var(--d5-primary-dark);
}
body .pagination .page-item.active .page-link {
  background: linear-gradient(180deg, #e6f5fe 0%, #bfe5fa 100%);
  border-color: #8fcdee;
  box-shadow: inset 0 1px 3px rgba(0, 64, 89, .18);
  color: var(--d5-header-bg);
  font-weight: 700;
}
body .pagination .page-item.disabled .page-link {
  opacity: .5;
}

/* Tab locali (Visualizza / Modifica / Elimina...) */
body ul.tabs.primary,
body .tabs.primary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--d5-space-1);
  margin: 0 0 var(--d5-space-4);
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--d5-border);
}
body .tabs.primary li {
  margin: 0;
  list-style: none;
}
body .tabs.primary li::before,
body .pager__item::before { content: none; }
body .tabs.primary li a {
  display: block;
  padding: var(--d5-space-2) var(--d5-space-4);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--d5-text-muted);
  font-size: var(--d5-fs-sm);
  font-weight: 600;
  text-decoration: none;
}
body .tabs.primary li a:hover {
  color: var(--d5-text);
}
body .tabs.primary li.is-active a,
body .tabs.primary li a.is-active {
  background: transparent;
  border-bottom-color: var(--d5-primary);
  color: var(--d5-primary);
}


/* 9. DIALOG / MODALI ================================================== */

body .ui-dialog {
  padding: 0;
  background: var(--d5-surface);
  border: 1px solid var(--d5-border);
  border-radius: var(--d5-radius-lg);
  box-shadow: var(--d5-shadow-lg);
  color: var(--d5-text);
  overflow: hidden;
}
body .ui-dialog .ui-dialog-titlebar {
  padding: var(--d5-space-4) var(--d5-space-5);
  background: var(--d5-surface-2);
  border: 0;
  border-bottom: 1px solid var(--d5-border);
  border-radius: 0;
  color: var(--d5-text);
}
body .ui-dialog .ui-dialog-title {
  font-size: var(--d5-fs-lg);
  font-weight: 600;
}
body .ui-dialog .ui-dialog-content {
  padding: var(--d5-space-5);
  color: var(--d5-text);
}
body .ui-dialog .ui-dialog-buttonpane {
  margin: 0;
  padding: var(--d5-space-3) var(--d5-space-5);
  background: var(--d5-surface-2);
  border-top: 1px solid var(--d5-border);
}
body .ui-widget-overlay {
  background: var(--d5-overlay);
  opacity: 1;
}


/* 9b. HEADER E MENU (base: da rifinire sul markup reale) =============== */

/* Barra in alto (logo, lingua, utente): sfumatura del mockup.
 * color-green.css la colora con .region--dark-background (#1a383c),
 * regola comune a tutte le regioni scure: qui la cambio solo per l'header. */
body .header-container .header-top-highlighted {
  background-color: #003f57;
  background-image: var(--d5-header-top);
  border-bottom: 1px solid var(--d5-header-line);
}
/* Barra del menu (vale per qualunque menu nella regione: Main navigation,
 * Machiavelli, ecc.). I contenitori interni diventano trasparenti, così
 * nessun blocco può coprire la sfumatura con un proprio sfondo. */
body .header-container header.header {
  background-color: #013f58 !important;
  background-image: var(--d5-header-menu) !important;
}
body .header-container header.header .header__container,
body .header-container header.header .header__section,
body .header-container header.header .region,
body .header-container header.header .block,
body .header-container header.header .block > .content,
body .header-container header.header ul.sf-menu,
body .header-container header.header ul.sf-menu > li,
body .header-container header.header ul.sf-menu > li > a,
body .header-container header.header ul.sf-menu > li > span {
  background-color: transparent;
  background-image: none;
}

body .header-container,
body header.header {
  background: var(--d5-header-bg);
  color: var(--d5-header-text);
  box-shadow: none;
}
body .header-container .sf-menu > li > a,
body .header-container .sf-menu > li > span {
  color: var(--d5-header-text);
  font-size: var(--d5-fs-sm);
  font-weight: 600;
  text-transform: uppercase;
}
body .header-container .sf-menu > li > a:hover,
body .header-container .sf-menu > li.sfHover > a,
body .header-container .sf-menu > li.active-trail > a {
  color: var(--d5-accent);
}
body .header-container .sf-menu ul {
  background: var(--d5-surface);
  border: 1px solid var(--d5-border);
  border-radius: var(--d5-radius-sm);
  box-shadow: var(--d5-shadow-lg);
}
body .header-container .sf-menu ul li a,
body .header-container .sf-menu ul li > span {
  color: var(--d5-text);
}
body .header-container .sf-menu ul li a:hover {
  background: var(--d5-primary-soft);
  color: var(--d5-primary-dark);
}


/* 10. BADGE E UTILITÀ ================================================= */

/* Uso: <span class="d5-badge d5-badge--success">Importata</span> */
.d5-badge {
  --d5-badge-color: var(--d5-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  background: color-mix(in srgb, var(--d5-badge-color) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--d5-badge-color) 35%, transparent);
  border-radius: 999px;
  color: var(--d5-badge-color);
  font-size: var(--d5-fs-xs);
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.d5-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.d5-badge--success { --d5-badge-color: var(--d5-success); }
.d5-badge--warning { --d5-badge-color: var(--d5-warning); }
.d5-badge--danger  { --d5-badge-color: var(--d5-danger); }
.d5-badge--info    { --d5-badge-color: var(--d5-info); }
.d5-badge--gold    { --d5-badge-color: #b58700; }
.d5-badge--primary { --d5-badge-color: var(--d5-primary); }

.d5-muted { color: var(--d5-text-muted); }
.d5-mono  { font-family: var(--d5-font-mono); }
