/* Stili personalizzati per l'applicazione Scadenze */

/* Configurazione base */
:root {
    --primary-color: #3b82f6;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #06b6d4;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Reset e base */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

/* Layout principale */
.app-layout {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-secondary);
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #1e40af 0%, #1d4ed8 100%);
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 40;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 700;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-logo span {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.sidebar-nav {
    padding: 1rem 0;
    flex: 1;
}

.nav-item {
    margin: 0.25rem 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border-radius: 0 25px 25px 0;
    margin-right: 1rem;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #fbbf24;
    border-radius: 0 4px 4px 0;
}

.nav-icon {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
    transition: all 0.3s ease;
}

.sidebar.collapsed .nav-icon {
    margin-right: 0;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.75rem;
    margin-right: 0.5rem;
}

.nav-text {
    transition: all 0.3s ease;
    white-space: nowrap;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-profile {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    font-weight: 600;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Varianti di dimensioni per user-avatar */
.user-avatar.small {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.7rem;
}

.user-avatar.large {
    width: 4rem;
    height: 4rem;
    font-size: 1.6rem;
}

.user-avatar.xl {
    width: 6rem;
    height: 6rem;
    font-size: 2.4rem;
}

.sidebar.collapsed .user-avatar {
    margin-right: 0;
}

.user-info {
    flex: 1;
    transition: all 0.3s ease;
}

.sidebar.collapsed .user-info {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.2;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Dropdown Sidebar Navigation */
.nav-dropdown {
    position: relative;
}

.dropdown-toggle {
    justify-content: space-between;
    cursor: pointer;
}

.dropdown-arrow {
    width: 1rem;
    height: 1rem;
    transition: transform 0.2s ease;
    margin-left: auto;
}

.nav-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.1);
    margin: 0.25rem 0 0.25rem 1.5rem;
    border-radius: 0.5rem;
}

.nav-dropdown.open .dropdown-menu {
    max-height: 300px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 0.375rem;
    margin: 0.125rem;
    font-size: 0.875rem;
}

.dropdown-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(3px);
}

.dropdown-item.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    font-weight: 500;
}

.dropdown-icon {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
}

.sidebar.collapsed .dropdown-menu {
    display: none;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-wrapper {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background: #f8fafc;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 1rem;
    }
}

/* Header */
.app-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Navigation */
.nav-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    margin-bottom: 1.5rem;
    border-radius: 0.5rem 0.5rem 0 0;
    overflow-x: auto;
}

.nav-tab {
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-tab:hover {
    color: var(--primary-color);
    background-color: var(--bg-tertiary);
}

.nav-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: var(--bg-secondary);
}

/* Cards */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

/* Statistiche Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.stat-card-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.stat-card-change {
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Varianti colori per stat cards */
.stat-card.primary .stat-card-icon {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
}

