/* Territori Pro - Stili Personalizzati */

/* Reset e configurazioni base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Gestione delle schermate */
.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.6s ease-out;
}

/* Animazioni personalizzate */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* Stili per i territori con stati */
.territorio-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.territorio-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #e2e8f0, #cbd5e1);
    transition: all 0.3s ease;
}

.territorio-item.non-iniziato::before {
    background: linear-gradient(90deg, #64748b, #475569);
}

.territorio-item.in-verifica::before {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.territorio-item.completato-positivo::before {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.territorio-item.completato-negativo::before {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.territorio-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.territorio-item:hover::before {
    height: 6px;
}

/* Stili per gli item della checklist */
.checklist-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.checklist-item.approved {
    border-color: #22c55e;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.1);
}

.checklist-item.rejected {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.1);
}

/* Effetti hover per i bottoni */
.approve-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(34, 197, 94, 0.3), 0 4px 6px -2px rgba(34, 197, 94, 0.1);
}

.reject-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.3), 0 4px 6px -2px rgba(239, 68, 68, 0.1);
}

/* Stili per il progress bar */
#progress-bar {
    transition: width 0.5s ease-in-out;
}

/* Stili per le sezioni dei territori */
.sezione-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid rgba(226, 232, 240, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 80px;
    z-index: 10;
    transition: all 0.3s ease;
}

.sezione-header:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

/* Stili per il riepilogo */
.summary-item {
    transition: all 0.2s ease;
    border-radius: 8px;
    padding: 12px 16px;
}

.summary-item:hover {
    background: rgba(248, 250, 252, 0.8);
    transform: translateX(4px);
}

.summary-item .item-status.rejected {
    white-space: normal;
    word-wrap: break-word;
    max-width: 250px;
    text-align: right;
    line-height: 1.4;
}

/* Stili per i campi di input */
input:focus, textarea:focus {
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

/* Stili per i messaggi di errore */
.error-message {
    animation: slideInUp 0.3s ease-out;
}

/* Stili per il loading */
.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #0ea5e9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Stili per le notifiche toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid #22c55e;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.warning {
    border-left-color: #f59e0b;
}

/* Stili per i tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 140px;
    background-color: #1e293b;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 8px 12px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -70px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    font-weight: 500;
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1e293b transparent transparent transparent;
}

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

/* Stili per la responsività */
@media (max-width: 768px) {
    .territorio-item {
        margin-bottom: 16px;
    }
    
    .checklist-item {
        padding: 20px;
    }
    
    .item-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .item-actions button {
        width: 100%;
    }
    
    .sezione-header {
        padding: 16px 20px;
        top: 70px;
    }
    
    .sezione-header h2 {
        font-size: 18px;
    }
}

@media (max-width: 640px) {
    .territorio-item {
        padding: 16px;
    }
    
    .checklist-item {
        padding: 16px;
    }
    
    .sezione-header {
        padding: 12px 16px;
    }
    
    .sezione-header h2 {
        font-size: 16px;
    }
}

/* Stili per la stampa */
@media print {
    .screen:not(.active) {
        display: none !important;
    }
    
    .btn, button {
        display: none !important;
    }
    
    .territorio-item {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #e2e8f0 !important;
    }
    
    .checklist-item {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #e2e8f0 !important;
    }
}

/* Stili per l'accessibilità */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus states migliorati */
.focus\:ring-2:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.5);
}

/* Stili per il dark mode (opzionale) */
@media (prefers-color-scheme: dark) {
    .dark\:bg-gray-900 {
        background-color: #0f172a;
    }
    
    .dark\:text-white {
        color: #ffffff;
    }
    
    .dark\:border-gray-700 {
        border-color: #334155;
    }
}

/* Stili per le animazioni di entrata */
.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-slide-up {
    animation: slideInUp 0.4s ease-out;
}

.animate-scale-in {
    animation: scaleIn 0.3s ease-out;
}

/* Stili per i gradienti personalizzati */
.gradient-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
}

.gradient-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.gradient-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.gradient-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* Stili per gli effetti glassmorphism */
.glass {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.glass-dark {
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Stili per le ombre personalizzate */
.shadow-soft {
    box-shadow: 0 2px 15px -3px rgba(0, 0, 0, 0.07), 0 10px 20px -2px rgba(0, 0, 0, 0.04);
}

.shadow-medium {
    box-shadow: 0 4px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.shadow-strong {
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.15), 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

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

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

.fade-in {
    animation: fadeInModal 0.3s forwards;
}

.fade-out {
    animation: fadeOutModal 0.3s forwards;
}