:root { color-scheme: light;}
	/* *{ */
		/* border: solid red 1px; */
	/* } */

body {
  margin: 0;
  font-family: 'Gelasio', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: canvas;
  color: canvastext;
  line-height: 1.4;
}

.container {
  margin: 0;
  padding: 10px 10px 24px;
}

header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in oklab, canvas 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid color-mix(in oklab, canvastext 12%, transparent);
}

.fc-button-group>button{
  color: #fff !important;
}

.bar {
  display: grid;
  gap: 10px;
  /* grid-template-columns: 1fr auto auto; */
  align-items: center;
  padding: 12px 12px;
}

.brand { font-weight: 700; font-size: 18px; }

.field {
  display: flex; gap: 8px; align-items: center; width: 100%;
}
.field label { white-space: nowrap; font-size: 14px; }

/* Input & Select coerenti */
.field input,
.field select {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in oklab, canvastext 20%, transparent);
  border-radius: 10px;
  background: canvas; color: canvastext;
  font-size: 14px;
  margin-top: 20px;
  /* appearance: none; */
}

/* ===== Bottoni (stile richiesto) ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 40px;
  border: none;
  border-radius: 0px;
  color:white;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: .05em;
  font-size: 14px;
  cursor: pointer;
  background-color: #fbb900;
  /* color: #000; */
  transition: background-color .3s ease, transform .1s ease;
}
.btn:hover { background-color: #e0a800; }
.btn:active { transform: translateY(1px); }

.fc-header-toolbar.fc-toolbar.fc-toolbar-ltr {
  margin-left: 17px;
  margin-right: 17px;
}

/* Varianti (opzionali) */
#btnTogglePanel,
.btn-primary {
  background-color: #fbb900;
  /* color: #000; */
}
.btn-primary:hover { background-color: #e0a800; }

.btn-secondary {
  background-color: color-mix(in oklab, canvas 85%, canvastext 15%);
  color: canvastext;
}
.btn-secondary:hover {
  background-color: color-mix(in oklab, canvas 80%, canvastext 20%);
}

/* Layout principale */
.layout { position: relative; }
#calendar { margin-top: 12px; }

/* ===== Eventi FullCalendar – moderno senza doppia linea ===== */
.fc .fc-h-event,
.fc-event,
.fc-event-main {
  background-color: #fbb900 !important;
  border: none !important;        /* niente bordo */
  color: #000 !important;
  border-radius: 0 !important;    /* niente angoli arrotondati */
  box-shadow: none !important;    /* niente effetto bordo/ombra */
  overflow: hidden;
  transition: transform .15s ease;
}
.fc .fc-h-event:hover,
.fc-event:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 2px #000, 0 6px 14px rgba(0,0,0,0.24);
}

.fc-event-content-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
  gap: 8px;
  width: 100%;
  padding: 4px 8px;
}
.fc-event-title {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .2px;
}

/* Bottone cancella nell'evento */
/* Bottone cancella nell'evento */
.fc-event-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 0 !important;   /* quadrato */
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  line-height: 1;
  background-color: #000;        /* sfondo nero */
  border: none;                  /* nessun bordo */
  color: #fff;                   /* testo bianco */
  transition: background .2s ease, transform .1s ease;
  font-size: 0;
}
.fc-event-delete::before {
  content: '✕';
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  color: #fff;                   /* la X bianca */
}
.fc-event-delete:hover {
  background-color: #333;        /* grigio scuro in hover */
  transform: scale(1.05);
}
.fc-event-delete:active {
  transform: scale(0.95);
}


/* Bottoni toolbar FullCalendar */
.fc .fc-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border: none;
  border-radius: 0; /* nessuna stondatura */
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: .05em;
  font-size: 13px;
  cursor: pointer;
  background-color: #fbb900; /* gialli di default */
  color: #000;
  transition: background-color .3s ease, transform .1s ease;
  border-right: 1px solid rgba(255, 255, 255, 0.6); /* separazione visiva */
}

.fc .fc-button:last-child {
  border-right: none; /* niente bordo sull’ultimo della serie */
}

.fc .fc-button:hover {
  background-color: #e0a800;
}

.fc .fc-button:active {
  transform: translateY(1px);
}

