.was-validated .form-control:valid, .form-control.is-valid {
    /*background-position: right calc(1em + 0.1875rem) center;*/
	border: 2px solid #28a745;
}
.was-validated .form-control:invalid, .form-control.is-invalid {
    /*background-position: right calc(1em + 0.1875rem) center;*/
	border: 2px solid #dc3545;
}

.is-valid+.select2-container--bootstrap-5 .select2-selection, .was-validated select:valid+.select2-container--bootstrap-5 .select2-selection {
	border: 2px solid #28a745;
}
.is-invalid+.select2-container--bootstrap-5 .select2-selection, .was-validated select:invalid+.select2-container--bootstrap-5 .select2-selection {
    border: 2px solid #dc3545;
}

.error_message_ok, .error_message_ko, .error_message_link{
	display: none;
	text-align:center;
}
h1{
	font-size: 3em;
}
/*
@media (min-width: 768px) {
	h1{
		font-size: 5.5em;
	}
}
*/
.red{
	color: #FF0000;
}
@media print {
 .d-print-none {
  display: none!important;
 }
}
.invalid-feedback {
    font-weight: bold;
}
.ft-xl{
	font-size:2em;
}
@media (min-width: 768px) {
	.ft-xl{
		font-size:3em;
	}
}
.loader {
    position: fixed;
    top: 0; right: 0;
    bottom: 0; left: 0;
    background: rgba(255, 255, 255, 0.5);
    z-index: 9999;
}
.icona_loader {
    left: 50%;
    margin-left: -4em;
    font-size: 10px;
    border: .8em solid rgba(218, 219, 223, 1);
    border-left: .8em solid rgba(0, 0, 0, 1);
    animation: spin 1.1s infinite linear;
}
.icona_loader, .icona_loader:after {
    border-radius: 50%;
    width: 8em;
    height: 8em;
    display: block;
    position: absolute;
    top: 50%;
    margin-top: -4.05em;
}

@keyframes spin {
  0% {
    transform: rotate(360deg);
  }
  100% {
    transform: rotate(0deg);
  }
}
.header-bg{
	background-color: #f9f9f9;
}

.max-width-logo{
		max-width:110px;
	}
@media (min-width: 768px) {
	.max-width-logo{
		max-width:140px;
	}
}

.ft-10{
	font-size:10px;
}
.ft-12{
	font-size:12px;
}
.max_width_100{
	max-width:100px;
}
.max_width_150{
	max-width:150px;
}
.max_width_80{
	max-width:80px;
}

@media (max-width: 992px) {
	.pt-4, .py-4 {
		padding-top: 0.5rem !important;
	}
	h5, .h5 {
		font-size: 1rem !important;
	}
	
	.container, .container-sm, .container-md {
			max-width: 100%;
		}
}

#genera_nuovo{
	display:none;
}
.datepicker input{
	cursor: pointer;
}
h5.card-title, h5.card-title:hover{
	text-decoration:none !important;
}
.border-radius-5{
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
}
.input-group-append {
	cursor: pointer;
}

.input-group-text.date{
	border-radius: 0;
	border-top-right-radius: 0.375rem;
	border-bottom-right-radius: 0.375rem;
}
.datepicker{ z-index:999 !important; }
.dataTable p{
	margin: 0px;
}
.dataTable.table-sm, .dataTable.table-sm p{
	font-size: 0.9rem;
}
.form-signin {
	width: 100%;
	max-width: 400px;
	padding: 15px;
	margin: auto;
}
.form-signin .checkbox {
	font-weight: 400;
}
.form-signin .form-floating:focus-within {
	z-index: 2;
}
.form-signin input[type="email"] {
	margin-bottom: -1px;
	border-bottom-right-radius: 0;
	border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
	margin-bottom: 10px;
	border-top-left-radius: 0;
	border-top-right-radius: 0;
}

