/********* FORM CLASSES *********/

/* SWITCH */
.switch {
    /* Removes the default browser style */
    -webkit-appearance: none;  
    -moz-appearance: none;     
    appearance: none;   

    width: 3.3em;               
    height: 1.8em;              
    border-radius: var(--radioEstandar);      
    background-color: #ddd;           /* Background color when off */
    position: relative;                 /* Necessary to move the circle */
    cursor: pointer;           
    transition: background-color 0.3s; 
}

.switch:checked {
    background-color: var(--colorPrincipal); 
}

/* Inner circle of the switch */
.switch::before {
    content: '';                 
    position: absolute;
    top: .25em;                    
    left: .25em;                   
    width: 1.2em;               
    height: 1.2em;                
    border-radius: 50%;         
    background-color: white;   
    transition: transform 0.3s;  
}

/* When the checkbox is checked, move the circle to the right */
.switch:checked::before {
    transform: translateX(1.6em); 
}

/* lista */
.contenedor-lista {
    max-height: 57vh; 
    overflow-y: auto; 
    background-color: white;
    border-radius: 2em;
    box-shadow: 0 .5em 1em rgba(0, 0, 0, 0.1);
    margin-bottom: 1em;
}

.lista {
    width: fit-content;
    margin: 2em;
}

.lista__item {
    padding: 1em;
    padding-left: 1.5em;
    padding-right: 1.5em;
    border-bottom: .05em solid var(--grisMuyClaro);
}

.lista__item:last-child {
    border-bottom: none;
}

.lista__texto {
    padding-right: 3em;
    max-width: 30em;
    overflow-x: auto;
}

.lista__item--edicion {
    background-color: var(--colorPrincipalTransparente);
}

.lista__boton {
    margin-left: .5em;
    transition: color 0.3s ease;
    border: none;
    color: var(--colorPrincipal);
    background-color: transparent;
    cursor: pointer;
    font-size: var(--textoEstandar);
}

.lista__boton:hover {
    color: var(--colorSecundario);
}

.form-group label, .form-label {
    text-align: left;
    display: inline-block;
    white-space: normal;
    width: 100%;
}

.hidden-field {
    display: none;
}

.mensaje-de-error-de-formulario {
    color: var(--colorError);
    background-color: var(--fondoColorError);
    border: .05em solid var(--colorError);
    border-radius: var(--radioSutil);
    padding: .5em;
    font-weight: bold;
    font-size: var(--textoChico);
}

.formulario-encuesta {
    min-width: 30vw;
    height: fit-content;
    background: white;
    padding: 1.5em;
    margin: 1em 0em;
    border-radius: 0.5em;
}

/* CUSTOM WIDGETS */

/* Custom image input */
#custom-image-file {
    display: none;
}

#custom-image-file_container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: .1em;
}

#custom-image-file_button {
    width: fit-content; 
    padding: .25em;
    border: .05em solid #ddd;
    border-radius: var(--radioEstandar);
    background-color: #f4f4f4;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

#custom-image-file_button:hover {
    border-color:  #949494;
}

/* Custom file input */
#custom-file-input {
    display: none;
}

#carga-archivo-custom {
    display: flex;
    flex-direction: column;
    justify-content: end;
    gap: .1em;
    width: 20em;
}

#carga-archivo-custom__nombre-de-archivo {
    overflow-x:auto;
}

#custom-file-input_view-link {
    margin-bottom: .25em;
    margin-top: .25em;
    transition: color 0.3s ease;
}

#custom-file-input_view-link:hover {
    color:  var(--colorSecundario);
}

/* Custom options input */

[data-widget="opciones"] .contenedor-de-opciones {
    max-height: 20vh;
    overflow-y: auto;
}

[data-widget="opciones"] .contenedor-opcion {
    margin-bottom: .25em;
}

[data-widget="opciones"] .contenedor-opcion button {
    margin-left: .25em;
    border-radius: var(--radioEstandar);
    border: .05em solid #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
}

[data-widget="opciones"] .contenedor-opcion button:hover, 
[data-widget="opciones"] .contenedor-agregar-opcion button:hover {
    background-color: #d3d3d3;
}

[data-widget="opciones"] .contenedor-agregar-opcion {
    margin-top: .25em;
    margin-bottom: .25em;
}

[data-widget="opciones"] .contenedor-agregar-opcion button {
    border-radius: var(--radioEstandar);
    padding: .25em;
    text-align: center;
    border: .05em solid #ddd;
    margin-top: .25em;
    transition: all 0.3s ease;
}

[data-widget="puntajes-segun-opcion"] .contenedor-de-opciones {
    margin-left: 0.5em;
    width: 75vw; /* 80 - 5 */
    overflow-y: auto;
    overflow-x: hidden;
}

[data-widget="puntajes-segun-opcion"] .contenedor-de-opcion {
    display: flex;
    align-items: center;
    margin-bottom: .25em;
    padding-bottom: .20em;
    padding-top: .20em;
    width: 75vw; /* 80 - 5 */
    border-bottom: 1px solid var(--grisMuyClaro);
}

[data-widget="puntajes-segun-opcion"] .contenedor-de-opcion--vacio {
    background-color: var(--fondoColorError);
    border-radius: var(--radioSutil);
}

[data-widget="puntajes-segun-opcion"] .contenedor-de-opcion__label {
    width: 72vw; /* 80 - 8 */
    overflow-x: auto;
    font-weight: 400;
    color: black;
    padding-left: 1em;
}

[data-widget="puntajes-segun-opcion"] .contenedor-de-opcion__label--vacio {
    color: var(--colorError);
    font-weight: bold;
}


