.user-card {
    cursor: pointer;
    display: block;
    margin-bottom: 0;
}

.user-card .card-user {
    border: 2px solid #eee;
    transition: all 0.2s ease;
    border-radius: 8px;
    height: 100%;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.user-card .card-user:hover {
    border-color: #0d6efd;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.15);
    transform: translateY(-2px);
}

.user-card input[type="checkbox"]:checked ~ .card-user,
.user-card input[type="checkbox"]:checked + .card-user {
    border-color: #0d6efd;
    background: linear-gradient(135deg, #e9f2ff 0%, #f0f7ff 100%);
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.2);
}

.user-photo {
    width: 50px;
    height: 50px;
    object-fit: cover;
}

.user-select-grid {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.user-select-grid::-webkit-scrollbar {
    width: 6px;
}

.user-select-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.user-select-grid::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.user-select-grid::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Miglioramenti generali del form */
.main-card .card-body {
    padding: 1.5rem;
}

.form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.form-section:hover {
    border-color: #556ee6;
    box-shadow: 0 2px 8px rgba(85, 110, 230, 0.1);
}

.form-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    cursor: pointer;
    user-select: none;
}

.form-section-header h5 {
    color: #212529;
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.text-primary,
.form-section-header i {
    background: linear-gradient(135deg, #d4e84a, #6cc97a, #4bb8a8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.25rem;
}

.form-section-toggle {
    color: #6c757d;
    font-size: 1.25rem;
    transition: transform 0.3s ease;
}

.form-section.collapsed .form-section-toggle {
    transform: rotate(-90deg);
}

.form-section-content {
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease;
    overflow: hidden;
    max-height: 5000px;
    opacity: 1;
}

.form-section.collapsed .form-section-content {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.card-body hr {
    display: none;
}

.form-label.fw-semibold {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #556ee6;
    box-shadow: 0 0 0 0.2rem rgba(85, 110, 230, 0.25);
}

/* Stili per i filtri di ricerca */
#user-search-name,
#user-filter-team {
    transition: all 0.2s ease;
}

#user-search-name:focus,
#user-filter-team:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.user-card-wrapper {
    transition: opacity 0.2s ease;
}

.user-card-wrapper[style*="display: none"] {
    opacity: 0;
    pointer-events: none;
}

/* Stili per i commenti */
.comment-card {
    border-left: 3px solid #0d6efd;
    transition: all 0.2s ease;
    background: #fff;
    margin-bottom: 1rem;
}

.comment-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.comment-card.internal {
    border-left-color: #027242;
}

.comment-card.visible-to-client {
    border-left-color: #28a745;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comment-author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.comment-content {
    color: #495057;
}

/* Stili per allegati */
.attachment-drop-zone {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
}

.attachment-drop-zone:hover {
    border-color: #0d6efd;
    background: #e7f1ff;
}

.attachment-drop-zone.drag-over {
    border-color: #0d6efd;
    background: #e7f1ff;
    transform: scale(1.02);
}

.drop-zone-content {
    pointer-events: none;
}

.attachments-list {
    max-height: 400px;
    overflow-y: auto;
}

.attachments-list::-webkit-scrollbar {
    width: 6px;
}

.attachments-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.attachments-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.attachments-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.attachment-item {
    transition: all 0.2s ease;
}

.attachment-item:hover {
    transform: translateX(4px);
}

.attachment-item.uploading {
    opacity: 0.6;
    pointer-events: none;
}

.comment-date {
    font-size: 0.875rem;
    color: #6c757d;
}

.comments-section {
    max-height: 600px;
    overflow-y: auto;
    padding-right: 10px;
}

.comments-section::-webkit-scrollbar {
    width: 6px;
}

.comments-section::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.comments-section::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.comments-section::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Miglioramenti generali */
.page-container {
    background: #f8f9fa;
    min-height: 100vh;
}

/* Header Sticky */
.ticket-header-sticky {
    position: sticky;
    top: 90px;
    z-index: 100;
    background: white;
    border-radius: 12px;
    box-shadow: 0 -8px 0 0 #f8f8fb, 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    border-left: 4px solid #027242;
}

.ticket-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.ticket-title-section {
    flex: 1;
}

.ticket-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0.5rem;
}

.ticket-meta-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ticket-status-badge {
    font-size: 0.85rem;
    padding: 0.35rem 0.75rem;
    font-weight: 600;
}

.priority-badge-header {
    font-size: 0.85rem;
    padding: 0.35rem 0.75rem;
    font-weight: 600;
}

.priority-badge-header.priority-critica {
    background: #dc3545 !important;
    color: white;
}

.priority-badge-header.priority-alta {
    background: #fd7e14 !important;
    color: white;
}

.priority-badge-header.priority-media {
    background: #ffc107 !important;
    color: #212529;
}

.priority-badge-header.priority-bassa {
    background: #28a745 !important;
    color: white;
}

.main-card {
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border: none;
    border-radius: 12px;
    background: white;
}

.section-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.section-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.sidebar-sticky {
    position: sticky;
    top: 90px;
    /*max-height: calc(100vh - 120px);*/
    overflow-y: auto;
}

.sidebar-sticky::-webkit-scrollbar {
    width: 6px;
}

.sidebar-sticky::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-sticky::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.sidebar-sticky::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Stili per checklist */
.checklist-container {
    min-height: 50px;
}

.checklist-item {
    transition: all 0.2s ease;
}

.checklist-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.checklist-item-content {
    background: #f8f9fa;
    transition: all 0.2s ease;
}

.checklist-item-content:hover {
    background: #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.checklist-item.completed .check-item-title {
    text-decoration: line-through;
    color: #6c757d;
}

.check-item-title {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.check-item-title:focus {
    background: white !important;
    border: 1px solid #0d6efd !important;
    border-radius: 4px;
    padding: 0.25rem 0.5rem !important;
}

.drag-handle {
    cursor: grab;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.checklist-item.drag-over {
    border-top: 2px solid #0d6efd;
}

/* Stili per ticket correlati */
.related-tickets-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.related-tickets-list::-webkit-scrollbar {
    width: 4px;
}

.related-tickets-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.related-tickets-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.related-tickets-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.related-ticket-item {
    display: block;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    background: #fff;
}

.related-ticket-item:hover {
    background: linear-gradient(135deg, rgba(85, 110, 230, 0.05) 0%, rgba(124, 58, 237, 0.05) 100%);
    border-color: #556ee6;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(85, 110, 230, 0.15);
    text-decoration: none;
    color: inherit;
}

.related-ticket-item:last-child {
    margin-bottom: 0;
}

.related-ticket-item .badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    color: white;
    font-weight: 500;
}

.user-card-wrapper {
    width: 150px !important;
}