body {
    background: linear-gradient(180deg, #F7FAFC 0%, #F3F4F6 35%, #EEF2F7 100%);
    background-repeat: round;
    background-position: right 5rem bottom, 0% 50%;
}

/*
* Admin actions
*/
.btn-admin {
    background-color: #FFF9E6;
    color: #FFB800;
    border: 1px solid #FFB800;
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
}

/*
* Misc
*/
button.nav-link.active {
    background-color: white !important;
    border-top-right-radius: 7px;
    border-top-left-radius: 7px;
}
.card-no-border {
    border-color: transparent !important;
    border-radius: 0 !important;
}

/*
* Input
*/
.input-filter input {
    background-color: transparent;
    border-radius: 0;
    border: 0;
    border-bottom: 1px solid #F0F2F6;
}
.input-filter input:focus {
    border-bottom: 1px solid #3774FF;
    box-shadow: none;
}

/*
* Spinner
*/
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator {
    display: inline-block;
}
.htmx-request.htmx-indicator {
    display: inline-block;
}

/*
* Tomselect
*/
.separator {
    border-right: 1px solid #EFF2F6;
}
.ts-wrapper {
    height: 47px;
}
.ts-wrapper.single .ts-control {
    background-color: transparent !important;
    background-image: none;
    border: none;
    box-shadow: none;
    padding: 0;
    height: 100%;
}
.ts-control {
    padding: 0 !important;
    border: none !important;
    display: flex;
    align-items: center;
}
.ts-control input {
    height: 100% !important;
    margin: 0 !important;
    padding-left: 5px !important;
}
.ts-dropdown {
    border: 1px solid #D1D5DB;
    border-radius: 0.375rem;
    margin-top: 4px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
.ts-dropdown .option {
    padding: 8px 16px;
}
.ts-dropdown .active {
    background-color: #EFF6FF;
    color: #1E40AF;
}
.ts-wrapper.single .ts-control::after {
    border-color: #6B7280 transparent transparent;
    right: 15px;
}
#referent-id:focus-visible,
.ts-wrapper:focus-visible,
.ts-control:focus-visible,
.ts-wrapper .ts-control:focus-visible,
.ts-wrapper.focus .ts-control,
.ts-wrapper.focus-visible .ts-control,
.ts-wrapper.focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 0 #3B82F6 !important;
    border-color: transparent !important;
}
.ts-wrapper .dropdown-input:focus-visible {
    outline: 2px solid #3B82F6;
}
#referent-id:focus {
    outline: none !important;
}

/* Generic fallback for error styles (used if theme CSS is absent) */
.rp-field-error {
    border-color: #EF4444 !important;
    border-width: 2px !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
    background-color: rgba(239, 68, 68, 0.05) !important;
}
.rp-error-message {
    color: #DC2626;
    font-size: 13px;
    margin-top: 8px;
    padding: 8px 12px;
    text-align: center;
    background-color: rgba(239, 68, 68, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    font-weight: 500;
}
.rp-general-error-alert {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    margin-bottom: 24px;
    background-color: rgba(239, 68, 68, 0.15);
    border: 2px solid #EF4444;
    border-radius: 8px;
    color: #DC2626;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    animation: fade-in 0.3s ease-out;
}
.rp-general-error-alert iconify-icon {
    font-size: 20px;
}
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/*
* Htmx
*/
.htmx-indicator {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 10px;
}
.htmx-request .htmx-indicator {
    display: block;
}
.translation-input {
    min-height: 60px;
}

/*
* GridJS
*/
.gridjs-search-input {
    width: 100%;
}
.gridjs-th-content {
    line-height: 24px;
}
th.gridjs-th {
    padding: 0.5rem 1rem;
}
td.gridjs-td {
    padding: 0.8rem 1rem;
}

/*
* History
*/
#historyModal {
    transition: opacity 0.3s ease;
}
#historyModal.hidden {
    opacity: 0;
    pointer-events: none;
}
#historyModal:not(.hidden) {
    opacity: 1;
    pointer-events: all;
}

/*
* Colori
*/
.bg-warning-subtle {
    background-color: #FFF3CD;
}

