/* ------------------------------------ */
/* Estilos para elementos de formulario */
/* ------------------------------------ */
.form {
/* Estilos para el fieldset */
& fieldset {
border: 1px solid #ced4da;
border-radius: 0.25rem;
padding: 1.5rem;
margin-bottom: 1.5rem;
background: linear-gradient(to right, #f5f5f5, #fff);
& legend {
font-weight: 600;
color: #495057;
padding: .5rem 1rem;
margin-bottom: 1rem;
border: 1px solid #ced4da;
border-radius: 0.25rem;
background: linear-gradient(to right, #f5f5f5, #fff)
}
}
/* Etiquetas de los formularios */
& label,
& .group-label {
display: block;
margin-bottom: 0.5rem;
font-weight: 600;
color: #495057;
}
& .group-label {
margin-bottom: 1.5rem;
}
/* Campos de entrada de texto */
& input:not([type="radio"]):not([type="checkbox"]),
& select,
& textarea {
display: block;
width: 100%;
padding: 0.375rem 0.75rem;
font-size: 1rem;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ced4da;
border-radius: 0.25rem;
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
/* Estilos para el campo de texto en foco */
& input:not([type="radio"]):not([type="checkbox"]):focus,
& select:focus,
& textarea:focus {
border-color: #80bdff;
outline: none;
box-shadow: 0 0 0 0.1rem rgba(0, 123, 255, 0.25);
}
/* Select */
& select:not([multiple]) {
height: auto;
appearance: none;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23495057' d='M5 7L2 3h6L5 7z'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 0.75rem center;
background-size: 1rem;
}
& select[multiple] {
height: auto;
padding: 0.375rem;
& option {
padding: 0.375rem;
&:checked {
color: #000;
background: #f5f5f5;
border-radius: 0.25rem;
}
}
}
/* textarea */
& textarea {
resize: vertical;
}
/* agrupa los elementos de un campo */
& .form-group {
margin-bottom: 1.5rem;
&:last-child {
padding-bottom: 0;
margin-bottom: 0;
}
}
/* Fila flexible para organizar elementos en la misma línea */
& .form-row {
display: flex;
flex-wrap: wrap;
gap: 1.5rem;
margin-bottom: 1.5rem;
&:last-child {
padding-bottom: 0;
margin-bottom: 0;
}
}
/* Columna flexible para organizar elementos en la misma columna */
& .form-col {
flex: 1;
min-width: 15rem;
}
/* Estilo para el contenedor input-group */
& .input-group {
display: flex;
flex-direction: row;
align-items: stretch;
width: 100%;
& .input-group-text {
flex-shrink: 0;
padding: 0.375rem 0.75rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #495057;
white-space: nowrap;
background-color: #e9ecef;
border: 1px solid #ced4da;
border-radius: 0.25rem;
}
& input,
& select {
flex: 1;
/* Ocupa todo el espacio disponible */
z-index: 1;
}
& .input-group-prepend {
margin-right: -1px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
z-index: 0;
}
&>input:not(:first-child),
&>select:not(:first-child) {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
& .input-group-append {
margin-left: -1px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
z-index: 0;
}
&>input:not(:last-child),
&>select:not(:last-child) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}
/* Estilos generales para campos de formulario válidos e inválidos */
& input:not([type="radio"]):not([type="checkbox"]),
&.was-validated input:not([type="radio"]):not([type="checkbox"]),
& select,
&.was-validated select,
& textarea,
&.was-validated textarea {
background-repeat: no-repeat;
background-position: right calc(.375em + .1875rem) center;
background-size: calc(.75em + .375rem) calc(.75em + .375rem);
&.is-valid {
padding-right: calc(1.5em + .75rem);
border-color: #28a745;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
&:focus {
border-color: #28a745;
box-shadow: 0 0 0 0.1rem rgba(40, 167, 69, 0.25);
}
}
&.is-invalid {
padding-right: calc(1.5em + .75rem);
border-color: #dc3545;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
&:focus {
border-color: #dc3545;
box-shadow: 0 0 0 0.1rem rgba(220, 53, 69, 0.25);
}
}
&:focus {
outline: none;
}
}
/* Estilos para agrupar campos de tipo radio y checkbox */
& .radio-group,
& .checkbox-group {
display: flex;
flex-direction: column;
gap: .2rem;
flex-wrap: wrap;
&.radio-group-inline,
&.checkbox-group-inline {
flex-direction: row;
gap: 1.5rem;
}
& label {
display: flex;
flex-direction: row;
align-items: center;
gap: .75rem;
& span {
font-weight: normal;
color: #6c757d;
}
}
}
/* Estilos para campos de tipo radio */
& input[type="radio"] {
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
width: 1rem;
height: 1rem;
border: 1px solid #6c757d;
border-radius: 50%;
outline: none;
cursor: pointer;
position: relative;
&:checked::before {
content: '';
width: .5em;
height: .5em;
border-radius: 50%;
background-color: #6c757d;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
/* Estilos para campos de tipo checkbox */
& input[type="checkbox"] {
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
width: 1rem;
height: 1rem;
border: 1px solid #6c757d;
border-radius: .25rem;
outline: none;
cursor: pointer;
position: relative;
background-color: #fff;
transition: background-color 0.3s, border-color 0.3s;
&:checked {
background-color: #fff;
border-color: #6c757d;
&::before {
content: '';
width: .65em;
height: .65em;
background-color: #6c757d;
border-radius: .2em;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
}
/*
& input[type="radio"],
& input[type="checkbox"] {
&.is-valid:checked {
border-color: #28a745;
&+span {
color: #28a745;
}
&:checked::before {
background-color: #28a745;
}
}
&.is-invalid {
border-color: #dc3545;
&+span {
color: #dc3545;
}
}
}*/
/* Ayuda de texto */
& .form-text {
display: block;
margin-top: 0.25rem;
color: #6c757d;
font-size: 0.875rem;
}
/* Estilos para mensajes de validación */
& .invalid-feedback {
width: 100%;
margin-top: .25rem;
font-size: .875rem;
color: #dc3545;
}
/* Estilos para campos de formulario deshabilitados */
& input:disabled {
background-color: #ffffff !important;
cursor: not-allowed !important;
opacity: 0.65 !important;
}
}