/* ========== ACCORDION PRINCIPALE ========== */
/*
 * NOTA: Gli stili per i grafici a torta sono stati spostati in grafici.css
 */

[class*="-accordion-button"] {
    background: #0d6efd !important;
    color: #fff !important;
    font-weight: 600 !important;
    padding: 1rem 1.25rem !important;
    display: flex;
    align-items: center;
    gap: .75rem;
}

[class*="-accordion-button"]:not(.collapsed) {
    background: #0d6efd !important;
    color: #fff !important;
}

[class*="-accordion-button"]:hover {
    background: #0a58ca !important;
    color: #fff !important;
}

[class*="-accordion-item"] .accordion-body {
    padding: 1.5rem 1.25rem !important;
    background: #DFEFFF !important;
}

/* ========== ACCORDION ANNIDATO ========== */
[class*="-nested-accordion-button"] {
    background: #00000000 !important;
    color: #000000 !important;
    font-weight: 600 !important;
    padding: 0.875rem 1rem !important;
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 0.95rem;
}

[class*="-nested-accordion-button"]:not(.collapsed) {
    background: #00000000 !important;
    color: #000000 !important;
}

[class*="-nested-accordion-button"]:hover { 
    background: #474747ff !important;
    color: #000000 !important;
}
  
[class*="-nested-accordion-item"] .accordion-body {
    padding: 1.25rem 1rem !important;
    background: #00000000 !important;
}

/* ========== BADGE STATUS ========== */ 
[class*="-status-badge"] {
    display: inline-flex !important;
    align-items: center !important; 
    justify-content: center !important;
    width: 30px !important;
    height: 30px !important;
    border-radius: 50% !important;
    font-size: 17px !important;
    font-weight: 700 !important;
}

[class*="-status-badge"].incomplete {
    background: #ffA94d !important;
    color: #fff !important;
} 

[class*="-status-badge"].complete {
    background: #28a745 !important;
    color: #fff !important;
}

/* Rev-mode badge states */
[class*="-status-badge"].rev-all-ok {
    background: #28a745 !important;
    color: #fff !important;
}

[class*="-status-badge"].rev-has-errors {
    background: #dc3545 !important;
    color: #fff !important;
}

[class*="-status-badge"].rev-incomplete {
    background: #6c757d !important;
    color: #fff !important;
}


.accordion{
    border-bottom:none;
    margin-top:1rem;
}
.alert{
    margin-top:0px;
    margin-bottom:0px;
}

/* ========== ITEMS ========== */
.cld-item {
    border: 1px solid #000000ff;
    border-radius: 10px;
    padding: 1rem;
}

.cld-item-head {
    margin-bottom: 0.5rem;
}

.cld-box {
    background: white;
}

.cld-required-asterisk::after {
    content: " *";
    color: #FF0000 !important;
    font-size: 1.875rem;
    font-weight: normal;
    line-height: 0.5;
}

.obbligatorio {
    color: #FF0000 !important;
    font-size: 1.875rem;
    font-weight: normal;
    line-height: 0.5;
}

.cld-item .form-check {
    margin-right: 1rem;
}

.save-single-field {
    font-size: 0.875rem;
}

/* Checkbox groups styling */
.checkbox-group-wrapper {
    background: #FFFFFF;
}

.checkbox-group-wrapper h6 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.checkbox-group-wrapper .form-check {
    padding-left: 1.5rem;
    font-size: 20px;
}

.checkbox-group-wrapper .form-check-label {
    font-size: 0.97rem !important;
}

/* Field group styling */
.field-group-wrapper {
    background-color: #ffffff;
}

.field-group-wrapper .mb-3:last-child {
    margin-bottom: 0 !important;
}

/* Repeatable fields styling */
.repeatable-row {
    border: 1px solid #000000ff !important;
    position: relative;
    margin-bottom: 1rem;
    background: #ffffff;
}

.repeatable-fields-wrapper {
    position: relative;
}

.remove-repeatable-row {
    font-size: 0.875rem;
}

/* Bottone add repeatable con stile dashed */
.add-repeatable-row-wrapper {
    transition: all 0.2s ease;
    background: transparent;
}

.add-repeatable-row-wrapper:hover {
    border-color: #000000ff !important;
}

.add-repeatable-row-wrapper span {
    font-size: 0.9rem;
}

/* Repeatable row title */
.repeatable-row-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.repeatable-row-number {
    font-weight: 700;
}

/* Nested repeatable styling */
.repeatable-container-level-1 {
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 3px solid #e9ecef;
}

.repeatable-container-level-1 .repeatable-row {
    background: #f8f9fa;
}

.repeatable-container-level-1 .repeatable-row-title {
    font-size: 0.9rem;
    color: #6c757d;
}

/* Layout 2 colonne per titolo e commento nel grafico */
.repeatable-row > .two-columns-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 768px) {
    .repeatable-row > .two-columns-layout {
        grid-template-columns: 1fr;
    }
}

/* Campo con label sopra (column: false) */
.field-label-top {
    display: block !important;
}

.field-label-top .form-label {
    margin-bottom: 0.5rem;
}

/* Input e textarea styling */
input,
textarea {
    border: 1px solid black !important;
    outline: none !important;
    box-shadow: none !important;
}