/* Stile personalizzato per il countdown */
#countdown {
	/*
	display: flex;
	justify-content: center;
	align-items: center;
	
	background-color: #f1f1f1;
	border-radius: 10px;
	padding: 20px;
	font-weight: bold;*/
	font-size: 36px;
	
	color: #333;
	text-align: center;
  }

  #countdown .countdown-item {
	/*display: flex;
	flex-direction: column;
	*/
	align-items: center;
	margin: 0 10px;
  }

  #countdown .countdown-value {
	/*display: inline-block;*/
	margin: 10px;
	padding: 10px;
	background-color: #dc3545;
	color: #fff;
	border-radius: 10px;
	font-size: 48px;
	min-width: 90px;
	min-height: 100px;
  }

  #countdown .countdown-label {
	/*margin-top: 5px;*/
	font-size: 24px;
  }

  @media (max-width: 577px) {
	h1{
	  font-size:2em;
	}
	#countdown .countdown-value {
		font-size: 30px;
		min-width: 60px;
		min-height: 60px;
	}
	#countdown .countdown-item {
		margin: 0 4px;
	}
	#countdown .countdown-label {
		/*margin-top: 5px;*/
		font-size: 16px;
	}
  }
  .cursor-pointer{
	cursor: pointer;
  }
  .dati_vecchia_matricola{
	margin-top:1rem;
  }
  #form_field .form-label {
	margin-bottom: 0rem;
  }

  /*
.dropzone {
    min-height: inherit;
    border: var(--bs-border-width) solid var(--bs-border-color);
	border-radius: 0.375rem;
    background: #fff;
    padding: 20px 20px;
}
*/

#elenco tbody tr:hover {
    background-color: #f5f5f5; /* Scegli il colore che preferisci */
}
.fs-7 {
    font-size: 0.9rem!important;
}
.fs-8 {
    font-size: 0.8rem!important;
}
.bg-giallo{
	background-color: #ffc10736 !important;
}
.bg-verde{
	background-color: #1987546e !important;
}
.bg-rosso{
	background-color: #dc354585 !important;
}
.bg-purple{
	background-color: #b8006b85 !important;
}
.bg-info{
	background-color: #0dcaf075 !important;
}
.bg-nero{
	background-color: #000000ea !important;
	color:#fff !important;
}

/*
.dropzone .dz-preview .dz-image img {
	width: 250px; 
	height: auto; 
	object-fit: contain;
}
*/
#elenco thead input, #elenco tfoot input {
    width: 100%;
}
table#elenco.dataTable.table-sm>thead>tr>th:not(.sorting_disabled) {
    padding-right: 2px;
}

.select2-results__option {
    white-space: normal !important;
    word-wrap: break-word !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    white-space: normal !important;
    word-wrap: break-word !important;
}

.js-select2_activator ~.select2-container .select2-selection--single, .select2-results__option{
	font-size: 0.8rem !important; 
}

.js-select2_activator_ajax ~.select2-container .select2-selection--single{
	font-size: 0.8rem !important;
	min-width: 200px;
}

.custom-select2-search-field .select2-search__field {
    font-size: 0.8rem !important;
}

.js-select2_activator_ajax ~.select2-container .select2-selection--single .select2-results__option{
	white-space: normal; /* Permette il testo su più righe */
    max-width: 200px; /* Larghezza massima per evitare scrollbar orizzontale */
    word-wrap: break-word; /* Rompe il testo alla fine della riga */
}

.min-width-100{
	min-width: 100px;
}
.min-width-150{
	min-width: 150px;
}
.min-width-200{
	min-width: 200px;
}
.min-width-250{
	min-width: 250px;
}
.min-width-300{
	min-width: 300px;
}
.min-width-400{
	min-width: 400px;
}
.max-width-100{
    max-width: 100px;
}
.max-width-120{
    max-width: 120px;
}
.max-width-150{
    max-width: 150px;
}
.max-width-180{
    max-width: 180px;
}
.max-width-200{
    max-width: 200px;
}
.max-width-250{
    max-width: 250px;
}
.filter-width-small{
    min-width: 80px;
    max-width: 100px;
    flex-grow: 0 !important;
}
.filter-width-medium{
    min-width: 100px;
    max-width: 140px;
    flex-grow: 0 !important;
}
.filter-width-large{
    min-width: 140px;
    max-width: 180px;
    flex-grow: 0 !important;
}
.filter-width-date{
    min-width: 140px;
    max-width: 170px;
    flex-grow: 0 !important;
}

@media (max-width: 767px){
    .min-width-100,.min-width-150,.min-width-200,.min-width-250,.min-width-300,.min-width-400,.max-width-100,.max-width-120,.max-width-150,.max-width-180,.max-width-200,.max-width-250,.filter-width-small,.filter-width-medium,.filter-width-large,.filter-width-date{
        min-width: 100%;
        max-width: 100%;
        flex-grow: 1 !important;
    }
}

