/* Bootstrap 5 Modal - CSS essenziale per visualizzazione e funzionamento base */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    display: none;
    width: 100vw;
    height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal.show {
    display: block;
}

.modal.fade {
    transition: opacity 0.15s linear;
    opacity: 0;
}

.modal.show.fade {
    opacity: 1;
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem auto;
    pointer-events: none;
    max-width: 500px;
}

.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100vh - 1rem);
}

.modal-lg {
    max-width: 800px;
}

.modal.show .modal-dialog {
    pointer-events: auto;
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, .2);
    border-radius: 0.3rem;
    outline: 0;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, .15);
}

/* Tab-pane supporto base */
.tab-content>.tab-pane {
    display: none;
}

.tab-content>.active {
    display: block;
}

/* Responsive: modal su schermi piccoli */
@media (max-width: 575.98px) {
    .modal-dialog {
        max-width: 95vw;
        margin: 1rem auto;
    }

    .modal-lg {
        max-width: 98vw;
    }
}

@media (min-width: 576px) {
    .modal-dialog {
        max-width: 500px;
        margin: 1.75rem auto;
    }

    .modal-lg {
        max-width: 800px;
    }
}

/* Centramento verticale su schermi grandi */
@media (min-width: 992px) {
    .modal-dialog-centered {
        min-height: calc(100vh - 3.5rem);
    }
}

/* Overlay per disabilitare interazione con il resto della pagina */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    opacity: 0.5;
}

/* Modal header, body, footer Bootstrap 5 */
.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem 1rem;
    border-bottom: 1px solid #dee2e6;
    border-top-left-radius: 0.3rem;
    border-top-right-radius: 0.3rem;
}

.modal-title {
    margin-bottom: 0;
    line-height: 1.5;
    font-size: 1.25rem;
    font-weight: 500;
}

.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1rem;
}

.modal-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    padding: 0.75rem 1rem;
    border-top: 1px solid #dee2e6;
    border-bottom-right-radius: 0.3rem;
    border-bottom-left-radius: 0.3rem;
    gap: 0.5rem;
}

/* Modal close button base (senza aspetto pulsante) */
.btn-close {
    box-sizing: content-box;
    width: 1em;
    height: 1em;
    padding: 0.25em 0.25em;
    color: #000;
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath d='M2.146 2.146a.5.5 0 0 1 .708 0L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e") center/1em auto no-repeat;
    border: none;
    border-radius: 0.375rem;
    opacity: 0.5;
    cursor: pointer;
}

.btn-close:hover {
    opacity: 0.75;
}

/* Bootstrap 5 Switch (form-switch) e checkbox */
.form-check > input {
    position: relative;
    display: block;
    min-height: 1.5rem;
    padding-left: 1.5em;
    margin-bottom: 0.5rem;
}

.form-check-input > input {
    position: absolute;
    left: 0;
    top: 0.25rem;
    width: 1em;
    height: 1em;
    margin-top: 0.25em;
    vertical-align: top;
    background-color: #fff;
    border: 1px solid #adb5bd;
    border-radius: 0.25em;
    appearance: none;
    outline: none;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.form-check-input > input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.form-check-input > input:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, .25);
}

.form-check-label {
    margin-bottom: 0;
    cursor: pointer;
}

/* Switch Bootstrap 5: stile adattato alla struttura HTML reale */
.form-check.form-switch > input {
    padding-left: 2.5em;
    min-height: 1.5em;
    display: flex;
    align-items: center;
}

.form-check.form-switch > input[type="checkbox"] {
    width: 2.5em;
    height: 1.3em;
    margin-left: -2.5em;
    margin-right: 0.5em;
    background-color: #e9ecef;
    border-radius: 2em;
    position: relative;
    border: 1px solid #adb5bd;
    appearance: none;
    outline: none;
    box-shadow: none;
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
    cursor: pointer;
}

.form-check.form-switch > input[type="checkbox"]:before {
    content: "";
    position: absolute;
    top: 0.15em;
    left: 0.15em;
    width: 1em;
    height: 1em;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 0.15s;
    box-shadow: 0 0.1em 0.2em rgba(0, 0, 0, 0.05);
}

.form-check.form-switch > input[type="checkbox"]:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.form-check.form-switch > input[type="checkbox"]:checked:before {
    transform: translateX(1.2em);
}

.form-check.form-switch > input[type="checkbox"]:disabled {
    background-color: #e9ecef;
    opacity: 0.5;
    cursor: not-allowed;
}

/* Bootstrap 5 Accordion e Collapse */
.accordion {
    --bs-accordion-bg: #fff;
    --bs-accordion-border-color: #dee2e6;
    --bs-accordion-border-radius: 0.375rem;
    --bs-accordion-inner-border-radius: 0.375rem;
    --bs-accordion-btn-focus-box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, .25);
    border-radius: var(--bs-accordion-border-radius);
    border: 1px solid var(--bs-accordion-border-color);
}

.accordion-item {
    background-color: var(--bs-accordion-bg);
    border-bottom: 1px solid var(--bs-accordion-border-color);
}

.accordion-body{
    padding: 1rem;
}

.accordion-button {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    color: #212529;
    background-color: var(--bs-accordion-bg);
    border: 0;
    border-radius: 0;
    transition: background-color 0.15s, box-shadow 0.15s;
    cursor: pointer;
}

.accordion-button:focus {
    z-index: 3;
    outline: 0;
    box-shadow: var(--bs-accordion-btn-focus-box-shadow);
}

.accordion-button:not(.collapsed) {
    color: #0d6efd;
    background-color: #e7f1ff;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .125);
}

.accordion-button.collapsed::after {
    transform: rotate(-90deg);
}

.accordion-button::after {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin-left: auto;
    content: "";
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-size: 1.25rem;
    transition: transform 0.2s ease-in-out;
}

.accordion-collapse {
    transition: height 0.35s ease;
    overflow: hidden;
}

.collapse {
    display: none;
}

.collapse.show {
    display: block;
}