/* Stili base */
body {
    background-color: #f0f0f0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

.question-text-container {
    flex-grow: 1;
    word-wrap: break-word;
    max-width: 70%;
}

.accordion-header .inline-display {
    display: flex;
    align-items: center;
    margin-left: 0.5rem;
}

.accordion-header .btn-sm {
    height: fit-content;
    align-self: center;
    padding: 0.15rem 0.4rem;
}

.accordion-header .btn-sm i {
    font-size: 0.8rem;
}

/* Skip link per accessibilità */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #0250C5;
    color: white;
    padding: 8px;
    z-index: 100;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Container e layout */
.container {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.py-0 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.mb-4 {
    font-size: 1.1rem;
}

/* Card principale */
.card {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    background-color: #ffffff;
    margin: 1rem;
    padding: 1rem;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: var(--bs-box-shadow);
}

.card-body {
    padding: 1rem 1rem 1rem 1rem;
}

.card-header {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    padding: 1.5rem;
    border-bottom: none;
}

/* Stili per le immagini */
.card-header img {
    max-height: 85px;
    width: auto;
    height: auto;
}

.border-top img {
    height: 85px;
    width: auto;
    max-width: 100%;
}

/* Stili per la navigazione */
.navigation-container {
    display: none; /* Hidden by default */
    align-items: center;
    margin: 15px 0 1rem 0;
}

.progress-bar-container {
    height: 20px;
    flex-grow: 1;
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

#progressBar {
    width: 0%;
    height: 100%;
    transition: width 0.3s ease;
    background-color: #0250C5;
}

#progressText {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: black;
    z-index: 1;
    pointer-events: none;
}

/* Stile per il testo introduttivo */
.intro-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #333;
}

/* Pulsanti di navigazione */
.navigation-buttons {
    display: none; /* Hidden by default */
    margin: 20px 0;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    position: relative;
    top: 0;
    transform: none;
}