.stat-card.success .stat-card-icon {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.stat-card.warning .stat-card-icon {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.stat-card.error .stat-card-icon {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

/* Tabelle */
.table-container {
    overflow-x: auto;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
}

.data-table th {
    background: var(--bg-secondary);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
}

.data-table tbody tr:hover {
    background-color: var(--bg-tertiary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Badge e Status */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge.warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge.error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

.badge.info {
    background-color: rgba(6, 182, 212, 0.1);
    color: var(--info-color);
}

.badge.secondary {
    background-color: rgba(100, 116, 139, 0.1);
    color: var(--secondary-color);
}

/* Status specifici per contratti */
.status-attivo {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-in_scadenza {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.status-scaduto {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

/* Form elementi */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-label.required::after {
    content: " *";
    color: var(--error-color);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: var(--bg-primary);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input:disabled {
    background-color: var(--bg-tertiary);
    color: var(--text-light);
    cursor: not-allowed;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-error {
    color: var(--error-color);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #475569;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #059669;
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background-color: #d97706;
}

.btn-error {
    background-color: var(--error-color);
    color: white;
}

.btn-error:hover:not(:disabled) {
    background-color: #dc2626;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
}

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

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

/* Modali */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-primary);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: var(--bg-tertiary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Notifiche */
.notification-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    max-width: 400px;
}

.notification {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    transform: translateX(100%);
    transition: transform 0.3s;
}

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

.notification-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.notification-message {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.notification-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    margin-left: 0.5rem;
}

.notification.success {
    border-left: 4px solid var(--success-color);
}

.notification.error {
    border-left: 4px solid var(--error-color);
}

.notification.warning {
    border-left: 4px solid var(--warning-color);
}

.notification.info {
    border-left: 4px solid var(--info-color);
}

/* Loading spinner */
.spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Animazioni avanzate */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% { transform: translate3d(0, 0, 0); }
    40%, 43% { transform: translate3d(0, -8px, 0); }
    70% { transform: translate3d(0, -4px, 0); }
    90% { transform: translate3d(0, -2px, 0); }
}

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

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

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

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Classi di animazione */
.animate-pulse { animation: pulse 2s infinite; }
.animate-bounce { animation: bounce 1s infinite; }
.animate-slideInLeft { animation: slideInLeft 0.6s ease-out; }
.animate-slideInRight { animation: slideInRight 0.6s ease-out; }
.animate-scaleIn { animation: scaleIn 0.4s ease-out; }
.animate-fadeInUp { animation: fadeInUp 0.6s ease-out; }
.animate-shake { animation: shake 0.5s ease-in-out; }

/* Miglioramenti card con hover effects */
.card-enhanced {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: relative;
}

.card-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.card-enhanced:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.card-enhanced:hover::before {
    transform: scaleX(1);
}

/* Hover effects per bottoni */
.btn-hover-float:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.btn-hover-grow:hover {
    transform: scale(1.05);
}

.btn-hover-glow {
    position: relative;
    overflow: hidden;
}

.btn-hover-glow::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn-hover-glow:hover::before {
    left: 100%;
}

/* Loading e stati */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.progress-bar {
    background: #e2e8f0;
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    border-radius: inherit;
    transition: width 0.5s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Notifiche avanzate */
.notification-enter {
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification-exit {
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) reverse;
}

/* Dropdown contratti inline */
.contracts-dropdown {
    position: absolute;
    z-index: 50;
    margin-top: 0.5rem;
    width: 20rem;
    background-color: white;
    border-radius: 0.375rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    right: 0;
}

.contracts-dropdown.hidden {
    display: none;
}

.contracts-dropdown .contracts-list {
    padding: 0.75rem;
    max-height: 12rem;
    overflow-y: auto;
}

.contracts-dropdown .contract-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    background-color: #f9fafb;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.contracts-dropdown .contract-item:last-child {
    margin-bottom: 0;
}

.dropdown-arrow {
    transition: transform 0.2s ease;
}

.dropdown-arrow.rotate-180 {
    transform: rotate(180deg);
}

/* Miglioramenti per il wizard */
.wizard-steps {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.wizard-step {
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.wizard-step.active {
    color: #3b82f6;
    font-weight: 600;
}

.wizard-step.inactive {
    color: #9ca3af;
}

.wizard-separator {
    color: #9ca3af;
    font-size: 0.875rem;
}

/* Campi business dinamici */
.business-fields {
    transition: all 0.3s ease;
}

.business-fields.hidden {
    display: none;
}

/* Miglioramenti tabella clienti */
.table-enhanced tr:hover .contracts-button {
    background-color: #eff6ff;
}

.contracts-button {
    transition: all 0.2s ease;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
}

.contracts-button:hover {
    background-color: #dbeafe;
}

/* Righe espandibili contratti */
.contracts-expanded-row {
    transition: all 0.3s ease;
}

.contracts-expanded-row.hidden {
    display: none;
}

.contracts-expanded-row td {
    border-top: none !important;
}

.contracts-expanded-row .bg-gray-50 {
    background-color: #f9fafb;
    border-left: 4px solid #3b82f6;
}

/* Animazioni dropdown arrows */
.row-arrow {
    transition: transform 0.2s ease;
}

.row-arrow.rotate-180 {
    transform: rotate(180deg);
}

/* Miglioramenti tabelle interne */
.contracts-expanded-row .table-enhanced {
    margin: 0;
    box-shadow: none;
}

.contracts-expanded-row .table-enhanced th {
    background-color: #f3f4f6;
    border-bottom: 1px solid #d1d5db;
}

/* Form contratti nel wizard */
.contract-form {
    background-color: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

/* File input styling */
input[type="file"] {
    padding: 0.5rem;
    border: 2px dashed #d1d5db;
    border-radius: 0.375rem;
    background-color: #f9fafb;
    transition: all 0.2s ease;
}

input[type="file"]:hover {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

input[type="file"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Profile Image Management */
.profile-image-selector {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.image-type-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
}

.image-type-tab {
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: #6b7280;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.image-type-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.image-type-tab:hover {
    color: #3b82f6;
    background-color: #f9fafb;
}

.image-content {
    padding: 1rem 0;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 1rem;
    max-width: 400px;
}

.avatar-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.avatar-option:hover {
    border-color: #3b82f6;
    background-color: #f8fafc;
}

.avatar-option.selected {
    border-color: #3b82f6;
    background-color: #eff6ff;
    box-shadow: 0 0 0 1px #3b82f6;
}

.avatar-option img,
.avatar-option .avatar-preview {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-bottom: 0.5rem;
}

.avatar-option .avatar-name {
    font-size: 0.75rem;
    color: #6b7280;
    text-align: center;
}

.photo-upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    background-color: #f9fafb;
}

.photo-upload-area:hover {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

.photo-upload-area.dragover {
    border-color: #3b82f6;
    background-color: #eff6ff;
    transform: scale(1.02);
}

.upload-icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 1rem;
    color: #9ca3af;
}

.current-photo-preview {
    max-width: 150px;
    max-height: 150px;
    border-radius: 0.5rem;
    margin: 1rem auto;
    display: block;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Status filter buttons */
.status-filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    background-color: white;
    color: #6b7280;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.status-filter-btn:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

.status-filter-btn.active {
    background-color: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.status-filter-btn.active:hover {
    background-color: #2563eb;
    border-color: #2563eb;
}

/* Pagination Styles */
.form-select-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background-color: white;
    color: #374151;
    min-width: 60px;
}

.form-select-sm:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6;
}

#pagination-controls {
    border-top: 1px solid #e5e7eb;
    background-color: #f9fafb;
}

#page-numbers button {
    min-width: 36px;
    text-align: center;
    transition: all 0.2s ease;
}

#page-numbers button:hover {
    background-color: #f3f4f6;
}

#page-numbers button.bg-blue-600 {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
}

#page-numbers button.bg-blue-600:hover {
    background-color: #2563eb !important;
    border-color: #2563eb !important;
}

#prev-page-btn:disabled,
#next-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#prev-page-btn:disabled:hover,
#next-page-btn:disabled:hover {
    background-color: white;
}

/* App shell mobile / PWA */
.nav-badge,
.app-bottom-badge {
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.28rem;
    border-radius: 999px;
    background: #f87171;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
    display: none;
}

.nav-badge.has-items,
.app-bottom-badge.has-items {
    display: inline-block;
}

.nav-badge {
    margin-left: auto;
    background: rgba(248, 113, 113, 0.95);
}

.mobile-header {
    display: none;
}

.mobile-overlay {
    display: none;
}

.app-bottom-nav {
    display: none;
}

.mobile-profile-shortcut {
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 999px;
    border: 1px solid rgba(203, 213, 225, 0.95);
    background: rgba(255, 255, 255, 0.92);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    color: #0f172a;
    flex-shrink: 0;
}

.mobile-profile-avatar {
    width: 100%;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mobile-profile-avatar img,
.mobile-profile-avatar > div {
    width: 100%;
    height: 100%;
}

@media (max-width: 768px) {
    body {
        background:
            radial-gradient(circle at top, rgba(59, 130, 246, 0.08), transparent 34%),
            linear-gradient(180deg, #f8fbff 0%, #f8fafc 38%, #eef2ff 100%);
    }

    .app-layout {
        min-height: 100dvh;
        display: block;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(86vw, 320px);
        transform: translateX(-108%);
        box-shadow: 18px 0 44px rgba(15, 23, 42, 0.26);
        border-radius: 0 1.5rem 1.5rem 0;
        z-index: 80;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        width: min(86vw, 320px);
    }

    .sidebar.collapsed .sidebar-logo span,
    .sidebar.collapsed .nav-text,
    .sidebar.collapsed .user-info {
        opacity: 1;
        width: auto;
        overflow: visible;
    }

    .sidebar.collapsed .nav-link {
        justify-content: flex-start;
        padding: 0.9rem 1.1rem;
        margin-right: 1rem;
    }

    .sidebar.collapsed .nav-icon {
        margin-right: 0.75rem;
    }

    .mobile-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.38);
        backdrop-filter: blur(3px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
        z-index: 70;
    }

    .mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .main-content {
        min-height: 100dvh;
    }

    .mobile-header {
        position: sticky;
        top: 0;
        z-index: 40;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: calc(env(safe-area-inset-top, 0px) + 0.85rem) 1rem 0.9rem;
        background: rgba(248, 250, 252, 0.86);
        backdrop-filter: blur(18px);
        border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    }

    .mobile-menu-btn {
        width: 2.8rem;
        height: 2.8rem;
        border-radius: 999px;
        border: 1px solid rgba(203, 213, 225, 0.9);
        background: rgba(255, 255, 255, 0.92);
        color: #0f172a;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
    }

    .mobile-header button[data-action="logout"],
    .mobile-header a[data-action="logout"],
    .mobile-header [data-action="logout"] {
        display: none !important;
    }

    .content-wrapper {
        padding: 1rem 1rem calc(6.5rem + env(safe-area-inset-bottom, 0px));
        max-width: 100%;
        overflow-y: visible;
    }

    .content-wrapper > *:first-child {
        margin-top: 0;
    }

    .card-enhanced,
    .card,
    .calendar-panel {
        border-radius: 1.25rem !important;
        box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    }

    .app-bottom-nav {
        position: fixed;
        left: 0.75rem;
        right: 0.75rem;
        bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
        z-index: 65;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0.35rem;
        padding: 0.55rem;
        border: 1px solid rgba(226, 232, 240, 0.88);
        border-radius: 1.5rem;
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(18px);
        box-shadow: 0 20px 44px rgba(15, 23, 42, 0.18);
    }

    .app-bottom-link {
        position: relative;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
        padding: 0.55rem 0.35rem;
        border-radius: 1rem;
        color: #64748b;
        text-decoration: none;
        font-size: 0.66rem;
        font-weight: 700;
        letter-spacing: 0.02em;
    }

    .app-bottom-link.active {
        color: #0f172a;
        background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    }

    .app-bottom-icon {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .app-bottom-icon svg {
        width: 1.35rem;
        height: 1.35rem;
    }

    .app-bottom-badge {
        position: absolute;
        top: -0.35rem;
        right: -0.55rem;
    }

    .table-enhanced,
    .data-table {
        min-width: 720px;
    }

    .modal {
        width: calc(100% - 1.25rem);
        max-height: calc(100dvh - 1.5rem);
        border-radius: 1.25rem;
    }
}