/* Select2 colored options for status filters */
.select2-results__option[data-color="danger"],
.select2-results__option.select2-color-danger {
    background-color: #f8d7da !important;
    color: #721c24 !important;
}
.select2-results__option[data-color="warning"],
.select2-results__option.select2-color-warning {
    background-color: #fff3cd !important;
    color: #856404 !important;
}
.select2-results__option[data-color="success"],
.select2-results__option.select2-color-success {
    background-color: #d4edda !important;
    color: #155724 !important;
}
.select2-results__option[data-color="danger"]:hover,
.select2-results__option.select2-color-danger:hover {
    background-color: #f5c6cb !important;
}
.select2-results__option[data-color="warning"]:hover,
.select2-results__option.select2-color-warning:hover {
    background-color: #ffeeba !important;
}
.select2-results__option[data-color="success"]:hover,
.select2-results__option.select2-color-success:hover {
    background-color: #c3e6cb !important;
}
/* Selected colored tags in multiple select */
.select2-selection__choice.select2-choice-danger {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #fff !important;
}
.select2-selection__choice.select2-choice-warning {
    background-color: #ffc107 !important;
    border-color: #ffc107 !important;
    color: #212529 !important;
}
.select2-selection__choice.select2-choice-success {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
    color: #fff !important;
}
/* Remove button (X) color in colored tags - Bootstrap 5 Select2 */
/* La X usa un background-image SVG, quindi usiamo filter per cambiare colore */
.select2-selection__choice.select2-choice-danger .select2-selection__choice__remove,
.select2-selection__choice.select2-choice-success .select2-selection__choice__remove {
    filter: brightness(0) invert(1) !important;
    border-color: rgba(255,255,255,0.4) !important;
    opacity: 0.85;
}
.select2-selection__choice.select2-choice-danger .select2-selection__choice__remove:hover,
.select2-selection__choice.select2-choice-success .select2-selection__choice__remove:hover {
    opacity: 1;
}
.select2-selection__choice.select2-choice-warning .select2-selection__choice__remove {
    /* Giallo mantiene X scura */
    border-color: rgba(0,0,0,0.2) !important;
}
/* Single selection colored */
.select2-selection--single.select2-color-danger {
    background-color: #f8d7da !important;
    border-color: #dc3545 !important;
}
.select2-selection--single.select2-color-warning {
    background-color: #fff3cd !important;
    border-color: #ffc107 !important;
}
.select2-selection--single.select2-color-success {
    background-color: #d4edda !important;
    border-color: #28a745 !important;
}

.max-width-logo-xl{
    max-width: 200px;
}
.max-width-logo-lg{
    max-width: 150px;
}
.max-width-logo{
    max-width: 100px;
}

.js-select2_activator_multiple ~ .select2-container .select2-selection--single, .select2-results__option {
    font-size: 0.8rem !important;
}

.js-select2_activator_multiple ~ .select2-container .select2-selection--multiple, 
.js-select2_activator_multiple ~ .select2-container .select2-selection--multiple .select2-selection__rendered, .select2-results__option {
    font-size: 0.8rem !important;
}

/* Mostra la freccina per il select multiplo */
.select2-container--default .select2-selection--multiple .select2-selection__arrow {
    display: block; /* Assicurati che la freccina sia visibile */
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 1em;
    height: 1em;
}
/* Optional: Stile della freccina */
.select2-container--default .select2-selection--multiple .select2-selection__arrow b {
    border-color: #888 transparent transparent transparent;
    border-style: solid;
    border-width: 0.3em 0.3em 0 0.3em;
    display: inline-block;
    height: 0;
    width: 0;
    margin-left: 0.255em;
    vertical-align: middle;
}
/* Specifiche per il select multiplo */
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered,
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered .select2-selection__choice {
    font-size: 0.8rem; /* Riduce la dimensione del font */
    padding-top: 0rem; /* Aggiusta il padding superiore */
    padding-bottom: 0rem; /* Aggiusta il padding inferiore */
}

.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered .select2-selection__choice .select2-selection__choice__remove {
    font-size: 0.8rem; /* Riduce la dimensione del font */
    margin-top: -2px; /* Allinea l'icona di rimozione al centro verticalmente */
}