[data-widget="puntajes-segun-opcion"] .contenedor-de-opcion__input {
    width: 5em;
}

[data-widget="puntajes-segun-opcion"] .contenedor-de-opcion__texto-puntos {
    margin-left: 0.5em;
    font-size: var(--textoChico);
}

[data-widget="rangos"] {
    margin-top: 8px;
}

[data-widget="rangos"] #rangos-lista .rango-lista-elemento,
[data-widget="rangos"] #rangos-lista .rango-lista-header {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

[data-widget="rangos"] #rangos-lista .rango-lista-header {
    margin-right: 20px;
    margin-top: 10px;
}

[data-widget="rangos"] #rangos-lista .rango-lista-header input {
    font-weight: bold;
    cursor: default;
}

/********* FORM ELEMENTS *********/

.contenedor-formulario{
    margin: 1em;
}

.formulario {
    width: fit-content;
    min-width: 20vw;
    height: fit-content;
    background: white;
    padding: 1.5em;
    margin: 1em;
    border-radius: var(--radioSutil);
    box-shadow: 0 .5em 1em rgba(0, 0, 0, 0.1); 
}

input {
    height: 2.3em;
}

input, textarea {
    /* max-width: 30em;  */
    width: 100%;
    max-width: 100%;
    padding: 0.55em;
    border: .05em solid var(--grisClaro);
    border-radius: 1em;
    background-color: #f4f4f4;
    transition: border-color 0.3s ease;
}

textarea {
    min-height: 5em;
    min-width: 12em;
    max-height: 30em;
}

input:not([readonly]):focus, textarea:focus {
    border-color: var(--colorPrincipal) !important;
    outline: none;
}

input[readonly]:focus {
    outline: none;
}

input[readonly] {
    background-color: #e1dfdf;
    cursor: not-allowed;
}

/************************ TAMAÑOS ************************/

.ancho-minimo-chico {
    min-width: 20vw;
}

.ancho-minimo-medio {
    min-width: 50vw;
}

.ancho-minimo-grande {
    min-width: 65vw;
}

.ancho-minimo-muy-grande {
    min-width: 80vw;
}

input.datepicker-fijo,
input.datepicker-fijo.flatpickr-input {
    max-width: 250px !important;
    width: 100% !important;
}


/***** CRISPY FORMS CLASSES *****/

.form-group {
    margin-bottom: 1.4em;
}

/***** SELECT - SELECT2WIDGET *****/

/* All */
.select2-container, .select2widget {
    width: 100% !important;
}

/* Container without a selected option */
.select2-container .select2-selection--single {
    background-color: #f4f4f4 !important;
    border: .05em solid #ddd !important;
    border-radius: 1em !important;
    height: 2em !important;
    transition: border-color 0.3s ease;
}

.select2-container .select2-selection--single:focus{
    border-color: var(--colorPrincipal) !important;
    outline: none;
}  

/* Dropdown container */
.select2-container .select2-dropdown {
    background-color: #f4f4f4;
    border: .05em solid #ddd;
    border-radius: 1em;
    margin: 0;
    min-width: fit-content;
}

/* Option */
.select2-container .select2-results__option:hover,
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--colorPrincipal) !important;   
    color: white;                
    border-radius: 1em;
}

.select2-selection .select2-selection--multiple {
    width: 100%;
}

select.custom-select {
    background-color: #f4f4f4;
    border: .05em solid #ddd;
    border-radius: 1em;
    padding: 0.3em;
    padding-left: 0.55em;
    padding-right: 0.55em;
    transition: border-color 0.3s ease;
    width: 100%;
}

.pregunta-y-opcion-padre {
    border-radius: var(--radioSutil);
    border: .05em solid #ddd;
    padding-top: .5em;
}

.formulario-subindice-seleccion #id_pregunta {
    width: 100%;
}

.formulario-subindice-seleccion #div_id_pregunta, 
.formulario-subindice-seleccion #div_id_puntajes {
    border: .05em solid #ddd;
    padding: .5em;
    padding-left: 1.2em;
    padding-right: 1.2em;
}

.formulario-subindice-seleccion #div_id_pregunta {
    margin-bottom: 0;
    padding-bottom: 0;
    border-radius: var(--radioSutil) var(--radioSutil) 0 0;
    border-bottom: none;
}

.formulario-subindice-seleccion #div_id_puntajes {
    border-radius: 0 0 var(--radioSutil) var(--radioSutil);
    border-top: none;
}

.limpiar-respuesta {
    width: 1.5em; 
    height: 1.5em; 
    padding: .1em;
    vertical-align: middle;
}

#seccion-actual {
    min-width: 65vw;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

#seccion-actual h2 {
    width: 100%;
    white-space: normal;
    overflow-wrap: break-word;
    text-align: left;
    margin-bottom: 1.5em;
}

form label, .form-label {
    font-size: 1.25em;
    font-weight: 800;
    color: #222;
    display: inline-block;
    margin-bottom: 0.5em;
}

.form-check-label {
    font-size: 1em;
    font-weight: 500;
    color: #555;
    cursor: pointer;
}

/* Para marcar que son solo lectura a los formularios de subindices */

.formulario--solo-lectura button[type="submit"],
.formulario--solo-lectura input[type="submit"] {
    display: none;
}


.tox.tox-tinymce {
    border: .1em solid var(--grisClaro) !important;
    border-radius: 1em !important;
    overflow: hidden;              /* que la barra de herramientas respete el radio */
}

.tox.tox-tinymce:focus-within {
    border-color: var(--colorPrincipal) !important;   /* igual que el foco de Asunto */
}