.navigation-buttons button {
    vertical-align: middle;
    line-height: normal;
    padding: 0.5rem 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.navigation-buttons.show {
    display: flex;
}

.submit-button {
    display: none;
}

/* Stili per le domande */
.domanda {
    display: none;
    padding: 0rem 1rem 1rem 1rem;
    background-color: #ffffff;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.domanda h2, .domanda h3, .domanda h5 {
    margin-bottom: 2rem !important;
}

.domanda.active {
    display: block;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form elements */
.form-check {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-size: 1.3rem;
    background: white;
}

.form-check:hover {
    background-color: #f0f0f0;
}

.form-check-label {
    font-size: 1.1rem;
    margin-left: 0.5rem;
    cursor: pointer;
    color: #212529;
}

.form-check-input {
    cursor: pointer;
    width: 1.1em;
    height: 1.1em;
    border: 0.6px solid #0250C5;
    margin-top: 0.2em;
}

.form-check-input:checked {
    background-color: #0250C5;
    border-color: #0250C5;
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(2, 80, 197, 0.25);
}

/* Slider styles */
.slider-container {
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 15px;
}

.slider-value {
    display: inline-block;
    min-width: 36px;
    text-align: center;
    font-weight: bold;
    font-size: 1.3rem;
    color: #0250C5;
    margin-left: 10px;
    padding: 2px 6px;
    background-color: rgba(2, 80, 197, 0.1);
    border-radius: 4px;
}

@media (max-width: 767.98px) {
    .btn:hover,
    .btn:focus {
        transform: none;
        box-shadow: none;
        transition: none; /* Disable transition on hover/focus for buttons on mobile */
    }
}

.form-range {
    width: 100%;
    cursor: pointer;
    height: 0.65rem;
    background: #e9ecef;
    border-radius: 0.65rem;
    transition: all 0.3s ease;
}

.form-range::-webkit-slider-thumb {
    width: 1.56rem;
    height: 1.56rem;
    background: #0250C5;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    margin-top: -0.45rem;
}

.form-range::-moz-range-thumb {
    width: 1.56rem;
    height: 1.56rem;
    background: #0250C5;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.form-range::-webkit-slider-runnable-track {
    height: 0.65rem;
    background: #dee2e6;
    border-radius: 0.65rem;
}

.form-range::-moz-range-track {
    height: 0.65rem;
    background: #dee2e6;
    border-radius: 0.65rem;
}

.form-range:hover::-webkit-slider-thumb {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.form-range:hover::-moz-range-thumb {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.form-range:focus {
    outline: none;
    box-shadow: 0 0 0 0.25rem rgba(2, 80, 197, 0.25);
}

/* Stili per i pulsanti */
.btn {
    transition: all 0.3s ease;
    padding: 0.5rem 1.5rem;
}

.btn:hover,
.btn:focus {
    transform: translateY(0);
    box-shadow: none;
    outline: none;
}

#avantiBtn:focus,
#avantiBtn:hover {
    transform: none;
    box-shadow: none;
    outline: none;
}

.btn-primary {
    background-color: #0141a3;
    border-color: #013a90;
    color: #ffffff;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #013580;
    border-color: #012f6e;
}

.btn-secondary {
    background-color: #5a6268;
    border-color: #545b62;
    color: #ffffff;
}

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: #4e555b;
    border-color: #4a5056;
    color: #ffffff;
    outline: none;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #013580;
    border-color: #012f6e;
    outline: none;
}

.btn-success {
    background-color: #28a745;
    border-color: #28a745;
}

/* Stili per gli alert */
.alert {
    border-left: 4px solid #0250C5;
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* Classi per accessibilità */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles */
:focus {
    outline: 3px solid #0250C5;
    outline-offset: 2px;
}

/* Responsive styles */
@media (max-width: 767.98px) {
    .card {
        border: none;
        border-radius: 16px;
        overflow: hidden;
        background-color: #ffffff;
        margin: 0.3rem 0rem 0rem 0rem;
        padding: 0rem;
        transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        box-shadow: var(--bs-box-shadow);
    }

    .col-lg-8 {
        margin: 0.1rem 0rem 0rem 0rem;
        padding: 0rem;
        width: 98%;
        max-width: 98%;
    }

    .form-check-input {
        transform: scale(1);
        margin-right: 8px;
    }

    .card-header {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        gap: 0.5rem;
        padding: 0.8rem;
    }

    .card-header img.custom-logo {
        max-height: 70px;
        width: auto;
        flex-shrink: 0;
    }

    .card-header > div {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .card-header h1 {
        font-size: 1rem;
        line-height: 1.2;
        margin-bottom: 0.2rem;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .card-header p {
        font-size: 0.8rem;
        line-height: 1.2;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        margin-bottom: 0;
    }

    .card-header img {
        margin-right: 0;
    }

    .domanda h2, .domanda h5 {
        font-size: 1.33rem; /* 20% increase from original 1.1rem */
    }

    /* Increase form labels by 20% and make sub-answers bold */
    .form-check-label {
        font-size: 1.33rem; /* 20% increase from original 1.1rem */
        font-weight: bold;
    }

    /* Increase select elements and their labels by 20% */
    select, .form-select {
        font-size: 1.2rem; /* 20% increase from original 1rem */
    }
    .form-label, .quantitative-label {
        font-size: 1.2rem; /* 20% increase */
        font-weight: bold;
    }

    .navigation-container {
        padding: 1rem;
    }

    .card-body {
        padding: 0rem 0.2rem 0rem 0.2rem;
        margin-top: 1.5rem;
    }

    .intro-text {
        font-size: 1rem;
    }

    .navigation-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        margin-bottom: 10px;
        transition: none;
        transform: none;
        box-shadow: none;
    }

    .btn:hover,
    .btn:focus {
        transform: none;
        box-shadow: none;
        transition: none;
    }
   
    .navigation-buttons {
        margin: 3px 0;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
        justify-content: center;
    }

    #avantiBtn,
    #indietroBtn,
    #inviaBtn {
        width: calc(50% - 4px) !important;
        margin-bottom: 8px;
    }

    /* Adjust form elements */
    .form-check-label {
        font-size: 1.21rem; /* 10% increase from 1.1rem */
    }

    .slider-value {
        font-size: 1.3rem;
    }
}


/* Hidden elements */
.hidden-element {
    display: none;
}

/* Bold form labels */
.form-label-bold {
    font-weight: bold;
}

/* Validation styles */
.is-invalid {
    border-color: #dc3545 !important;
}

.invalid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
}

.was-validated .invalid-feedback {
    display: block;
}

.was-validated .form-control:invalid,
.was-validated .form-select:invalid,
.was-validated .form-check-input:invalid {
    border-color: #dc3545;
}

.was-validated .form-check-input:invalid ~ .form-check-label {
    color: #dc3545;
}

/* Contrasto migliorato */
.text-muted {
    color: #6c757d !important;
}

.bg-light {
    background-color: #f8f9fa !important;
}

/* Nuova classe per il pulsante Indietro */
.back-button {
    background-color: #5a6268;
    color: #ffffff;
}

/* Question section styles */
.question-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
}

/* Form header styles */
.form-header {
    background-color: #0d6efd;
    color: white;
    padding: 1rem;
    border-radius: 0.5rem 0.5rem 0 0;
}

/* Styles for quantitative questions */
.quantitative-label {
    min-width: 200px;
}

.quantitative-select {
    width: 100%;
    max-width: 100%;
}

.quantitative-group {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

/* Stili specifici per i pulsanti nel modal anagrafica */
#anagraficaVisibilitaModal .btn-sm {
    padding: 0.15rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.3;
}

#addAnagraficaFieldBtn {
    padding: 0.5rem 1.5rem;
}

#anagraficaVisibilitaModal .btn-sm i {
    font-size: 0.9rem;
    margin-right: 0.2rem;
}

/* Classi per sostituire stili inline e risolvere problemi CSP */
.width-auto {
    width: auto !important;
}

.modal-xl-custom {
    max-width: 1200px !important;
}

.modal-xl-plus {
    max-width: 1400px !important;
}

.alert-questionario-primary {
    display: none;
    background-color: #e7f1ff !important;
    border-color: #b6d4fe !important;
    color: #084298 !important;
}

.hidden-element {
    display: none !important;
}

/* Stili per toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
}

.toast {
    min-width: 250px;
}

/* Stili per drag and drop */
.sortable-placeholder {
    background: #f8f9fa;
    border: 1px dashed #dee2e6;
    height: 50px;
}

.ui-sortable-helper {
    background: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.grip-handle {
    cursor: move;
    width: 30px;
    text-align: center;
}

.grip-handle i {
    font-size: 1.2rem;
    color: #6c757d;
}

.grip-handle:hover i {
    color: #0d6efd;
}

/* Classe per cursore di trascinamento */
.cursor-move {
    cursor: move !important;
}

/* Classi per larghezze minime dei pulsanti */
.min-width-180 {
    min-width: 180px !important;
}

.min-width-160 {
    min-width: 160px !important;
}

.min-width-120 {
    min-width: 120px !important;
}

.min-width-140 {
    min-width: 140px !important;
}

/* Classe per flex-wrap */
.flex-wrap-custom {
    flex-wrap: wrap !important;
}