.select2-container--bootstrap-5 .select2-selection--multiple .select2-search {
    height: 1.1rem;
}

.img-zoom {
	transition: transform 0.3s ease;
}

.img-zoom:hover {
	transform: scale(1.5);
}

.fs-8{
	font-size: 0.8rem;
}

.my-1 {
	margin-top: 0.25rem!important;
	margin-bottom: 0.25rem!important;
}
@media (min-width: 992px){
	.mr-lg-2 {
		margin-right: 1rem!important;
	}
	.my-lg-0 {
		margin-top: 0rem!important;
		margin-bottom: 0rem!important;
	}
}

.flex-basis-5{
	flex-basis: 5%;
}
.flex-basis-10{
	flex-basis: 10%;
}
.flex-basis-15{
	flex-basis: 15%;
}
.flex-basis-20{
	flex-basis: 20%;
}
.flex-basis-30{
	flex-basis: 30%;
}
.flex-basis-40{
	flex-basis: 40%;
}
.flex-basis-50{
	flex-basis: 50%;
}

/* Centra il popup nella finestra */
.dataTables_processing {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    width: auto !important;
    height: auto !important;
    margin-left: -50px !important; /* metà della larghezza del popup */
    margin-top: -50px !important;  /* metà dell'altezza del popup */
    padding: 20px !important;
    /*background-color: rgba(0, 0, 0, 0.7);
    color: white;
    */
	font-size: 18px !important;
    text-align: center !important;
    border-radius: 10px !important;
    z-index: 9999 !important;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5) !important;
}

/* Nascondi l'indicatore di caricamento durante il caricamento iniziale */
.dataTables_processing:empty {
    display: none !important;
}

/* Stile personalizzato per il modal a schermo intero */
.modal-dialog-fullscreen {
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	max-width: 100%;
}
.modal-content-fullscreen {
	height: 100%;
	display: flex;
	flex-direction: column;
}
.modal-body-fullscreen {
	flex: 1;
	overflow: auto;
	display: flex;
	justify-content: center;
	align-items: center;
}
#tiff-canvas {
	max-width: 100%;
	max-height: 100%;
	border: 1px solid #ccc;
}
#imageLightboxModal .modal-body-fullscreen {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px; /* Adjust padding as needed */
    box-sizing: border-box;
}
#tiff-lightbox-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
	border: 1px solid #ccc;
}

/* Positioning for the left arrow */
#prev-lightbox-button {
    position: absolute;
    left: 20px; /* Adjust this value to control spacing from the left edge */
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.5); /* Optional: Adds a semi-transparent background */
    /*border-radius: 50%;*/
    color: white;
    border: none;
}

/* Positioning for the right arrow */
#next-lightbox-button {
    position: absolute;
    right: 20px; /* Adjust this value to control spacing from the right edge */
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.5); /* Optional: Adds a semi-transparent background */
    /*border-radius: 50%;*/
    color: white;
    border: none;
}

/* Adjust hover effect for the buttons */
#prev-lightbox-button:hover, #next-lightbox-button:hover {
    background-color: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}

@media (min-width: 992px) {
    .content {
        padding: 1rem !important;
		width: auto !important;
    }
}
.select2-container--bootstrap-5 .select2-dropdown.select2-dropdown--above {
    z-index: 99999;
}

.select2-container .select2-selection--single {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-clip: padding-box;
    background-color: #fff;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    color: #495057;
    display: block;
    font-size: .875rem;
    font-weight: 400;
    line-height: 1.5;
    padding: .35rem .85rem;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    width: 100%;
    box-sizing: border-box; /* Per sicurezza */
    height: auto; /* Per adattarsi meglio al contenuto */
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: inherit;
    padding: 0; /* Allinea il padding interno */
    line-height: inherit;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    top: 50%;
    transform: translateY(-50%);
    right: 10px;
}

.toast.bg-success {
	background-color: #28a745 !important;
}
.toast.bg-danger {
	background-color: #dc3545 !important;
}
.toast-body {
	font-size: 1rem;
}
.toast.bg-success .toast-header,
.toast.bg-danger .toast-header {
	background-color: inherit; /* Stesso sfondo del body */
	color: #fff; /* Testo bianco */
	border-bottom: 1px solid rgba(255, 255, 255, 0.3); /* Bordo inferiore leggero */
}
.toast .btn-close {
	filter: invert(1); /* Rende la "X" bianca */
}  
#changePasswordModal .modal-footer {
	border-top: none;
	padding: 0;
}
.select2-container--open {
    z-index: 99999 !important;
}

