/* Custom styles beyond Tailwind */

/* Toast animations */
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

.toast {
    animation: slideInRight 0.3s ease-out forwards;
}

.toast.hiding {
    animation: slideOutRight 0.3s ease-in forwards;
}

/* Custom scrollbars (Verticale & Orizzontale) */
::-webkit-scrollbar {
    width: 8px;
    height: 10px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; 
}

/* Barra di scorrimento orizzontale ben visibile per tabelle */
.overflow-x-auto::-webkit-scrollbar {
    height: 12px !important; /* Spessore maggiorato per facilitare il trascinamento a destra/sinistra */
}

.overflow-x-auto::-webkit-scrollbar-track {
    background: #e2e8f0 !important;
    border-radius: 6px;
}

.overflow-x-auto::-webkit-scrollbar-thumb {
    background: #7c3aed !important; /* Viola Coverzen ben visibile */
    border-radius: 6px;
    border: 2px solid #e2e8f0;
}

.overflow-x-auto::-webkit-scrollbar-thumb:hover {
    background: #6d28d9 !important;
}

/* Nav Link active state */
.nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Responsive Table & Modal Fit Improvements */
.overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: auto;
    scrollbar-color: #7c3aed #e2e8f0;
    width: 100%;
}

/* Adattamento Modali per schermi di altezze ridotte (Notebook 13", Tablet) */
.fixed.inset-0 > div:not(#sidebar-overlay) {
    max-height: calc(100vh - 2rem);
    max-width: calc(100vw - 2rem);
    overflow-y: auto;
}

/* Auto-Fit e Ridimensionamento proporzionale per schermi PC stretti / Portatili */
@media (max-width: 1440px) {
    html {
        font-size: 14px;
    }

    #main-content {
        padding: 0.875rem !important;
    }

    .p-6 {
        padding: 0.85rem !important;
    }

    .p-8 {
        padding: 1rem !important;
    }

    table th, table td {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
        padding-left: 0.65rem !important;
        padding-right: 0.65rem !important;
        font-size: 0.8125rem !important;
    }
}

@media (max-width: 1200px) {
    html {
        font-size: 13.5px;
    }
}

/* Regole per Tablet e Mobile (<= 768px) */
@media (max-width: 768px) {
    html {
        font-size: 13px;
    }
    table th, table td {
        padding-top: 0.4rem !important;
        padding-bottom: 0.4rem !important;
        padding-left: 0.4rem !important;
        padding-right: 0.4rem !important;
        font-size: 0.75rem !important;
    }
}