/* Stato attivo (solo per i bottoni di visualizzazione periodo) → verde #046a38 */
.fc .fc-dayGridMonth-button.fc-button-active,
.fc .fc-timeGridWeek-button.fc-button-active,
.fc .fc-timeGridDay-button.fc-button-active,
.fc .fc-listWeek-button.fc-button-active {
  background-color: #046a38 !important;
  color: #fff !important;
}

/* Bottone custom "➕ Evento" → verde #046a38 */
.fc .fc-addEventButton-button {
  background-color: #046a38 !important;
  color: #fff !important;
}
.fc .fc-addEventButton-button:hover {
  background-color: #03552c !important; /* leggermente più scuro in hover */
}
.fc .fc-addEventButton-button:active {
  transform: translateY(1px);
}

.fc-today-button fc-button fc-button-primary{
	background-color: #fbb900 !important; /* gialli di default */
}

/* ===== Drawer laterale ===== */
.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 98;
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.panel-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.side-panel {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: clamp(320px, 33vw, 560px); /* ~un terzo su desktop */
  max-width: 100vw;
  background: canvas;
  color: canvastext;
  box-shadow: -8px 0 24px rgba(0,0,0,.25);
  z-index: 99;
  transform: translateX(100%);
  transition: transform .3s ease;
  display: flex;
  flex-direction: column;
}
.side-panel.open { transform: translateX(0); }

.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid color-mix(in oklab, canvastext 12%, transparent);
}
.side-panel-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.icon-btn {
  background: transparent;
  border: 1px solid color-mix(in oklab, canvastext 20%, transparent);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  color: canvastext;
}

.brand .logo {
  max-height: 75px;     /* altezza ragionevole in header */
  height: auto;
  width: auto;
  display: block;
}

.side-panel-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Mobile: drawer a piena larghezza */
@media (max-width: 640px) {
  .side-panel { width: 100vw; }
}

/* ===== Modal ===== */
.modal {
  display: none; /* JS -> 'flex' quando aperto */
  position: fixed;
  z-index: 100;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
  /* padding: 16px; */
}
.modal-content {
  position: relative;
  background: canvas;
  color: canvastext;
  /* border-radius: 12px; */
  padding: 24px 28px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-content h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}
.modal-close {
  position: absolute;
  right: 14px;
  top: 10px;
  font-size: 24px;
  cursor: pointer;
  background: transparent;
  border: 0;
  color: inherit;
}

.day-of-the-week{
	margin-top: 20px;
}

/* Form nel modal: campi su una riga ciascuno */
#eventForm {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#eventForm label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  display: block;
}
#eventForm input,
#eventForm select {
  width: 100%;
  padding: 10px 8px;  /* Padding laterale ridotto per mantenere il centramento */
  border-radius: 10px;
  border: 1px solid color-mix(in oklab, canvastext 20%, transparent);
  background: canvas; color: canvastext;
  font-size: 14px;
  box-sizing: border-box; /* Assicura che padding sia incluso nella larghezza */
}
#eventForm .btn {
  margin-top: 8px;
  width: 100%;
  /* background: #1976d2; /* se vuoi uniformarlo ai bottoni gialli, rimuovi questa regola */
  color: #fff;
  border: none;
  font-weight: 600;
  padding: 12px;
  border-radius: 0px;
  cursor: pointer;  
}
#eventForm .btn:hover { background: #125ea8; }

#massInsert{
	background-color: #046a38 !important;
	color: #fff;
}

#btnTogglePanel{
	color: #fff;
}

#btnClosePanel{
		color: #000 !important;
}
#modalClose{
	color: #000 !important;
}

#massConflicts{
  max-height: 350px;
  overflow: auto;
  border: 1px solid rgba(0,0,0,.15);
  padding: 8px 12px;
  border-radius: 8px;
  background: color-mix(in oklab, canvas 95%, transparent);
}

#btnLogout{
	background: red;
}

/* ===== Menu Mobile Dropdown ===== */
.brand-container {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  width: 100%;
}

.mobile-menu-toggle {
  display: flex; /* Sempre visibile su tutte le viewport */
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.hamburger-line {
  width: 30px;
  height: 3px;
  background-color: canvastext;
  transition: all 0.3s ease;
  transform-origin: 1px;
}

/* Animazione hamburger quando aperto */
.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
  transform: rotate(-45deg);
}