.select2-dropdown {
    z-index: 99999 !important;
}


.input-group-text[data-td-toggle="datetimepicker"]:hover {
    cursor: pointer !important;
}
.datatable_modal thead input {
    width: 100%;
    box-sizing: border-box;
    padding: 2px 4px;
    font-size: 0.85rem;
    max-width: 100%;
}


.iti {
width: 100%;
}

.iti input {
width: 100%;
}

.avatar-small {
    height: 20px !important;
    width: 20px !important;
}


.form-control {
    border: 2px solid var(--bs-border-color);
}
.select2-container .select2-selection--single {
    border: 2px solid var(--bs-border-color);
}
.input-group-text {
    border: 2px solid var(--bs-border-color);
}
.select2-dropdown {
    border: 2px solid var(--bs-border-color);
}
.note-editor.note-airframe, .note-editor.note-frame {
    border: 2px solid var(--bs-border-color);
}

/*
.form-control,
.form-select,
.input-group-text,
.select2-container .select2-selection--single,
.select2-dropdown {
    border: 2px solid var(--bs-border-color) !important;
	background-color: #fff !important;
}

.form-control:focus,
.form-select:focus {
    background-color: transparent !important;
    box-shadow: none !important;
    border-color: var(--bs-border-color) !important;
	background-color: #fff !important;
}

.select2-container--bootstrap-5 .select2-selection:focus,
.select2-container--bootstrap-5 .select2-selection.select2-selection--single:focus,
.select2-container--bootstrap-5 .select2-selection.select2-selection--multiple:focus {
    background-color: transparent !important;
    box-shadow: none !important;
    border-color: var(--bs-border-color) !important;
	background-color: #fff !important;
}
*/

#calendar-container {
    /*
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color:#fff;
    */
    flex-grow: 1; /* prende tutto lo spazio disponibile */
    overflow: hidden;
}

.fc-header-toolbar {
    /*
    the calendar will be butting up against the edges,
    but let's scoot in the header's buttons
    */
    padding-top: 1em;
    padding-left: 1em;
    padding-right: 1em;
}


/* Pulsanti compatti */
.fc .fc-button {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    margin: 2px;
}

/* Responsive */
@media (max-width: 576px) {
.fc-header-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fc-toolbar-top-row {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.fc-header-toolbar .fc-toolbar-chunk {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.fc-toolbar-title {
    font-size: 1rem !important;
}

.fc .fc-button {
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
}
}

.h-95{
    height:95%;
}

#calendar-container.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 111;
    background: white;
    padding: 1rem;
}

#calendar-container.card-mode {
    position: relative;
}

#fullscreenExitBtn {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 111;
    border-radius: 0;
    padding: 0.3rem 0.6rem;
    font-size: 0.9rem;
    background-color: rgba(255, 255, 255, 0.85); /* leggero sfondo per visibilità */
    border: none;
    border-left: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
}

#fullscreenExitBtn:hover {
    background-color: #2c3e50;
}

#calendar-container.fullscreen-mode #fullscreenExitBtn {
    display: inline-block !important;
}
.btn-xs {
    --bs-btn-padding-y: 0.2rem !important;
    --bs-btn-padding-x: 0.5rem !important;
    --bs-btn-font-size: 0.55rem !important;
    --bs-btn-border-radius: var(--bs-border-radius-sm) !important;
}
.max-width-95-perc{
    max-width: 95%;
}
@media (min-width: 768px) {
    .w-md-100 { width: 100% !important; }
    .h-md-100 { height: 100% !important; }
    .vh-md-100 { height: 100vh !important; }
} 
#elenco tbody tr {
    cursor: pointer;
}
.file-list {
    list-style-type: none;
    padding: 0;
}
.file-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px;
    border: 1px solid #ddd;
    margin-top: 5px;
}
.file-list li a {
    flex-grow: 1;
    margin-right: 10px;
}
.dropZone {
    background-color: #e9ecef;
    color: #000;
    padding: 30px;
    border: 2px dashed white;
    cursor: pointer;
}
.dropZone.dragging {
    background-color: #0056b3;
}
.dropZone i {
    font-size: 50px;
    margin-bottom: 10px;
}
.dropZone p {
    margin: 0;
}
.pickr > button {
    border: 2px solid var(--bs-border-color);
}
.select2-container--bootstrap-5 .select2-selection{
    border: 2px solid var(--bs-border-color);
}
#calendar-legend {
  font-size: 0.9rem;
}

