html {
    touch-action: manipulation;
    -webkit-text-size-adjust: none;
    -moz-text-size-adjust: none;
	-ms-text-size-adjust: none;
    text-size-adjust: none;
}

* {
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 30px;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

main {
    flex: 1;
}

.navbar-brand img {
    max-height: 70px;
    width: auto;
    transition: all 0.3s ease;
}

#main-header.sticky .navbar-brand img {
    max-height: 50px;
}

#main-header {
    transition: all 0.3s ease;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    padding: 15px 0;
    background-color: #007bff;
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

#main-header.sticky {
    padding: 5px 0;
    background-color: rgba(0, 123, 255, 0.95);
}

#header-placeholder {
    height: 100px;
	transition: height 0.9s ease;
}

#main-header .navbar-brand,
#main-header .nav-link {
    transition: all 0.3s ease;
}

#oreValue {
    background-color: #007bff;
    color: white;
    padding: 5px 15px;
    border-radius: 4px;
}

.date-select-wrapper {
    min-width: 198px;
    max-width: 198px;
    position: relative;
    margin: 0 auto;
    height: 44px;
}

.date-select-wrapper input[type="date"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.date-select-wrapper input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.date-display {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0.75rem 1rem;
    background-color: #007bff;
    border: 2px solid #007bff;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    pointer-events: none;
}

.date-number,
.day-name {
    color: white;
    font-size: 1rem;
    font-weight: 500;
}

/* Stili specifici per il login */
.login-logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.password-container {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    color: #6c757d;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.toggle-password:focus {
    outline: none;
    color: #0d6efd;
}

.toggle-password:hover {
    color: #0d6efd;
}

.login-card {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border: none;
    border-radius: 15px;
    transition: all 0.3s cubic-bezier(.25,.8,.25,1);
}

.login-card:hover {
    box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
}

.login-card .card-header {
    background-color: transparent;
    border-bottom: none;
    text-align: center;
    padding-top: 2rem;
}

.login-form {
    padding: 2rem;
}

.login-btn {
    padding: 0.8rem;
    font-size: 1.1rem;
    min-height: 44px;
}

/* Notifiche e Comunicazioni */
.notifications-tabs {
    border: none;
    margin-bottom: 1rem;
}

.tab-header {
    display: flex;
    border-bottom: 2px solid #dee2e6;
    background-color: #fff;
}

.tab-button {
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    color: #495057;
    font-weight: 500;
    position: relative;
    min-height: 44px;
    transition: all 0.3s ease;
}

.tab-button.active {
    color: #007bff;
    background-color: transparent;
}

.tab-button.active:after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #007bff;
}

.badge-notification {
    background: #dc3545;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.tab-content {
    background-color: #fff;
    border-radius: 0 0 0.25rem 0.25rem;
}

.tab-pane {
    display: none;
    padding: 1rem;
}

.tab-pane.active {
    display: block;
}

.communication-item {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.3s cubic-bezier(.25,.8,.25,1);
}

.communication-item.unread {
    background-color: #fff3cd;
    border-color: #ffeeba;
}

.communication-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.communication-title {
    margin: 0px;
    font-size: 1.1rem;
    color: #212529;
}

.communication-meta {
    font-size: 0.875rem;
    color: #6c757d;
}

.communication-body {
    margin: 0.5rem 0;
}

.communication-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.btn-attachment, 
.btn-mark-read {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
}

.btn-attachment {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    text-decoration: none;
}

.btn-mark-read {
    background-color: #28a745;
    border: none;
    color: #fff;
}

.btn-mark-read:hover {
    background-color: #218838;
}

.notification-item {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.3s cubic-bezier(.25,.8,.25,1);
}

.notification-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-text {
    flex-grow: 1;
    margin-right: 1rem;
}

