/* Layout riga */
.bfar-repeat-row{
    display:flex;
    align-items: flex-start; 
    gap:1rem;
    margin-bottom:.8rem;
    padding: 0.8rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background-color: #fdfdfd;
    flex-wrap: wrap; /* Permette ai sotto-campi di andare a capo */
}

/* Sezione per sotto-campi sopra l'uploader */
.bfar-subfields-top {
    width: 100%; 
    margin-bottom: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bfar-main-file-controls {
    display: flex;
    flex-direction: column; 
    gap: 0.5rem;
    flex-basis: 60%; 
    min-width: 250px;
}
.bfar-dropzone-wrap {
    position: relative;
    width: 100%;
}

/* Drop‑zone */
.bfar-dropzone{
    position:relative;
    border:2px dashed var(--bb-primary-button-background-regular, #007cba); 
    border-radius:8px;
    padding:1.6rem 1rem;
    text-align:center;
    font-size:14px;
    cursor:grab; 
    transition:.3s all;
    color:var(--bb-primary-button-background-regular, #007cba);
    background-color: #f9f9f9;
    width: 100%;
    box-sizing: border-box;
}
.bfar-dropzone.dragover{
    background:var(--bb-primary-button-background-regular, #007cba);
    color:#fff
}
.bfar-file-input-trigger{ 
    position:absolute; inset:0; opacity:0; cursor:pointer; z-index:5; width:100%; height:100%;
}
.bfar-attachment-id { display: none; }

/* Progress-bar */
.dz-progress{
	position:absolute; left:0; bottom:0; width:100%; height:4px;
	background:rgba(0,0,0,.08); border-radius:0 0 8px 8px; overflow:hidden; z-index:6; 
}
.dz-progress .dz-bar{
	display:block; width:0; height:100%;
	background:var(--bb-primary-button-background-regular, #007cba);
	transition:width .2s linear;
}
.dz-text { position: relative; z-index: 1; }

/* Sotto-campi (sezione a destra o sotto i controlli file principali) */
.bfar-subfields {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    flex-basis: 35%; 
    min-width: 200px; 
    padding-top: 5px; 
}
.bfar-subfield-item { 
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.bfar-subfield-item label.bfar-subfield-title { 
    font-size: 0.85em;
    font-weight: 600;
    color: #444;
    margin-bottom: 2px;
}
.bfar-subfield-item input[type="text"],
.bfar-subfield-item select, /* Stile base per select */
.bfar-subfield-item textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #ccd0d4;
    border-radius: 3px;
    font-size: 0.9em;
    box-sizing: border-box;
}
/* Stili specifici per select se necessario */
.bfar-subfield-item select.bfar-voice-gender-select {
    /* Esempio: altezza per allinearsi meglio con altri campi se necessario */
    /* height: 35px; */ 
}

.bfar-checkbox-group label {
    font-weight: normal;
    display: block; 
    font-size: 0.9em;
    margin-bottom: 4px;
    cursor: pointer;
}
.bfar-checkbox-group input[type="checkbox"] {
    margin-right: 6px;
    vertical-align: -2px;
}
.bfar-no-terms-notice {
    font-size: 0.85em;
    color: #777;
    font-style: italic;
}


/* Bottoni */
.bfar-button{
    background:var(--bb-primary-button-background-regular, #2271b1); 
    color:var(--bb-primary-button-text-regular, #fff); 
    border:1px solid var(--bb-primary-button-border-regular, #2271b1); 
    border-radius:var(--bb-button-radius, 3px); 
    padding:6px 12px; font-size:13px; cursor:pointer; transition:.3s all; line-height:1.5;
    text-decoration: none;
    white-space: nowrap;
}
.bfar-button:hover{opacity:.85}
.bfar-add-row { 
    margin-top: 10px;
    background:var(--bb-primary-button-background-regular, #ff6600); 
    border:1px solid var(--bb-primary-button-border-regular, #ff6600); 
}
.bfar-remove-row{ 
    padding: 5px 9px; 
    background-color: #f6f7f7;
    color: #b32d2e;
    border: 1px solid #b32d2e;
    align-self: flex-start; 
    margin-left: auto; 
}
.bfar-remove-row:hover {
    background-color: #b32d2e;
    color: #fff;
}

/* Stile per l'anteprima audio */
.bfar-preview {
    width: 100%; 
    max-width: 350px; 
    height: 40px; 
    display: block; 
}

/* Stile per il loader AJAX */
.bfar-loader {
    position: absolute; top:50%; left:50%; transform:translate(-50%, -50%);
    width:20px; height:20px; border:3px solid #f0f0f0;
    border-top:3px solid var(--bb-primary-button-background-regular, #007cba);
    border-radius:50%; animation:bfar-spin .8s linear infinite; z-index:10;
}
@keyframes bfar-spin { 0%{transform:translate(-50%,-50%) rotate(0deg);} 100%{transform:translate(-50%,-50%) rotate(360deg);}}

/* Placeholder per jQuery UI Sortable */
.bfar-sortable-placeholder {
    border:2px dashed #b4b9be; background-color:#f6f7f7; height:70px; 
    margin-bottom:.8rem; border-radius:4px;
}


/* Stili per Checkbox Personalizzati (estesi per voice_type, voice_age, voice_role) */
.bfar-subfield-voice_type .bfar-checkbox-group label,
.bfar-subfield-voice_age .bfar-checkbox-group label,  /* NUOVO */
.bfar-subfield-voice_role .bfar-checkbox-group label { /* NUOVO */
    display: inline-flex; 
    align-items: center; 
    margin-right: 15px;
    margin-bottom: 8px; 
    font-weight: normal;
    font-size: 0.95em; 
    cursor: pointer;
    position: relative; 
    padding-left: 28px; 
    user-select: none; 
}

.bfar-subfield-voice_type .bfar-checkbox-group input[type="checkbox"],
.bfar-subfield-voice_age .bfar-checkbox-group input[type="checkbox"],  /* NUOVO */
.bfar-subfield-voice_role .bfar-checkbox-group input[type="checkbox"] { /* NUOVO */
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.bfar-subfield-voice_type .bfar-checkbox-group label .bfar-custom-checkbox,
.bfar-subfield-voice_age .bfar-checkbox-group label .bfar-custom-checkbox,  /* NUOVO */
.bfar-subfield-voice_role .bfar-checkbox-group label .bfar-custom-checkbox { /* NUOVO */
    position: absolute;
    top: 0;
    left: 0;
    height: 20px; 
    width: 20px;  
    background-color: #fff;
    border: 2px solid var(--bb-primary-button-border-regular, #dcdcdc); 
    border-radius: 3px; 
    transition: all 0.2s ease-in-out;
}

.bfar-subfield-voice_type .bfar-checkbox-group label:hover input[type="checkbox"] ~ .bfar-custom-checkbox,
.bfar-subfield-voice_age .bfar-checkbox-group label:hover input[type="checkbox"] ~ .bfar-custom-checkbox,  /* NUOVO */
.bfar-subfield-voice_role .bfar-checkbox-group label:hover input[type="checkbox"] ~ .bfar-custom-checkbox { /* NUOVO */
    border-color: var(--bb-primary-button-background-regular, #007cba); 
}

.bfar-subfield-voice_type .bfar-checkbox-group input[type="checkbox"]:checked ~ .bfar-custom-checkbox,
.bfar-subfield-voice_age .bfar-checkbox-group input[type="checkbox"]:checked ~ .bfar-custom-checkbox,  /* NUOVO */
.bfar-subfield-voice_role .bfar-checkbox-group input[type="checkbox"]:checked ~ .bfar-custom-checkbox { /* NUOVO */
    background-color: var(--bb-primary-button-background-regular, #ff6600); 
    border-color: var(--bb-primary-button-background-regular, #ff6600); 
}

.bfar-subfield-voice_type .bfar-checkbox-group .bfar-custom-checkbox::after,
.bfar-subfield-voice_age .bfar-checkbox-group .bfar-custom-checkbox::after,  /* NUOVO */
.bfar-subfield-voice_role .bfar-checkbox-group .bfar-custom-checkbox::after { /* NUOVO */
    content: "";
    position: absolute;
    display: none; 
}

.bfar-subfield-voice_type .bfar-checkbox-group input[type="checkbox"]:checked ~ .bfar-custom-checkbox::after,
.bfar-subfield-voice_age .bfar-checkbox-group input[type="checkbox"]:checked ~ .bfar-custom-checkbox::after,  /* NUOVO */
.bfar-subfield-voice_role .bfar-checkbox-group input[type="checkbox"]:checked ~ .bfar-custom-checkbox::after { /* NUOVO */
    display: block;
}

.bfar-subfield-voice_type .bfar-checkbox-group label .bfar-custom-checkbox::after,
.bfar-subfield-voice_age .bfar-checkbox-group label .bfar-custom-checkbox::after,  /* NUOVO */
.bfar-subfield-voice_role .bfar-checkbox-group label .bfar-custom-checkbox::after { /* NUOVO */
    left: 6px; 
    top: 2px;  
    width: 5px;
    height: 10px;
    border: solid var(--bb-primary-button-text-regular, white); 
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.bfar-subfield-voice_type > label.bfar-subfield-title,
.bfar-subfield-voice_age > label.bfar-subfield-title,   /* NUOVO */
.bfar-subfield-voice_gender > label.bfar-subfield-title, /* NUOVO */
.bfar-subfield-voice_role > label.bfar-subfield-title {  /* NUOVO */
    display: block; 
    margin-bottom: 0.5em; 
}