/* color variables */ $clr-primary: #ff7043; $clr-primary-hover: #29e6a7; $clr-primary-dark: #039d69; $clr-gray100: #f9fbff; $clr-gray150: #f4f6fb; $clr-gray200: #eef1f6; $clr-gray300: #e1e5ee; $clr-gray350: #c7ccdb; $clr-gray400: #767b91; $clr-gray500: #4f546c; $clr-gray600: #2a324b; $clr-gray700: #161d34; /* border radius */ $radius: 0.2rem; *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; } body { font-family: "Montserrat", sans-serif; font-weight: 700; height: 100vh; display: flex; justify-content: center; align-items: center; } .search { position: relative; display: flex; justify-content: flex-start; align-items: center; svg { height: 6rem; padding: 1.5rem; position: absolute; cursor: pointer; } &__icon { fill: $clr-gray400; z-index: 99; } &__close { right: 0; fill: white; transition: 500ms fill ease-in; } &__delete { fill: $clr-gray350; right: 5rem; display: none; } input { box-shadow: 0 0 10px 5px $clr-gray300; border: none; border-radius: 50%; padding: 1.75rem 3rem; font-family: inherit; font-size: 2rem; color: $clr-gray400; outline: none; width: 2rem; transition: 500ms width ease-in-out, 500ms padding ease-in-out, 500ms border-radius ease-in-out; &:not(:placeholder-shown) ~ .search__delete { display: block; } } //open state &-open input { width: 34rem; padding: 1.5rem 11rem 1.5rem 6rem; border-radius: $radius; } //when content is in text field show delete button &-open svg.search__close { fill: $clr-gray400; } }