#calendar-legend span {
  line-height: 1;
}
.form-control::placeholder {
    opacity: 0.3 !important;
}

/* ===============================================
   CALENDARIO - Ottimizzazioni Touch e Scroll
   =============================================== */

/* Container principale del calendario */
#calendar {
    height: 100%;
    min-height: 400px;
}

/* Assicura che gli scroller interni di FullCalendar siano scrollabili su touch */
#calendar .fc-scroller,
#calendar .fc-scroller-liquid,
#calendar .fc-scroller-liquid-absolute {
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Fix per permettere scroll nella vista timegrid (giorno/settimana) */
#calendar .fc-timegrid-body {
    touch-action: pan-y !important;
}

#calendar .fc-scrollgrid-section-body {
    touch-action: pan-y !important;
}

/* ===============================================
   CALENDARIO MOBILE - Media Queries
   =============================================== */
@media (max-width: 768px) {
    /* Header calendario - layout fisso e consistente */
    .fc-header-toolbar {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 0.5em !important;
        gap: 0.4rem !important;
    }

    /* RIGA 1: Titolo periodo (mese/settimana) - sempre in alto centrato */
    .fc-header-toolbar .fc-toolbar-chunk:nth-child(2) {
        order: 1 !important;
        width: 100% !important;
        text-align: center !important;
        margin-bottom: 0.2rem !important;
    }

    .fc-toolbar-title {
        font-size: 1rem !important;
        font-weight: 600 !important;
    }

    /* RIGA 2: Frecce navigazione - centrate */
    .fc-header-toolbar .fc-toolbar-chunk:first-child {
        order: 2 !important;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        gap: 0.5rem !important;
        margin-bottom: 0.2rem !important;
    }

    /* RIGA 3: Pulsanti vista (Mese, Settimana, Giorno, ecc.) - in basso */
    .fc-header-toolbar .fc-toolbar-chunk:last-child {
        order: 3 !important;
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 4px !important;
    }

    /* Pulsanti più grandi e leggibili su mobile */
    .fc .fc-button {
        font-size: 0.8rem !important;
        padding: 0.4rem 0.6rem !important;
        min-height: 36px !important;
    }

    /* Pulsanti navigazione (frecce e oggi) leggermente più grandi */
    .fc .fc-prev-button,
    .fc .fc-next-button,
    .fc .fc-today-button {
        font-size: 0.85rem !important;
        padding: 0.4rem 0.8rem !important;
    }

    /* Altezza celle giorno più compatta */
    .fc .fc-daygrid-day {
        min-height: 60px !important;
    }

    /* Eventi più compatti */
    .fc-event-title {
        font-size: 0.75rem !important;
    }

    /* Container calendario card-mode */
    #calendar-container.card-mode {
        height: 100% !important;
        display: flex;
        flex-direction: column;
    }

    #calendar-container.card-mode #calendar {
        flex: 1;
        min-height: 0;
    }

    /* Bottone fullscreen più accessibile */
    #toggleView {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }

    /* Header fila con area name e bottone */
    .row.align-items-center.justify-content-between.g-2 {
        flex-wrap: wrap;
    }

    .row.align-items-center.justify-content-between.g-2 > .col-auto:first-child h3 {
        font-size: 1.1rem;
        margin-bottom: 0.25rem;
    }
}

/* Extra small devices (< 480px) */
@media (max-width: 480px) {
    .fc-header-toolbar {
        padding: 0.3em !important;
        gap: 0.3rem !important;
    }

    .fc-toolbar-title {
        font-size: 0.95rem !important;
    }

    /* Pulsanti ancora leggibili su schermi piccoli */
    .fc .fc-button {
        font-size: 0.75rem !important;
        padding: 0.35rem 0.5rem !important;
        min-height: 34px !important;
    }
}