.notification-time {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.btn-delete {
    min-height: 44px;
    padding: 0.5rem 1rem;
    background-color: #dc3545;
    border: none;
    border-radius: 0.25rem;
    color: #fff;
    transition: all 0.3s ease;
}

.btn-delete:hover {
    background-color: #c82333;
}

/* Gestione Richieste */
.richieste-action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.richieste-status {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.richieste-table td {
    vertical-align: middle;
}

.richieste-info {
    display: flex;
    flex-direction: column;
}

.richieste-info small {
    margin-top: 0.25rem;
}

.modal-richiesta h6 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.modal-richiesta p {
    margin-bottom: 1rem;
}

/* Resto del CSS esistente */
#tipoPermessoContainer {
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

#tipo_permesso {
    width: 100%;
    min-height: 44px;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#tipo_permesso:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

#tipo_permesso:disabled {
    background-color: #e9ecef;
    opacity: 1;
}

.month-roller {
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.month-roller-content {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 320px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1050;
}

.month-roller-content.show {
    display: block;
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.month-item {
    text-align: center;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.month-item:hover {
    background-color: #f8f9fa;
}

.month-item.active {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
}

.chart-container {
    position: relative;
    height: 60vh;
    max-height: 400px;
    margin: 15px auto;
    background-color: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}

.card {
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    transition: all 0.3s cubic-bezier(.25,.8,.25,1);
}

.card:hover {
    box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.table th {
    background-color: #f8f9fa;
}

.navbar-nav .nav-link {
    color: #ffffff;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: all 0.3s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.navbar-nav .nav-link i {
    margin-right: 5px;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

@media screen and (max-width: 767px) {
    * {
        touch-action: manipulation;
    }

    body {
        padding-top: 23px;
    }
	
    .navbar-nav .nav-link {
        background-color: rgba(255, 255, 255, 0.1);
        border-radius: 10px;
        margin: 5px 0;
        padding: 12px 15px;
        display: flex;
        align-items: center;
        transition: all 0.3s ease;
    }

    .navbar-nav .nav-link:active {
        transform: scale(0.98);
    }

    .navbar-nav .dropdown-item {
        background-color: rgba(255, 255, 255, 0.1);
        border-radius: 10px;
        margin: 5px 0;
        padding: 12px 15px;
    }

    .navbar-nav .nav-item:not(:last-child) {
        margin-bottom: 5px;
    }

    .tab-header {
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-button {
        white-space: nowrap;
    }

    .communication-footer {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-attachment,
    .btn-mark-read {
        width: 100%;
        justify-content: center;
    }

    .notification-content {
        flex-direction: column;
    }

    .notification-actions {
        margin-top: 1rem;
        width: 100%;
    }

    .btn-delete {
        width: 100%;
    }

    /* Resto del CSS mobile esistente */
    .chart-container {
        height: 50vh;
        padding: 10px;
        margin: 10px auto;
    }

    .date-navigation {
        touch-action: manipulation;
        -webkit-overflow-scrolling: touch;
    }

    .date-navigation .btn {
        padding: 0.5rem;
        font-size: 1.2rem;
        min-width: 33px;
        min-height: 44px;
        height: 44px;
    }

    .navbar-brand img {
        max-height: 50px;
    }
	
	.table.richieste-table {
        display: block;
    }

    .table.richieste-table thead {
        display: none;
    }

    .table.richieste-table tbody,
    .table.richieste-table tr,
    .table.richieste-table td {
        display: block;
        width: 100%;
    }

    .table.richieste-table tr {
        margin-bottom: 1rem;
        border-bottom: 2px solid #dee2e6;
        padding-bottom: 1rem;
    }

    .table.richieste-table td {
        text-align: right;
        padding: 0.5rem;
        position: relative;
        border: none;
    }

    .table.richieste-table td::before {
        content: attr(data-label);
        float: left;
        font-weight: bold;
        text-transform: uppercase;
        font-size: 0.85em;
    }

    .richieste-action-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .richieste-action-buttons .btn,
    .richieste-action-buttons .btn-group {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .richieste-action-buttons .btn-group {
        gap: 0.5rem;
    }

    .richieste-info {
        text-align: right;
    }

    .richieste-status {
        text-align: right;
    }
	
	.login-logo {
        max-width: 150px;
    }

    .login-form {
        padding: 1.5rem;
    }

    .login-btn {
        font-size: 1rem;
        padding: 0.6rem;
    }
	
	.form-check {
        margin-bottom: 1rem;
        position: relative;
        display: flex;
        align-items: center;
        min-height: 44px;  /* Già presente per il touch target */
        padding: 0.5rem;
        background-color: #f8f9fa;
        border-radius: 0.25rem;
        transition: background-color 0.3s ease;
    }
	
	.form-check .form-check-input {
        float: left;
        margin-left: -0.5em;
    }

    /* Migliora la visualizzazione dei modali su mobile */
    .modal-richiesta .modal-body {
        padding: 1rem;
    }

    .modal-richiesta .d-flex.gap-2 {
        flex-direction: column;
    }

    .modal-richiesta .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    #main-header.sticky .navbar-brand img {
        max-height: 40px;
    }

    .month-roller-content {
        max-height: 80vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #tipo_permesso {
        font-size: 16px;
    }

    input, 
    button, 
    select, 
    a {
        min-height: 44px;
        min-width: 44px;
    }

    .form-control, 
    .btn, 
    .month-item {
        touch-action: manipulation;
    }

    .btn {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }

    #tipoPermessoContainer select {
        min-height: 44px;
        font-size: 16px;
        padding: 0.5rem;
    }

    .table-responsive {
        margin: 0 -15px;
    }

    .card-body {
        padding: 1rem;
    }

    .alert {
        margin-bottom: 1rem;
        padding: 0.75rem;
    }
	
	.richieste-action-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .richiestes-action-buttons .btn {
        width: 100%;
        margin-bottom: 0.5rem;
}

#backToTop {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
}

.scrollable {
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
}

/* Animazioni */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes badgePulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        background-color: #dc3545;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

.badge {
    transition: all 0.3s ease;
}

.badge-pulse {
    animation: badgePulse 0.5s ease;
}

.position-relative .badge {
    z-index: 2;
}

/* Ottimizzazione per mobile */
@media (max-width: 767px) {
    .navbar-nav .nav-link .badge {
        position: static;
        margin-left: 5px;
        transform: none;
    }
	
    .dropdown-menu .dropdown-item {
        padding: 0.5rem 1rem;
        white-space: nowrap;
    }

    .dropdown-menu .dropdown-item .badge {
        margin-left: 0.5rem;
        position: relative;
        top: 0;
        right: 0;
    }

        .table-responsive table {
        border: 0;
		width: 100%;
    }
	
	.card-header h2,
    .card-header h3,
    .card-header .card-title {
        display: block !important;  
        font-size: 1.2rem;
		margin: 0;  

    .table-responsive table thead {
        display: none;
    }
	
	.card-header {
        margin: 0;
        padding: 1rem;
    }

    .table-responsive table tr {
        margin-bottom: 1rem;
        display: block;
        border: 1px solid #dee2e6;
        border-radius: 4px;
        background: #fff;
        padding: 0.5rem;
    }

    .table-responsive table td {
        display: block;
        text-align: left;
        padding: 0.5rem;
        border: none;
        border-bottom: 1px solid #eee;
    }

    .table-responsive table td:last-child {
        border-bottom: none;
    }

    .table-responsive table td::before {
        content: attr(data-label);
        font-weight: bold;
        display: block;
        margin-bottom: 0.3rem;
        color: #666;
    }

    /* Stile per i bottoni */
    .table-responsive table td .btn {
        margin: 0.2rem 0;
        display: inline-block;
        min-width: 100px;
    }

    /* Stile per il conteggio letture */
    .table-responsive table td:has(.badge) {
        margin-bottom: 0.5rem;
    }

    /* Sistemazione spaziatura per numeri e date */
    .table-responsive table td:first-child {
        font-weight: bold;
        background: #f8f9fa;
        border-radius: 4px 4px 0 0;
    }
	
}

/* Stile per l'icona hamburger trasformabile */
.navbar-toggler {
    position: relative;
    padding: 0;
    width: 30px;
    height: 30px;
    border: none;
    outline: none !important;
    box-shadow: none !important;
}

.navbar-toggler:focus {
    box-shadow: none;
}

.navbar-toggler-icon {
    position: relative;
    transition: all 0.3s ease;
}

/* Crea le linee dell'hamburger menu usando pseudo elementi */
.navbar-toggler-icon::before,
.navbar-toggler-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: currentColor;
    transition: all 0.3s ease;
}

.navbar-toggler-icon {
    background: currentColor;
    display: inline-block;
    width: 24px;
    height: 2px;
    vertical-align: middle;
    background-clip: content-box;
    transition: background 0.3s ease;
}

.navbar-toggler-icon::before {
    top: -8px;
}

.navbar-toggler-icon::after {
    bottom: -8px;
}

/* Trasformazione in X quando il menu è aperto */
[aria-expanded="true"] .navbar-toggler-icon {
    background: transparent;
}

[aria-expanded="true"] .navbar-toggler-icon::before {
    transform: translateY(8px) rotate(45deg);
}

[aria-expanded="true"] .navbar-toggler-icon::after {
    transform: translateY(-8px) rotate(-45deg);
}

/* Aggiustamento badge notifiche nel menu */
.navbar-toggler .badge {
    position: absolute;
    top: -5px;
    right: -5px;
	margin-left: -21px;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* Stile per il menu mobile aperto */
@media (max-width: 767px) {
    .navbar-collapse {
        padding: 0;
		transition: all 0.9s ease;
    }

    .navbar-nav .nav-item {
        position: relative;
    }

    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
    }

    .navbar-nav .badge {
        position: static;
        margin-left: 0.5rem;
        display: inline-block;
        vertical-align: middle;
    }

    /* Miglioramento allineamento badges nel menu mobile */
    .nav-link .position-absolute {
        position: static !important;
        display: inline-flex !important;
        transform: none !important;
        margin-left: 0.5rem;
    }

    /* Miglioramento stile dropdown nel menu mobile */
    .dropdown-menu {
        border: none;
        background: transparent;
        padding: 0 1rem;
		position: static !important; 
		overflow-y: auto;   
		max-height: 250px;
		-webkit-overflow-scrolling: touch;
		z-index: 1000;
    }
	
	.navbar-collapse {
		max-height: calc(100vh - 80px);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}
	

    body:has(.navbar-collapse.show) {
        overflow: hidden;
    }

    .dropdown-menu::-webkit-scrollbar {
        width: 3px;
    }

    .dropdown-menu::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }

    .dropdown-item {
        color: rgba(255, 255, 255, 0.8);
        padding: 0.5rem 1rem;
    }

    .dropdown-item:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }
	
	.dropdown-menu .dropdown-item {
        position: relative;
        padding-right: 2.5rem;  /* Spazio per il badge */
        display: flex;
        align-items: center;
    }
	
	.dropdown-menu .dropdown-item .badge {
       position: absolute;
       top: -5px;
       right: -5px;
	   margin-left: -21px;
       font-size: 0.75rem;
       padding: 0.25rem 0.5rem;
    }
	
	.dropdown-item i {
       margin-right: 0.5rem;
       width: 1.25rem;  
       text-align: center;
    }
}

/* Stili per validazione form */
.form-select.is-invalid,
.form-control.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-select.is-valid,
.form-control.is-valid {
    border-color: #28a745;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Tooltip personalizzati */
.custom-tooltip {
    position: relative;
    display: inline-block;
}

.custom-tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: black;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px 0;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
}

.custom-tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Stili per il loading spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-radius: 50%;
    border-top: 4px solid #3498db;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.disabled {
    pointer-events: none;
    opacity: 0.6;
}

/* Personalizzazione scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Modal base styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3); /* Ridotto l'oscuramento del backdrop */
    z-index: 9999;
    display: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    pointer-events: auto !important;
}

.modal.show {
    display: block;
}

.modal-dialog {
    position: relative;
    width: 90%;
    max-width: 500px;
    margin: 1.75rem auto;
    z-index: 10000;
    pointer-events: all !important;
}

.modal-content {
    position: relative;
    background: #fff;
    border-radius: 0.3rem;
    box-shadow: 0 2px 4px rgba(0,0,0,.1); /* Shadow più leggero */
    pointer-events: all !important;
}

/* Fix specifico per iOS */
@supports (-webkit-touch-callout: none) {
    body.modal-open {
        position: fixed;
        width: 100%;
        overflow: hidden;
    }
    
    body.modal-open #main-header {
        z-index: auto;
    }
    
    .modal {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        z-index: 99999;
        padding-top: 76px;
        background: rgba(0, 0, 0, 0.3); /* Mantiene la stessa opacità */
    }

    .modal-backdrop {
        display: none; /* Rimuove il backdrop doppio */
    }
    
    .modal-content {
        background: #fff !important; /* Assicura sfondo bianco */
        opacity: 1 !important; /* Assicura opacità piena */
    }
}

/* Media query per dispositivi mobili */
@media (max-width: 767px) {
    @supports (-webkit-touch-callout: none) {
        .modal {
            padding-top: 60px;
        }
        
        .modal-dialog {
            margin: 0.5rem auto;
            width: 95%;
        }
    }
}

/* Override per Bootstrap modal backdrop */
.modal-backdrop {
    opacity: 0.3 !important; /* Riduce l'opacità del backdrop */
}

.modal-backdrop.show {
    opacity: 0.3 !important;
}

/* Sistema di controllo dimensioni testo per diversi dispositivi */
@media screen and (max-width: 320px) {
    html, body {
        font-size: 14px !important;
    }
    
    /* Forza le dimensioni anche per elementi specifici */
    .form-control,
    .btn,
    .nav-link,
    .dropdown-item,
    .card-title,
    .card-text,
    input,
    select,
    textarea,
    }
}

@media screen and (min-width: 321px) and (max-width: 375px) {
    html, body {
        font-size: 15px !important;
    }
    
    .form-control,
    .btn,
    .nav-link,
    .dropdown-item,
    .card-title,
    .card-text,
    input,
    select,
    textarea,
    }
}

@media screen and (min-width: 376px) and (max-width: 428px) {
    html, body {
        font-size: 16px !important;
    }
    
    .form-control,
    .btn,
    .nav-link,
    .dropdown-item,
    .card-title,
    .card-text,
    input,
    select,
    textarea,
    }
    
    /* Previeni zoom su input iOS */
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="tel"],
    input[type="password"] {
        font-size: 16px !important;
    }
}
