/*
 * marchiotto-glass-compositor-fix.css
 * ===================================
 * Caricato ULTIMO in <head> (dopo tutti i *-glass.css).
 * Elimina backdrop-filter su client/staff: evita flicker cross-layer quando
 * si passa sopra header/nav fixed o elementi glass adiacenti (Chrome/Edge).
 * Aspetto: gradienti e sfondi già definiti nei fogli glass; compensazione
 * opaca solo dove il blur campionava il contenuto sotto.
 */

/* -------------------------------------------------------------------------- */
/* Layer split — chrome fisso vs contenuto scrollabile                         */
/* -------------------------------------------------------------------------- */

body.client-side > #container > #header,
body.client-side #nav-wrapper,
body.staff-side > #container > #header,
body.staff-side #sub_nav-wrap {
  isolation: isolate;
  transform: translateZ(0);
  backface-visibility: hidden;
}

body.client-side #content,
body.staff-side #content,
body.staff-side #pjax-container {
  isolation: isolate;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* -------------------------------------------------------------------------- */
/* Zero blur (anche regole che usano var(--glass-blur*))                       */
/* -------------------------------------------------------------------------- */

body.client-side,
body.staff-side {
  --glass-blur: 0px;
  --glass-blur-sm: 0px;
  --glass-blur-md: 0px;
  --glass-blur-lg: 0px;
  --glass-blur-xl: 0px;
  --glass-blur-2xl: 0px;
  --portal-chrome-blur: 0px;
}

body.client-side,
body.staff-side,
body.client-side *,
body.staff-side * {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

body.client-side ::backdrop,
body.staff-side ::backdrop {
  background: rgba(8, 16, 32, 0.72) !important;
}

/* -------------------------------------------------------------------------- */
/* Compensazione visiva — stesso look “vetro” senza campionamento live         */
/* -------------------------------------------------------------------------- */

/* Staff sub-nav sticky (prima blur + rgba 0.55) */
body.staff-side #sub_nav-wrap {
  background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.1) 0%,
      rgba(255, 255, 255, 0.04) 48%,
      rgba(4, 12, 28, 0.72) 100%
    ),
    rgba(10, 22, 38, 0.94) !important;
}

body.staff-side #sub_nav-wrap.sub_nav-wrap--minimal {
  background: rgba(10, 22, 38, 0.92) !important;
}

/* FullCalendar — toolbar e griglia (client + staff) */
body.client-side .fc .fc-toolbar.fc-header-toolbar,
body.staff-side .fc .fc-toolbar.fc-header-toolbar {
  background: linear-gradient(
    165deg,
    rgba(38, 56, 84, 0.88) 0%,
    rgba(14, 30, 52, 0.92) 100%
  ) !important;
}

body.client-side .fc .fc-scrollgrid,
body.staff-side .fc .fc-scrollgrid {
  background: linear-gradient(
    168deg,
    rgba(36, 56, 88, 0.82) 0%,
    rgba(14, 28, 48, 0.9) 45%,
    rgba(8, 16, 32, 0.94) 100%
  ) !important;
}

body.client-side .fc .fc-list-table,
body.staff-side .fc .fc-list-table {
  background: linear-gradient(
    168deg,
    rgba(32, 50, 78, 0.88) 0%,
    rgba(14, 28, 48, 0.92) 100%
  ) !important;
}

body.client-side .fc .fc-popover,
body.staff-side .fc .fc-popover {
  background: rgba(18, 34, 54, 0.96) !important;
}

/* Pannelli vetro fiscali / portale */
body.client-side .fiscal-glass-panel,
body.staff-side .fiscal-glass-panel {
  background: linear-gradient(
    168deg,
    rgba(34, 52, 80, 0.94) 0%,
    rgba(22, 40, 64, 0.96) 52%,
    rgba(18, 34, 54, 0.97) 100%
  ) !important;
}

body.client-side .fiscal-glass-panel.fiscal-cal-mount-wrap,
body.staff-side .fiscal-glass-panel.fiscal-cal-mount-wrap {
  background: linear-gradient(
    165deg,
    rgba(34, 52, 80, 0.9) 0%,
    rgba(20, 38, 60, 0.94) 42%,
    rgba(14, 28, 48, 0.96) 100%
  ) !important;
}

body.client-side .fiscal-cal-mount-box,
body.staff-side .fiscal-cal-mount-box {
  background: linear-gradient(
    168deg,
    rgba(38, 56, 84, 0.82) 0%,
    rgba(20, 38, 62, 0.9) 48%,
    rgba(10, 20, 36, 0.94) 100%
  ) !important;
}

body.client-side .glass-panel,
body.client-side.index-page #information,
body.client-side.index-page .featured-category,
body.client-side.index-page .index-glass-root #open-or-check .client-choice,
body.client-side.login-page #clientLogin .client-choice,
body.client-side.open-page #ticketForm {
  background: linear-gradient(
    168deg,
    rgba(34, 52, 80, 0.92) 0%,
    rgba(22, 40, 64, 0.94) 52%,
    rgba(18, 34, 54, 0.96) 100%
  ) !important;
}