/* Menu mobile dropdown */
.mobile-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: canvas;
  color: canvastext;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 0 0 12px 12px;
  z-index: 1000;
  display: none;
  transform: translateY(-10px);
  opacity: 0;
  transition: all 0.3s ease;
  /* max-width: 100vw;  */
  /* overflow: hidden; */
}

.mobile-dropdown[aria-hidden="false"] {
  display: block;
  transform: translateY(0);
  opacity: 1;
}

.mobile-dropdown-nav {
  padding: 8px 0;
}

.mobile-dropdown-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: canvastext;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.2s ease;
  text-align: left;
}

.mobile-dropdown-item:hover {
  background-color: color-mix(in oklab, canvastext 5%, transparent);
}

.mobile-dropdown-item i {
  margin-left: 0;
  margin-right: 12px;
  width: 20px;
  text-align: center;
  font-size: 18px;
  color: #666;
}

.mobile-dropdown-item span {
  font-weight: 500;
}

/* ===== Responsive header ===== */
@media (max-width: 1100px) {
.fc .fc-toolbar{
	  flex-direction: column;
	  gap:10px;
  }
}

/* Nasconde i bottoni del menu normale su tutte le viewport */
.actions {
  display: none;
}

/* Assicura che il header abbia position relative per il dropdown */
header {
  position: relative;
  /* overflow: hidden;  */
}

/* Previene scroll orizzontale globale */
body {
  overflow-x: hidden;
}

@media (max-width: 640px) {
  /* .bar { grid-template-columns: 1fr; } */
  .field { order: 2; }
  /* .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;}
  .btn { width: 100%; }
  #linkEventi { width: 100%; }
  #linkCronologia { width: 100%; }
  #linkIVR { width: 100%; } */
  .fc .fc-toolbar-title { font-size: 1.05rem; }
  .fc .fc-toolbar-chunk:nth-child(1) .fc-button,
  .fc .fc-toolbar-chunk:nth-child(3) .fc-button { padding: 6px 8px; }

  .fc .fc-h-event,
  .fc-event,
  .fc-event-main {
    border-radius: 12px !important;
    box-shadow: 0 0 0 2px #000, 0 1px 4px rgba(0,0,0,0.15);
  }
  
  .fc .fc-toolbar{
	  flex-direction: column;
	  gap:10px;
  }

   /* Cuscinetto del titolo giorno */
   .fc .fc-col-header-cell-cushion{
    font-size: 12px;
    line-height: 1.1;
    padding: 4px 2px;
    white-space: normal;      /* consenti andare a capo */
    text-align: center;
  }
  /* Riduci un filo l’altezza della riga header */
  .fc .fc-col-header-cell { padding: 2px 0; }
  /* Un po' più contrasto */
  .fc .fc-col-header-cell-cushion { color: canvastext; font-weight: 600; }
}

@media (max-width: 430px) {
  .brand .logo{
    max-height: 46px;
  }
  
  .modal-content{
	max-width: 250px;
  }

}

.fc-event .fc-event-content-wrap {
  position: relative;
  display: flex;
  flex-direction: column; /* forza le due righe una sotto l’altra */
  padding-right: 18px;    /* spazio per la X */
}

.fc-event .fc-row {
  line-height: 1.2;
}

.fc-event .fc-event-delete {
  position: absolute;
  top: 2px;
  right: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  line-height: 1;
  opacity: 0.8;
}
.fc-event .fc-event-delete:hover {
  opacity: 1;
}

/* Testo eventi: colore coerente col giallo di default */
.fc .fc-h-event,
.fc .fc-timegrid-event .fc-event-main,
.fc .fc-daygrid-event .fc-event-title {
  color: #000 !important;            /* nero su giallo */
  text-shadow: none !important;
}

/* NON forzare il bianco nel wrapper: eredita dal contenitore */
.fc-event-content-wrap {
  color: inherit !important;
}