input.form-control {
    border: 1px solid black !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Contenitore di ciascun elemento annidato */
.accordion-item[class*="-nested-accordion-item"] {
    border: 1px solid rgb(0, 80, 98) !important;

    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 0.5rem;

    background: #00000000 !important;
}

/* Bottone del nested accordion */
.accordion-button[class*="-nested-accordion-button"] {
    background-color: transparent !important;
    box-shadow: none !important;
    color: var(--bs-dark1) !important;
}

/* Quando è aperto */
.accordion-button[class*="-nested-accordion-button"]:not(.collapsed) {
    background-color: transparent !important;
    box-shadow: none !important;
}

/* Contenuto dell'accordion annidato */
.accordion-collapse[class*="-nested-accordion-collapse"] {
    border-left: 1px solid black;
    border-right: 1px solid black;
    border-bottom: 1px solid black;
    border-top: none;
    border-radius: 0 0 0.75rem 0.75rem;
    overflow: hidden;
}

/* Corpo interno trasparente */
.accordion-body {
    background-color: transparent !important;
    padding: 0.75rem 1rem;
}

.form-label {
    color: var(--bs-dark1) !important;
    font-weight: 600 !important;
}

.remove-repeatable-row,
.image-chart-delete-btn {
    width: 30px !important;
    height: 30px !important;
    padding: 0 !important;
    font-size: 20px !important;
    line-height: 1 !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.file-preview-area {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 50px;
}

.file-preview-item {
    position: relative;
    display: inline-block;
}

.file-preview-item .img-thumbnail {
    border: 2px solid #dee2e6;
    border-radius: 4px;
}

.file-preview-item .delete-file-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   UPLOAD FILES SIMPLE
   ============================================ */

.upload-files-simple-wrapper {
    padding: 10px 0;
}

.upload-files-simple-btn {
    cursor: pointer;
}

.upload-files-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.upload-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.upload-file-item:hover {
    background: #e9ecef;
}

.upload-file-link {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    text-decoration: none;
    color: #212529;
}

.upload-file-link:hover {
    color: var(--bs-primary);
}

.upload-file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #6c757d;
}

.upload-file-icon svg {
    width: 24px;
    height: 24px;
}

.upload-file-name {
    font-size: 0.95rem;
    font-weight: 500;
    word-break: break-all;
}

.upload-file-delete {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 16px;
    line-height: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   VIEW MODE / READ-ONLY STYLES
   ============================================ */

/* Container per i valori visualizzati in read-only */
.view-mode-display {
    padding: 0.5rem 0;
    font-size: 1rem;
    color: #212529;
    line-height: 1.5;
}

.view-mode-display .view-mode-value {
    color: #212529;
    font-weight: 500;
}

.view-mode-display .view-mode-textarea {
    display: block;
    padding: 0.75rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    white-space: pre-wrap;
}

.view-mode-display .view-mode-link {
    color: #0d6efd;
    text-decoration: underline;
    word-break: break-all;
}

.view-mode-display .view-mode-link:hover {
    color: #0a58ca;
}

.view-mode-display .view-mode-color-box {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 1px solid #ccc;
    border-radius: 4px;
    vertical-align: middle;
    margin-right: 0.5rem;
}

.view-mode-display .view-mode-color-value {
    font-family: monospace;
    font-size: 0.9rem;
    vertical-align: middle;
}

/* Table editor in modalità readonly */
.view-mode-readonly {
    pointer-events: none !important;
    opacity: 0.9;
}

.view-mode-readonly .jexcel {
    user-select: none;
}

.view-mode-readonly .jexcel tbody td {
    cursor: default !important;
    background-color: #f8f9fa !important;
}

/* Repeatable row in view mode */
.repeatable-row .view-mode-display {
    padding: 0.25rem 0;
}

/* Stili per il bottone Modifica */
.edit-section-btn,
.edit-single-field-btn,
.edit-single-repeatable-row-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.edit-section-btn svg,
.edit-single-field-btn svg,
.edit-single-repeatable-row-btn svg {
    flex-shrink: 0;
}

/* Sezione in view mode - stile distintivo */
[data-view-mode="1"] .accordion-body {
    background: #f0f7ff !important;
}

[data-view-mode="1"] .cld-item {
    background: #ffffff;
}

[data-view-mode="1"] .cld-box {
    background: #fafafa;
}

/* Animazione transizione view/edit mode */
.view-mode-display {
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Checkbox/radio group in view mode */
.checkbox-group-wrapper .view-mode-display,
.w-100 .view-mode-display {
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 0.375rem;
    margin-top: 0.5rem;
}

/* File preview in view mode - nascondi bottoni ma mostra file */
[data-view-mode="1"] .file-preview-item {
    pointer-events: auto;
}

[data-view-mode="1"] .file-preview-item .img-thumbnail {
    cursor: pointer;
}

[data-view-mode="1"] .upload-file-item {
    padding-right: 15px;
}

/* Label visibile anche in view mode */
[data-view-mode="1"] .form-label {
    display: block !important;
}

/* ============================================
   SIMBOLI RADIO E CHECKBOX IN VIEW MODE
   ============================================ */

/* Simbolo generico */
.view-mode-symbol {
    font-size: 1rem;
    font-weight: bold;
    margin-right: 0.25rem;
}

/* Radio button - opzione selezionata */
.view-mode-radio-selected {
    color: #198754;
}

/* Radio button - opzione non selezionata */
.view-mode-radio-unselected {
    color: #6c757d;
}

/* Checkbox - opzione selezionata */
.view-mode-checkbox-selected {
    color: #198754;
}

/* Checkbox - opzione non selezionata */
.view-mode-checkbox-unselected {
    color: #6c757d;
}

/* Gruppi radio/checkbox in view mode */
.view-mode-radio-group,
.view-mode-checkbox-group {
    padding: 0.5rem 0;
}

.view-mode-radio-group span,
.view-mode-checkbox-group span {
    display: inline-block;
    margin-right: 1rem;
}

/* In view mode, le label devono essere cliccabili e ben visibili */
[data-view-mode="1"] .form-check-label {
    cursor: default;
    padding-left: 0;
}