/* Overlay / modali / menu portaled */
body.client-side .mp-notices-overlay {
  background: rgba(8, 16, 32, 0.68) !important;
}

body.client-side .mp-notices-overlay .mp-notices-modal,
body.staff-side .dialog#popup,
body.staff-side .ui-dialog {
  background: linear-gradient(
    168deg,
    rgba(32, 50, 78, 0.96) 0%,
    rgba(18, 34, 54, 0.98) 100%
  ) !important;
}

body.client-side .mp-ra-menu {
  background: linear-gradient(
    168deg,
    rgba(32, 50, 78, 0.96) 0%,
    rgba(18, 34, 54, 0.98) 100%
  ) !important;
}

body.client-side .select2-dropdown,
body.staff-side .select2-dropdown {
  background: linear-gradient(
    168deg,
    rgba(32, 50, 78, 0.96) 0%,
    rgba(18, 34, 54, 0.98) 100%
  ) !important;
}

body.staff-side #overlay {
  background: rgba(8, 16, 32, 0.72) !important;
}

body.staff-side #mp-sidr-overlay {
  background: rgba(8, 16, 32, 0.55) !important;
}

body.staff-side .sidr {
  background: linear-gradient(
    168deg,
    rgba(28, 45, 72, 0.97) 0%,
    rgba(14, 28, 48, 0.99) 100%
  ) !important;
}

/* Ticket news — evita doppio vetro trasparente colonna + card */
body.client-side.tickets-page .portal-tickets-news-col--avvisi,
body.client-side.tickets-page .portal-tickets-news-col--novita {
  background: linear-gradient(
    168deg,
    rgba(30, 48, 76, 0.88) 0%,
    rgba(16, 32, 54, 0.92) 100%
  ) !important;
}

body.client-side.tickets-page .portal-tickets-news-col .portal-tickets-news-card {
  background: linear-gradient(
    168deg,
    rgba(36, 54, 82, 0.9) 0%,
    rgba(20, 38, 62, 0.94) 100%
  ) !important;
}

/* Guide clienti — stack elenco (prima blur 18px + rgba 0.42–0.55) */
body.client-side.guides-page .guides-wrap--list .guides-list-stack {
  background: linear-gradient(
    165deg,
    rgba(32, 52, 86, 0.9) 0%,
    rgba(18, 32, 56, 0.88) 100%
  ) !important;
}

body.client-side.guides-page
  .guides-wrap--list
  .guides-list-stack
  .guides-toolbar-client.guides-toolbar-client--stack,
body.client-side.guides-page
  .guides-wrap--list
  .guides-list-stack
  #guides-toolbar.guides-toolbar-client--stack {
  /* ponytail: sfondo toolbar in client-guides-glass.css (ultimo in cascade) */
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* Staff guide elenco — stesso principio */
body.staff-side.guides-page .guides-wrap--list .guides-list-stack {
  background: linear-gradient(
    165deg,
    rgba(32, 52, 86, 0.9) 0%,
    rgba(18, 32, 56, 0.88) 100%
  ) !important;
}

/* -------------------------------------------------------------------------- */
/* will-change / mix-blend — sorgenti flicker cross-layer                        */
/* -------------------------------------------------------------------------- */

body.staff-side #sub_nav-wrap,
body.staff-side.tickets-page .sticky.bar.fixed,
body.staff-side #header .mp-staff-alerts-popover,
body.client-side .mp-notices-overlay .mp-notices-modal {
  will-change: auto !important;
}

body.client-side.index-page .glass-actions #open-new div#sign-in-button::before,
body.client-side.index-page .glass-actions #check-status div#sign-in-button::before,
body.client-side.index-page .glass-actions #open-mail-help div#sign-in-button::before,
body.client-side.index-page .glass-actions #open-new div#sign-in-button::after,
body.client-side.index-page .glass-actions #check-status div#sign-in-button::after,
body.client-side.index-page .glass-actions #open-mail-help div#sign-in-button::after {
  mix-blend-mode: normal !important;
}

/* -------------------------------------------------------------------------- */
/* Compensazione aggiuntiva — pagine ad alto traffico                            */
/* -------------------------------------------------------------------------- */

body.client-side.pwreset-page .mp-pwreset-card {
  background: linear-gradient(
    168deg,
    rgba(34, 52, 80, 0.94) 0%,
    rgba(18, 34, 54, 0.97) 100%
  ) !important;
}

body.client-side.tickets-page .portal-tickets-search.well,
body.client-side.tickets-page .portal-tickets-pill,
body.client-side.tickets-page .portal-tickets-page-menubar {
  background: linear-gradient(
    168deg,
    rgba(32, 50, 78, 0.9) 0%,
    rgba(18, 34, 54, 0.94) 100%
  ) !important;
}

