/* Eambiente - Standard Dashboard Style */

body {
    background-color: rgb(18, 18, 18);
    color: #333;
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    min-height: 100vh;
}

/* Navbar Universale */
.universal-navbar {
    background-color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand img {
    height: 60px; /* Logo in piccolo */
    max-width: 150px;
    object-fit: contain;
}

.navbar-center-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Bottoni di Breadcrumb / Navigazione Veloce */
.btn-nav-breadcrumb {
    color: #495057;
    background: transparent;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.btn-nav-breadcrumb:hover {
    background-color: #e9ecef;
    color: #1b1b1b;
}

.btn-nav-breadcrumb i {
    margin-right: 6px;
    font-size: 1.1rem;
}

/* User Menu Button */
.btn-profile {
    color: #495057;
    font-weight: 500;
    background: transparent;
    border: 1px solid #dee2e6;
    border-radius: 50px;
    padding: 0.4rem 1rem;
    transition: all 0.2s ease;
}

.btn-profile:hover, .btn-profile.show {
    background: #e9ecef;
    color: #212529;
}

/* Form styling */
.form-card {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    padding: 2.5rem;
    margin-top: 1rem;
    margin-bottom: 3rem;
    color: #333;
}

.form-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #133340;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.4rem;
}

.form-control, .form-select {
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: #133340;
    box-shadow: 0 0 0 0.2rem rgba(19, 51, 64, 0.15);
}

.form-control:disabled {
    background-color: #eee;
    cursor: not-allowed;
}

/* Subsections */
.form-subsection {
    border-top: 2px solid #949494;
    padding-top: 4rem;
    margin-top: 2rem;
    position: relative;
}

.btn-remove-subsection {
    position: absolute;
    top: 15px;
    left: -5px;
    color: #dc3545;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0px;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-remove-subsection:hover {
    color: #a71d2a;
}

/* Select2 Customization to match Bootstrap 5 and our theme */
.select2-container--default .select2-selection--single {
    height: auto !important;
    padding: 0.5rem 0.8rem !important;
    border: 1px solid #ced4da !important;
    border-radius: 6px !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: inherit !important;
    padding-left: 0 !important;
    color: #333 !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100% !important;
    right: 10px !important;
}

.select2-dropdown {
    border: 1px solid #ced4da !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #133340 !important;
}

/* Multi-select Destinazione */
.select2-container--default .select2-selection--multiple {
    border: 1px solid #ced4da !important;
    border-radius: 6px !important;
    padding: 2px 6px !important;
    /* min-height: 38px !important;  */
    /* display: flex !important; */
    align-items: center !important;
}

/* Fix per placeholder tagliato nella multi-select */
.select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field {
    height: 35px !important;
    line-height: 26px !important;
    margin-top: 5px !important;
    padding-left: 4px !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #133340 !important;
    border: none !important;
    color: white !important;
    border-radius: 4px !important;
    padding: 2px 10px 2px 26px !important; /* Spazio per la X a sinistra */
    position: relative !important;
    margin-top: 5px !important;
    margin-bottom: 5px !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: white !important;
    /* position: absolute !important; */
    /* right: 5px !important; */
    top: 50% !important;
    transform: translateY(-50%) !important;
    border: none !important;
    background: transparent !important;
    font-size: 1.1rem !important;
    line-height: 1 !important;
    /* padding: 0 !important; */
    margin: 0 !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #ff4d4d !important;
}

.sticky-bottom-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-primary { background-color: #0d6efd; border-color: #0d6efd; }
.btn-success { background-color: #198754; border-color: #198754; }

/* Top Toolbar Action Buttons */
.action-toolbar {
    margin: 2rem 0;
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: center;
}

.action-toolbar .btn,
.action-toolbar .dropdown-toggle {
    flex: 1;
    padding: 0.8rem 1.2rem;
    font-weight: 400;
    font-size: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #133340;
    color: #ffffff;
}

.dropdown-toggle::after {
    margin-left: 1.5em;
}

.action-toolbar .btn:hover {
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
    color: #ffffff;
    opacity: 0.8;
}

.action-toolbar i {
    margin-right: 8px;
    font-size: 1.2rem;
}

/* Table Widget Container */
.table-widget {
    background-color: rgb(38, 38, 38);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.table-widget-title {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.87);
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

/* Custom Table Style */
.table-custom {
    color: rgba(255, 255, 255, 0.87);
    vertical-align: middle;
}

.table-custom thead th {
    background-color: transparent;
    color: #aaa4ebb5;
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem;
}

.table-custom tbody td {
    color: rgba(255, 255, 255, 0.87);
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.table-custom tbody tr:hover td {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Custom Pagination Style */
.table-widget .pagination .page-link {
    background-color: rgb(25, 25, 25); /* Più scuro del table background (38,38,38) */
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.87); /* Come riga di tabella */
    box-shadow: none;
}

.table-widget .pagination .page-item.active .page-link {
    background-color: rgb(67, 67, 67);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.table-widget .pagination .page-item.disabled .page-link {
    color: rgba(255, 255, 255, 0.3);
    background-color: rgb(25, 25, 25);
    border-color: rgba(255, 255, 255, 0.05);
}

.table-widget .pagination .page-link:hover:not(:disabled):not(.active) {
    background-color: rgb(45, 45, 45);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

.table-hover-light > tbody > tr:hover {
    --bs-table-accent-bg : #d5fdfe;
    color : black;
}

.table-rounded-giacenza tr:first-child th:first-child {
    border-top-left-radius : 10px;
}

.table-rounded-giacenza tr:first-child th:last-child {
    border-top-right-radius : 10px;
}

.table-rounded-giacenza tr:last-child td:first-child {
    border-bottom-left-radius : 10px;
}

.table-rounded-giacenza tr:last-child td:last-child {
    border-bottom-right-radius : 10px;
}

/* DataTables Global Adjustments */
.dataTables_wrapper .dataTables_length, 
.dataTables_wrapper .dataTables_filter, 
.dataTables_wrapper .dataTables_info, 
.dataTables_wrapper .dataTables_processing, 
.dataTables_wrapper .dataTables_paginate {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_filter input, 
.dataTables_wrapper .dataTables_length select {
    background-color: rgb(25, 25, 25) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    border-radius: 4px;
    padding: 4px 8px;
    outline: none;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #aaa4ebb5 !important;
    box-shadow: 0 0 0 0.2rem rgba(170, 164, 235, 0.25);
}

/* Hide default DataTables pagination if using Bootstrap pagination, 
   but since we will let DataTables handle it, we style its default buttons too */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: rgba(255, 255, 255, 0.7) !important;
    border: 1px solid transparent !important;
    background: transparent !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: rgb(67, 67, 67) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgb(45, 45, 45) !important;
    color: white !important;
}

.accordion-button:not(.collapsed) {
    background-color: #e7f1ff;
    color: var(--primary-color);
}

.accordion-item {
    background-color: transparent;
    border: 1px solid rgba(0,0,0,.125);
    margin-bottom: 1rem;
    border-radius: 8px !important;
    overflow: hidden;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    body {
        font-size: 0.9rem;
    }

    .form-card {
        padding: 0.5rem;
    }

    .input-group > .form-control {
        width: 100%;
    }

    .input-group:not(.has-validation) > .dropdown-toggle:nth-last-child(n+3), .input-group:not(.has-validation) > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu) {
        border-top-right-radius: 5px !important;
        border-bottom-right-radius: 0 !important;
        border-top-left-radius: 5px !important;
        border-bottom-left-radius: 0 !important;
    }

    .input-group > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
        border-top-left-radius: 0 !important;
        border-top-right-radius: 0 !important;
        border-bottom-right-radius: 5px !important;
        border-bottom-left-radius: 5px !important;
        margin-left: 0px !important;
    }

    .action-toolbar {
        flex-direction: column;
        gap: 0.8rem;
        margin: 1.5rem 0;
    }

    .input-group {
        flex-direction: column !important;
    }

    .action-toolbar .btn, 
    .action-toolbar .dropdown, 
    .action-toolbar .dropdown-toggle {
        width: 100%;
        flex: none;
    }

    /* Nascondi controlli DataTables su mobile come richiesto */
    .dataTables_outer_wrapper .dataTables_length,
    .dataTables_outer_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        display: none !important;
    }
}