/*
* Datatables
*/
.table {
    width: 100%;
    background-color: #FFF;
    border-radius: 0.75rem;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #E5E7EB;
}
.table thead th {
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: #56667A;
    background-color: #F9FAFB;
    border-bottom: 1px solid #E5E7EB !important;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    text-align: auto !important;
}
.table tbody td {
    padding: 0.75rem 1.25rem;
    color: #4B5563;
    border-bottom: 1px solid #E5E7EB;
    transition: all 0.2s ease;
}
.table tbody tr:hover {
    background-color: #F9FAFB;
}
.dataTables_wrapper .search-bar {
    width: 100%;
    margin-bottom: 10px;
    border-radius: 0.75rem;
}
.dataTables_wrapper .dataTables_length select {
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: 2px solid #E5E7EB;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
}
.dataTables_wrapper .dataTables_length select:hover {
    border-color: #3B82F6;
}
.dataTables_wrapper .dataTables_filter {
    width: 100%;
}
.dataTables_wrapper .dataTables_filter input {
    width: 100%;
    padding: 0.5rem 1rem;
    background-color: #FFF;
    border: 2px solid #E5E7EB;
    border-radius: 0.5rem;
    margin-left: 0;
    transition: all 0.2s ease;
}
table.dataTable.no-footer {
    border-bottom: none;
    margin-bottom: 10px;
}
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #3B82F6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Stili paginazione */
.dataTables_wrapper .dataTables_paginate {
    padding: 0.75rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.375rem 0.75rem;
    margin: 0 0.125rem;
    border: 1px solid #D1D5DB;
    border-radius: 0.25rem;
    color: #374151 !important;
    background: #FFF;
    font-size: 0.8125rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background-color: #EFF6FF !important;
    border-color: #3B82F6;
    color: #2563EB !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background-color: #EFF6FF !important;
    border-color: #3B82F6;
    color: #2563EB !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    color: #ADB5BD !important;
    cursor: not-allowed;
    background-color: #FFF;
    border-color: #D1D5DB;
    opacity: 0.65;
}
.dataTables_wrapper .dataTables_paginate .ellipsis {
    padding: 0.375rem;
    color: #374151;
}
.dataTables_wrapper .dataTables_info {
    padding: 0.75rem;
    color: #374151;
    font-size: 0.8125rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}
.loading-overlay.active {
    display: flex;
}
.loading-overlay .loading-content {
    text-align: center;
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: float 3s ease-in-out infinite;
    max-width: 320px;
}
.loading-overlay img {
    width: 100%;
    height: auto;
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
}
.loading-overlay .caption {
    color: #374151;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
}

@keyframes float {

    0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(0);
    }
}

/* Language Toggle Section */
.language-section {
    background-color: #FFF;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid #E5E7EB;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    margin-bottom: 0.75rem;
}
.language-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid #E5E7EB;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
}
.language-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.language-title-icon {
    width: 1rem;
    height: 1rem;
    color: #9CA3AF;
    flex-shrink: 0;
}
.language-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.language-help {
    font-size: 0.75rem;
    color: #6B7280;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.language-help-icon {
    width: 0.875rem;
    height: 0.875rem;
    color: #9CA3AF;
}
.language-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.language-button {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.625rem;
    border: 1px solid #E5E7EB;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}
.language-button--active {
    background-color: #EFF6FF;
    border-color: #93C5FD;
    box-shadow: 0 1px 2px 0 rgba(59, 130, 246, 0.05);
}
.language-button--active:hover {
    background-color: #DBEAFE;
}
.language-button--inactive {
    background-color: #FFF;
    border-color: #E5E7EB;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.language-button--inactive:hover {
    background-color: #F9FAFB;
}
.language-button__icon {
    width: 0.875rem;
    height: 0.875rem;
    margin-right: 0.25rem;
}
.language-button__icon--active {
    color: #2563EB;
}
.language-button__icon--inactive {
    color: #9CA3AF;
}
.language-button__text--active {
    color: #1D4ED8;
}
.language-button__text--inactive {
    color: #374151;
}
.language-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    margin-left: 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    border-width: 1px;
}
.language-badge--red {
    background-color: #FEE2E2;
    border-color: #FECACA;
    color: #991B1B;
}
.language-badge--yellow {
    background-color: #FEF3C7;
    border-color: #FDE68A;
    color: #92400E;
}
.language-badge--green {
    background-color: #DCFCE7;
    border-color: #BBF7D0;
    color: #166534;
}
.language-badge__icon {
    width: 0.75rem;
    height: 0.75rem;
    margin-right: 0.25rem;
}

/* Column Animations */
.column-transition {
    transition:
        opacity 0.3s ease,
        width 0.3s ease,
        padding 0.3s ease;
}
.column-hiding {
    opacity: 0;
    width: 0;
    padding-left: 0;
    padding-right: 0;
}
.column-hidden {
    display: none;
    opacity: 1;
    width: auto;
    padding: initial;
}
.column-showing {
    display: table-cell;
    opacity: 0;
    width: 0;
    padding-left: 0;
    padding-right: 0;
}
.column-visible {
    opacity: 1;
    width: auto;
    padding: initial;
}

/* Textarea adaptive */
textarea[name="translation"] {
    resize: none;
    overflow-y: hidden;
    min-height: 60px;
    transition: height 0.2s ease-out;
}