/* Variante per eventi "causale" (sfondo rosso → testo bianco) */
.fc .event-causale,
.fc .event-causale .fc-event-main,
.fc .event-causale .fc-daygrid-event .fc-event-title {
  color: #fff !important;
  background-color: #d32f2f !important;
}
/* Consenti ai contenitori interni di restringersi */
.fc .fc-timegrid-event,
.fc .fc-timegrid-event .fc-event-main,
.fc .fc-daygrid-event,
.fc .fc-daygrid-event .fc-event-main,
.fc-event-content-wrap {
  min-width: 0 !important;
}

/* Spezza parole lunghe dentro agli eventi (timeGrid + dayGrid) */
.fc .fc-timegrid-event .fc-event-main,
.fc .fc-daygrid-event .fc-event-title,
.fc-event .fc-row,
.fc-event-content-wrap {
  white-space: normal !important;     /* niente riga singola */
  overflow: visible !important;
  overflow-wrap: anywhere !important; /* forza la spezzatura dove serve */
  word-break: break-word !important;  /* fallback */
  hyphens: auto;                      /* trattini automatici se disponibili */
}

/* Un filo più piccolo su mobile per aiutare lo spazio */
@media (max-width: 640px){
  .fc .fc-timegrid-event .fc-event-main,
  .fc .fc-daygrid-event .fc-event-title,
  .fc-event .fc-row {
    font-size: 10px !important;
    line-height: 1.1 !important;
  }
}

.dataTables_filter {
  justify-content: center;
}


/* Body lock quando il pannello è aperto (evita scroll sotto) */
body.--lock-scroll {
  position: fixed;     /* evita che la pagina scorra */
  width: 100%;
  overflow: hidden;    /* ulteriore protezione */
}

/* Il pannello deve essere scrollabile internamente */
.side-panel {
  height: 100vh;
  height: 100dvh;                    /* migliore su mobile moderni */
  overflow-y: auto;                  /* scroll verticale del pannello */
  overscroll-behavior: contain;      /* evita scroll chaining sul body */
  -webkit-overflow-scrolling: touch; /* inerzia iOS */
}

/* Evita interazioni/gesti sotto l’overlay */
.panel-overlay.open {
  touch-action: none;
}

/* === Bordo bianco per tutti gli eventi FullCalendar === */
.fc .fc-h-event,
.fc .fc-daygrid-event,
.fc .fc-timegrid-event {
  /* usa un "ring" così non interferiamo con lo sfondo giallo/rosso */
  box-shadow: 0 0 0 2px #fff !important;
  border: none !important;           /* assicura che non compaiano bordi di default */
  border-radius: 0 !important;
}

/* Hover: mantieni il bordo bianco e aggiungi ombra di elevazione */
.fc .fc-h-event:hover,
.fc .fc-daygrid-event:hover,
.fc .fc-timegrid-event:hover {
  box-shadow: 0 0 0 2px #fff, 0 6px 14px rgba(0,0,0,0.24) !important;
  transform: translateY(-1px);
}
/* Mobile: stesso bordo bianco (sovrascrive la regola mobile esistente col bordo nero) */
@media (max-width: 640px) {
  .fc .fc-h-event,
  .fc .fc-daygrid-event,
  .fc .fc-timegrid-event {
    box-shadow: 0 0 0 2px #fff, 0 1px 4px rgba(0,0,0,0.15) !important;
    border-radius: 12px !important;
  }
}

/* Eventi "causale": sfondo rosso, ma anello sempre bianco */
.fc .event-causale,
.fc .event-causale .fc-event-main {
  box-shadow: 0 0 0 2px #fff !important;
}

/* Desktop: chip utente nella barra azioni */
.actions .user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fbb900;       /* giallo */
  color: #fff;               /* testo bianco */
  border: none;
  border-radius: 10px;
  font-weight: 700;
  pointer-events: none;      /* NON cliccabile */
  user-select: none;
}
.actions .user-chip i { color: #fff; }

/* Mobile: voce username (penultima, non cliccabile, gialla) */
.mobile-dropdown-item.user-display {
  background: #fbb900 !important;    /* giallo */
  color: #fff !important;            /* testo bianco */
  font-weight: 600;
  cursor: default !important;
  pointer-events: none !important;
}
.mobile-dropdown-item.user-display i {
  color: #fff !important;
}
.mobile-dropdown-item.user-display:hover {
  background: #fbb900 !important;    /* nessun cambio in hover */
}