body.client-side.view-page #reply,
body.client-side.tickets-page #reply {
  background: linear-gradient(
    168deg,
    rgba(32, 50, 78, 0.9) 0%,
    rgba(18, 34, 54, 0.94) 100%
  ) !important;
}

body.client-side .fiscal-cat-chip,
body.client-side .fc .fc-daygrid-event.mp-fc-glass-chip,
body.staff-side .fc .fc-daygrid-event.mp-fc-glass-chip {
  /* Chip: gradienti inline da JS — niente blur, alpha già sufficiente */
  background-color: transparent !important;
}

body.staff-side .mp-an-kpi-card,
body.staff-side .mp-an-widget,
body.staff-side .mp-kimi-analytics-root .mp-kimi-modal__panel {
  background: linear-gradient(
    168deg,
    rgba(32, 50, 78, 0.92) 0%,
    rgba(18, 34, 54, 0.96) 100%
  ) !important;
}

body.staff-side #ui-datepicker-div,
body.staff-side ul.typeahead.dropdown-menu,
body.staff-side .tip_content {
  background: linear-gradient(
    168deg,
    rgba(32, 50, 78, 0.96) 0%,
    rgba(18, 34, 54, 0.98) 100%
  ) !important;
}

/* -------------------------------------------------------------------------- */
/* Directory utenti/org — compositing Edge macOS / WebKit (scroll + hover)     */
/* -------------------------------------------------------------------------- */

/* translateZ(0) su #pjax-container + isolation per-riga tabella = artefatti repaint */
body.staff-side.users-page #pjax-container,
body.staff-side.users-page #pjax-container #content.users,
body.staff-side.orgs-page #pjax-container,
body.staff-side.orgs-page #pjax-container #content.orgs {
  transform: none !important;
  backface-visibility: visible !important;
}

/* staff-global-liquid-glass: table.list tbody tr { isolation; contain: paint } */
body.staff-side.users-page form#users-list table.mp-staff-directory-table.list tbody tr,
body.staff-side.orgs-page form#orgs-list table.mp-staff-directory-table.list tbody tr {
  position: static !important;
  isolation: auto !important;
  contain: none !important;
}

body.staff-side.users-page td[class*="mp-staff-dir-cell-status"],
body.staff-side.orgs-page td[class*="mp-staff-dir-cell-status"],
body.staff-side.users-page .mp-staff-directory-table tbody td.mp-staff-dir-cell-status,
body.staff-side.orgs-page .mp-staff-directory-table tbody td.mp-staff-dir-cell-status {
  position: static !important;
  isolation: auto !important;
  contain: none !important;
  z-index: auto !important;
}

@media screen and (min-width: 771px) {
  body.staff-side.users-page .mp-staff-directory-table tbody td,
  body.staff-side.users-page .mp-staff-directory-table tbody td *,
  body.staff-side.orgs-page .mp-staff-directory-table tbody td,
  body.staff-side.orgs-page .mp-staff-directory-table tbody td * {
    isolation: auto !important;
    contain: none !important;
    filter: none !important;
    -webkit-filter: none !important;
  }

  body.staff-side.users-page .mp-staff-directory-table .mp-staff-ticket-count-badge,
  body.staff-side.orgs-page .mp-staff-directory-table .mp-staff-ticket-count-badge,
  body.staff-side.users-page .mp-staff-directory-table tbody td .status-label,
  body.staff-side.users-page .mp-staff-directory-table tbody td span[class*="status"],
  body.staff-side.users-page .mp-staff-directory-table tbody td .userAccountStatus,
  body.staff-side.orgs-page .mp-staff-dir-users-trigger,
  body.staff-side.orgs-page .mp-staff-dir-software-trigger {
    isolation: auto !important;
    contain: none !important;
  }
}

@media screen and (max-width: 770px) {
  body.staff-side.users-page form#users-list table.mp-staff-directory-table tbody tr.mp-user-dir-card,
  body.staff-side.orgs-page form#orgs-list table.mp-staff-directory-table tbody tr.mp-org-dir-card {
    isolation: auto !important;
    contain: none !important;
  }
}

/* Staff login (scp/login.php) — card/chip opachi senza backdrop-filter */
body.staff-side.mp-staff-login-page #loginBox,
body.staff-side.mp-staff-login-page #loginBox.mp-staff-login-card,
body.staff-side.mp-staff-login-page .mp-staff-login-context-chip {
  background: linear-gradient(
    168deg,
    rgba(34, 52, 80, 0.92) 0%,
    rgba(22, 40, 64, 0.94) 52%,
    rgba(18, 34, 54, 0.96) 100%
  ) !important;
}

body.staff-side.mp-staff-login-page .mp-staff-login-context-chip {
  background: linear-gradient(
    168deg,
    rgba(180, 40, 40, 0.55) 0%,
    rgba(120, 20, 28, 0.72) 48%,
    rgba(60, 10, 16, 0.88) 100%
  ) !important;
}

body.staff-side.mp-staff-login-page #loginBox:after {
  content: none !important;
  display: none !important;
}
